diff --git a/tck/old-tck/build/pom.xml b/tck/old-tck/build/pom.xml new file mode 100644 index 0000000..44646ba --- /dev/null +++ b/tck/old-tck/build/pom.xml @@ -0,0 +1,146 @@ + + + + 4.0.0 + + + org.eclipse.ee4j + project + 1.0.6 + + + + org.eclipse.ee4j.authentication.tck + old-authentication-tck + 3.0.0-SNAPSHOT + pom + + Old Jakarta Authentication TCK - build + + + 1.10.2 + ${project.build.directory}/apache-ant-${ant.version} + https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.12.0 + + + + + + maven-clean-plugin + 2.4.1 + + + + old-tck/source/release/JASPIC_BUILD + + ** + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + false + 1.6.7 + + + download-ant + generate-sources + + wget + + + ${skipITs} + ${ant.zip.url} + true + ${project.build.directory} + + + + + + + org.codehaus.mojo + exec-maven-plugin + false + 1.6.0 + + + build-old-tck + generate-sources + + exec + + + ${skipITs} + ${project.basedir}/../source/docker/build_oldtck.sh + ${project.basedir}/../source + + ${ant.home}/ + ${ant.home}/bin:${env.PATH} + + + ${project.basedir}/../source + ${ant.home} + + + 0 + 1 + + + + + + + + maven-install-plugin + 3.0.0-M1 + + + install-old-tck + process-resources + + install-file + + + ${project.basedir}/../source/release/JASPIC_BUILD/latest/authentication-tck.zip + ${project.groupId} + ${project.artifactId} + ${project.version} + zip + true + + + + + + + diff --git a/tck/old-tck/pom.xml b/tck/old-tck/pom.xml new file mode 100644 index 0000000..6b59d73 --- /dev/null +++ b/tck/old-tck/pom.xml @@ -0,0 +1,44 @@ + + + + + 4.0.0 + + + org.eclipse.ee4j.authentication.tck + jakarta-authentication-tck + 3.0.0-SNAPSHOT + + + old-authentication-tck-parent + pom + + Old Jakarta Authentication TCK - main + + + build + run + + + + 11 + 11 + + diff --git a/tck/old-tck/run/pom.xml b/tck/old-tck/run/pom.xml new file mode 100644 index 0000000..2236acf --- /dev/null +++ b/tck/old-tck/run/pom.xml @@ -0,0 +1,339 @@ + + + + + 4.0.0 + + + org.eclipse.ee4j.authentication.tck + old-authentication-tck-parent + 3.0.1-SNAPSHOT + + + glassfish-external-tck-authentication + pom + + Old Jakarta Authentication TCK - run + + + 1.10.2 + ${project.build.directory}/apache-ant-${ant.version} + https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip + + ${project.build.directory}/faces-tck + ${tck.home}/src/com/sun/ts/tests + standalone + + ${project.build.directory}/glassfish7 + ${glassfish.home}/glassfish/bin/asadmin + + org/glassfish/**\:com/sun/enterprise/** + + 14848 + 11527 + 18080 + 18181 + 17676 + 18686 + 13700 + 13920 + 13820 + 12000 + + + + + org.glassfish.main.distributions + glassfish + ${glassfish.version} + zip + test + + + org.eclipse.ee4j.faces.tck + old-faces-tck + ${project.version} + zip + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.6.7 + + + download-ant + generate-resources + + wget + + + + + ${skipITs} + ${ant.zip.url} + true + ${project.build.directory} + + + + + maven-dependency-plugin + 3.3.0 + + ${skipITs} + + + + unpack-glassfish + pre-integration-test + + unpack-dependencies + + + glassfish + ${project.build.directory} + + + + unpack-tck + pre-integration-test + + unpack-dependencies + + + old-faces-tck + ${project.build.directory} + + + + + + + maven-antrun-plugin + 3.1.0 + + + org.apache.ant + ant + ${ant.version} + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + + + ${skipITs} + + + + prepare-tck-and-glassfish + pre-integration-test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + ]]> + + + + + run + + + + + configure-tck-tests + pre-integration-test + + run + + + + + + + + + + + + + + + + + Deploying from ${test.dir} + + + + + + + + + Deploying all archives + + + + + + + + + + + run-tck-tests + integration-test + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/.gitignore b/tck/old-tck/source/.gitignore new file mode 100644 index 0000000..8a37fde --- /dev/null +++ b/tck/old-tck/source/.gitignore @@ -0,0 +1,2 @@ +/dist/ +/classes/ diff --git a/tck/old-tck/source/bin/coverage-build.xml b/tck/old-tck/source/bin/coverage-build.xml new file mode 100644 index 0000000..889974f --- /dev/null +++ b/tck/old-tck/source/bin/coverage-build.xml @@ -0,0 +1,664 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/common.xml b/tck/old-tck/source/bin/xml/impl/glassfish/common.xml new file mode 100644 index 0000000..ac2d860 --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/common.xml @@ -0,0 +1,1638 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + values user; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ******* BEGIN. CHANGE ADMIN PASSWORD ******** + + + AS_ADMIN_PASSWORD=${current.admin.password} +AS_ADMIN_NEWPASSWORD=${admin.password} + + + + + + + + + + Contents of ${temp.pass.file}: + ${password.contents} + + ******* DONE. CHANGE ADMIN PASSWORD ******** + + + + + + ******* BEGIN. ENABLE SECURE ADMIN ******** + + + + + + + + + ******* DONE. ENABLE SECURE ADMIN ******** + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/config.vi.xml b/tck/old-tck/source/bin/xml/impl/glassfish/config.vi.xml new file mode 100755 index 0000000..06b208c --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/config.vi.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/connector.xml b/tck/old-tck/source/bin/xml/impl/glassfish/connector.xml new file mode 100755 index 0000000..5c5983c --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/connector.xml @@ -0,0 +1,573 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cts-connector-pool-whitebox-permissiondd connection pool is not created for web profile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cts-connector-pool-whitebox-permissiondd delete is not called for web-profile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + create cts-connector-pool-whitebox-permissiondd is not called for web-profile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete jndiName with value whitebox-permissiondd is not called for web-profile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jndiName = ${jndiName} + jndiName.minus.prefix = ${jndiName.minus.prefix} + + + + + + + + + + + + + + + + + + + + jndiName = ${jndiName} + jndiName.minus.prefix = ${jndiName.minus.prefix} + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/deploy.xml b/tck/old-tck/source/bin/xml/impl/glassfish/deploy.xml new file mode 100755 index 0000000..e5eadaf --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/deploy.xml @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/install_sjsas.xml b/tck/old-tck/source/bin/xml/impl/glassfish/install_sjsas.xml new file mode 100644 index 0000000..600fa27 --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/install_sjsas.xml @@ -0,0 +1,1076 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error, users must define the unzip.path property on Windows + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ERROR, Neither Windows nor Unix + + + + + + + + + + + + + + + + + + + + + + + + *** Installing GF Version 3.1/3.2 setting v3.install.path to glassfish3 *** + + + *** Installing GF V3.0.X setting v3.install.path to glassfishv3 *** + + + + + + + + + + + + + + + + + + ERROR + ${line.separator} + ***************************************************************** + Error, the target being run does not match the v3.install.dir. + Please verify the javaee.home.ri setting in your ts.jte and make + sure you are running the appropriate install target. + v3.install.dir -> ${v3.install.dir} + running a v3.1 (or 3.2) install target is -> @{is.v31} + + * If you know what you are doing and want to skip this check, + pass -Dexpert.mode=true to the install target. + ***************************************************************** + ${line.separator} + + + + + + *** Running in EXPERT MODE, checks disabled, strange errors could occur. *** + + + + + + + + + + + Found existing V3 install. Stopping domain and removing: + ${v3.install.dir.norm}/${v3.install.path} + ** PATH passed to exec is "${java.home}/bin:${env.PATH}" ** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Port ${port.to.find} not found, so admin port not reset in domain.xml. + + + Port ${port.to.find} found, reset to ${port.to.use}. + Backing up ${domain.file}. + + + ${domain.file} written to disk. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ERROR, Neither Windows nor Unix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Found existing V4 install. Stopping domain and removing: + ${v4.install.dir.norm}/${v4.install.path} + ** PATH passed to exec is "${java.home}/bin:${env.PATH}" ** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Port ${port.to.find} not found, so admin port not reset in domain.xml. + + + Port ${port.to.find} found, reset to ${port.to.use}. + Backing up ${domain.file}. + + + ${domain.file} written to disk. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This job does nothing. Used as a kludge for skipping the V3 install. + This is just easier than changing the Hudson build job sequence. + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/jersey.xml b/tck/old-tck/source/bin/xml/impl/glassfish/jersey.xml new file mode 100644 index 0000000..64d064c --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/jersey.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + servlet_adaptor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/s1as.xml b/tck/old-tck/source/bin/xml/impl/glassfish/s1as.xml new file mode 100644 index 0000000..9f3a442 --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/s1as.xml @@ -0,0 +1,1419 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ****************************************** + WEB PROFILE in use, JMS Users NOT Created. + ****************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ****************************************** + WEB PROFILE in use, JMS Users NOT Deleted. + ****************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ********************************************** + WEB PROFILE in use, JMS Resources NOT Created. + ********************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ********************************************** + WEB PROFILE in use, JMS Resources NOT Deleted. + ********************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/templates/password.template b/tck/old-tck/source/bin/xml/impl/glassfish/templates/password.template new file mode 100644 index 0000000..dcec702 --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/templates/password.template @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# +AS_ADMIN_MASTERPASSWORD=@sjsas.master.password@ +AS_ADMIN_PASSWORD=@sjsas.admin.password@ +AS_ADMIN_USERPASSWORD=@user.password@ diff --git a/tck/old-tck/source/bin/xml/impl/glassfish/templates/statefile.template.ee b/tck/old-tck/source/bin/xml/impl/glassfish/templates/statefile.template.ee new file mode 100644 index 0000000..a20ac8c --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/glassfish/templates/statefile.template.ee @@ -0,0 +1,39 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# +# Wizard Statefile created: Tue Apr 29 22:32:24 PDT 2003 +# Wizard path: /home/qouyang/ws/test_checkin/publish/Linux2.4_DBG.OBJ/package/sun-appserver8-eval/j2ee_sdk_lin//home/qouyang/ws/test_checkin/publish/Linux2.4_DBG.OBJ/package/sun-appserver8-eval/j2ee_sdk_lin/appserv.class +# + +# +# Wizard Statefile section for J2EE 1.4 SDK +# +[STATE_BEGIN @begin.done.tag@ @class.id@] +defaultInstallDirectory = /sun/appserver8 +currentInstallDirectory = @s1as.home@ +INST_ASADMIN_USERNAME = @s1as.admin.user@ +ADMIN_PASSWORD_ENCRYPTED = FALSE +INST_ASADMIN_PASSWORD = @s1as.admin.passwd@ +INST_ASADMIN_PORT = @s1as.admin.port@ +INST_ASWEB_PORT = @sjsas.das.webServerPort@ +CREATE_SAMPLES_DOMAIN = FALSE +STORE_ADMIN_AUTH = FALSE +INST_HTTPS_PORT = @sjsas.das.securedWebServicePort@ +CREATE_DESKTOP_SHORTCUT = FALSE +USE_BUNDLED_JDK= FALSE +JDK_LOCATION = @java.home@ +[STATE_DONE @begin.done.tag@ @class.id@] diff --git a/tck/old-tck/source/bin/xml/impl/none/deploy.xml b/tck/old-tck/source/bin/xml/impl/none/deploy.xml new file mode 100644 index 0000000..94979ff --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/none/deploy.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/impl/tomcat/deploy.xml b/tck/old-tck/source/bin/xml/impl/tomcat/deploy.xml new file mode 100644 index 0000000..9bc30df --- /dev/null +++ b/tck/old-tck/source/bin/xml/impl/tomcat/deploy.xml @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/other/unix.sh b/tck/old-tck/source/bin/xml/other/unix.sh new file mode 100755 index 0000000..c4cc687 --- /dev/null +++ b/tck/old-tck/source/bin/xml/other/unix.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +for arg in "$@" ; do + case $arg in + startxterm) + newdir="$2" + if [ ! -d $newdir ] + then + exit -1 + fi + cd $2 + if [ $? -ne 0 ] + then + exit -1 + fi + if [ "$TERM" = "" ] + then + TERM=xterm + fi + echo $newdir + $TERM & + exit 0 + break + ;; + esac +done +exit 0 diff --git a/tck/old-tck/source/bin/xml/other/windows.bat b/tck/old-tck/source/bin/xml/other/windows.bat new file mode 100755 index 0000000..966fe01 --- /dev/null +++ b/tck/old-tck/source/bin/xml/other/windows.bat @@ -0,0 +1,31 @@ +@echo off +REM +REM Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. +REM +REM This program and the accompanying materials are made available under the +REM terms of the Eclipse Public License v. 2.0, which is available at +REM http://www.eclipse.org/legal/epl-2.0. +REM +REM This Source Code may also be made available under the following Secondary +REM Licenses when the conditions for such availability set forth in the +REM Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +REM version 2 with the GNU Classpath Exception, which is available at +REM https://www.gnu.org/software/classpath/license.html. +REM +REM SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +REM + +@setlocal + +if ""%1""=="""" goto end +if ""%1""==""startcmd"" goto startcmd + +goto end + +:startcmd +set newdir="%2" +start /d%newdir% +goto end + +:end +@endlocal diff --git a/tck/old-tck/source/bin/xml/ts.clientjar.xml b/tck/old-tck/source/bin/xml/ts.clientjar.xml new file mode 100644 index 0000000..3b317cc --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.clientjar.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="@{descriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix="_client.jar" + descriptordir="@{descriptordir}" + mainclass="@{mainclass}" + internaldescriptorname="META-INF/application-client.xml"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.common.props.xml b/tck/old-tck/source/bin/xml/ts.common.props.xml new file mode 100644 index 0000000..8f07bb2 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.common.props.xml @@ -0,0 +1,488 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.common.xml b/tck/old-tck/source/bin/xml/ts.common.xml new file mode 100644 index 0000000..42d9a32 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.common.xml @@ -0,0 +1,1293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{archivedir} + + +
+ + Verifier Results for @{archivedir} + +
+
+
+ ]]> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Errors ]]> + + + + + + (${relative.archive.name}) - Detailed Results: + html ]]> + xml ]]> + text +
]]> +
+ + + This file was generated on ${last.updated}. + ]]> + + +
+
+
+ + + + + + + + Failures ]]> + + + + + + (${relative.archive.name}) - Detailed Results: + html ]]> + xml ]]> + text +
]]> +
+ + + This file was generated on ${last.updated}. + ]]> + + +
+
+
+
+ + + + + + + + Warnings ]]> + + + + + + + Passed ]]> + + +
+ + + + (${relative.archive.name}) - Detailed Results: + html ]]> + xml ]]> + text +
]]> +
+ + + + + + +
+
+ + + + + This file was generated on ${last.updated}. +]]> + + + + + + + + + + + + + + + + + + +
+
+ +
diff --git a/tck/old-tck/source/bin/xml/ts.ear.xml b/tck/old-tck/source/bin/xml/ts.ear.xml new file mode 100644 index 0000000..9c1ce02 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.ear.xml @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="@{descriptor}" + permissionsdescriptor="@{permissionsdescriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix=".ear" + descriptordir="@{descriptordir}" + permissionsdescriptordir="@{permissionsdescriptordir}" + internaldescriptorname="META-INF/application.xml" + update="@{update}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.ejbjar.xml b/tck/old-tck/source/bin/xml/ts.ejbjar.xml new file mode 100644 index 0000000..eb9be92 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.ejbjar.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="@{descriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix="_ejb.jar" + descriptordir="@{descriptordir}" + internaldescriptorname="META-INF/ejb-jar.xml"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.import.xml b/tck/old-tck/source/bin/xml/ts.import.xml new file mode 100644 index 0000000..7e70a14 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.import.xml @@ -0,0 +1,792 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Since ${deliverable.dir}.test.dirs is defined, + the following subset of tests under this directory will be used: + ${tests.string} + + + + + + + + + + + + + + + + tests.file set: ${tests.file}, + The following subset of tests as listed in the file will be run: + ${tests.from.file} + + + + + + + + + + + + + + + + + + + + + + + + + **** Using XML catalog '${ts.home}/lib/catalog' to locate schemas. + **** To use the schema URLs declared within the XML instances, specify "-Duse.xml.catalog=false" when invoking validate + + + + Filtered ${ts.home}/lib/catalog + + + + + + + + + + + + **** Using schema URLs defined within XML instances. + + + + + + + + + + @{dir} +--------------------------------------------------------------- + + + + + + dir /P /O-D + + + + + + + + + + Error, OS Family not recognized. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{extra} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{missing} + + + + + + + + + + + + + + + + + + + + + + ${line.separator}Pretty printing: ${old.file} + + + + + ${line.separator}Pretty printing: @{newfile2} + + + + + + + ${line.separator}DIFFING: + @{newfile2} + ${old.file} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.nonleafimport.xml b/tck/old-tck/source/bin/xml/ts.nonleafimport.xml new file mode 100644 index 0000000..81d4706 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.nonleafimport.xml @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.par.xml b/tck/old-tck/source/bin/xml/ts.par.xml new file mode 100644 index 0000000..155f7ee --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.par.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="${effective.descriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix=".jar" + descriptordir="${effective.descriptordir}" + internaldescriptorname="META-INF/persistence.xml"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.rar.xml b/tck/old-tck/source/bin/xml/ts.rar.xml new file mode 100644 index 0000000..dadb0f1 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.rar.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="@{descriptor}" + permissionsdescriptor="@{permissionsdescriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix=".rar" + descriptordir="@{descriptordir}" + permissionsdescriptordir="@{permissionsdescriptordir}" + internaldescriptorname="META-INF/ra.xml"> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.top.import.xml b/tck/old-tck/source/bin/xml/ts.top.import.xml new file mode 100644 index 0000000..c355030 --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.top.import.xml @@ -0,0 +1,1081 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.vehicles.xml b/tck/old-tck/source/bin/xml/ts.vehicles.xml new file mode 100644 index 0000000..c2fa51d --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.vehicles.xml @@ -0,0 +1,1473 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_filter.default.vehicle.descriptors + vehicle="@{vehicle}" + testname="@{name}"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_copy.vehicle.runtime.files singleear="@{singleear}" + vehicle="@{vehicle}" + vehiclename="${vehicle.name}" + testname="@{name}"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{vehicle}]]> + @{testname}_@{vehicle}]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com_sun_ts_tests_common_vehicle]]> + @{testname}_@{vehiclename}]]> + + + + @{vehiclename}]]> + @{testname}_@{vehiclename}]]> + + + + @{vehiclename}]]> + @{testname}_@{vehiclename}]]> + + + + @{vehiclename}]]> + vi_built_@{testname}_@{vehiclename}]]> + + + + @{vehiclename}]]> + @{testname}_@{vehiclename}]]> + + + + + + + + diff --git a/tck/old-tck/source/bin/xml/ts.war.xml b/tck/old-tck/source/bin/xml/ts.war.xml new file mode 100644 index 0000000..d116aab --- /dev/null +++ b/tck/old-tck/source/bin/xml/ts.war.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_component descriptor="@{descriptor}" + manifest="@{manifest}" + archivename="@{archivename}" + archivesuffix="_web.war" + descriptordir="@{descriptordir}" + internaldescriptorname="WEB-INF/web.xml" + > + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/docker/build_oldtck.sh b/tck/old-tck/source/docker/build_oldtck.sh new file mode 100755 index 0000000..2885d35 --- /dev/null +++ b/tck/old-tck/source/docker/build_oldtck.sh @@ -0,0 +1,85 @@ +#!/bin/bash -xe +# +# Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + +export BASEDIR="$1" +export ANT_HOME="$2" + +if [ -z "$BASEDIR" ]; then + export BASEDIR=`pwd` +fi + +if [ -z "$ANT_HOME" ]; then + export ANT_HOME=`pwd` +fi + + +if [ -z "$JAKARTA_JARS" ]; then + export JAKARTA_JARS=$BASEDIR/lib +fi + +export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH + +which ant +ant -version + +which java +java -version + +export ANT_OPTS="-Xmx2G -Djavax.xml.accessExternalStylesheet=all \ +-Djavax.xml.accessExternalSchema=all \ +-DenableExternalEntityProcessing=true \ +-Djavax.xml.accessExternalDTD=file,http,https" + +export TCK_NAME="jaspic" + +cd $BASEDIR + +mkdir -p $JAKARTA_JARS +mvn -f $BASEDIR/docker/pom.getmodules.xml clean -Pstaging dependency:copy-dependencies -DoutputDirectory="${JAKARTA_JARS}" -Dmdep.stripVersion=true +mvn -f $BASEDIR/docker/pom.getlibs.xml clean -Pstaging dependency:copy-dependencies -DoutputDirectory="${JAKARTA_JARS}" #-Dmdep.stripVersion=true + + +RMI_CLASSES="-Drmi.classes=$JAKARTA_JARS/glassfish-corba-omgapi.jar" + +TCK_SPECIFIC_PROPS="-Djaspic.classes=$JAKARTA_JARS/" + +echo "########## $TCK_NAME BUILD Started##########" +ant -f $BASEDIR/install/$TCK_NAME/bin/build.xml -Ddeliverabledir=$TCK_NAME -Dbasedir=$BASEDIR/install/$TCK_NAME/bin $RMI_CLASSES $TCK_SPECIFIC_PROPS clean.all build.all.jars + +ant -f $BASEDIR/install/$TCK_NAME/bin/build.xml -Ddeliverabledir=$TCK_NAME -Dbasedir=$BASEDIR/install/$TCK_NAME/bin $RMI_CLASSES $TCK_SPECIFIC_PROPS build.all + +mkdir -p $BASEDIR/internal/docs/$TCK_NAME +cp $BASEDIR/internal/docs/dtd/*.dtd $BASEDIR/internal/docs/$TCK_NAME/ +ant -f $BASEDIR/release/tools/build.xml -Ddeliverabledir=$TCK_NAME -Dbasedir=$BASEDIR/release/tools -Dskip.createbom="true" -Dskip.build="true" $TCK_SPECIFIC_PROPS $TCK_NAME +echo "########## $TCK_NAME BUILD Completed ##########" + +# Copy build to archive path +# mkdir -p ${BASEDIR}/standalone-bundles/ +# UPPER_TCK=`echo "${TCK_NAME}" | tr '[:lower:]' '[:upper:]'` +# cd ${BASEDIR}/release/${UPPER_TCK}_BUILD/latest/ +# for entry in `ls *.zip`; do +# date=`echo "$entry" | cut -d_ -f2` +# strippedEntry=`echo "$entry" | cut -d_ -f1` +# if [ "$strippedEntry" == "excludelist" ]; then +# strippedEntry=${strippedEntry}_`echo "$entry" | cut -d_ -f2` +# fi +# echo "copying ${BASEDIR}/release/${UPPER_TCK}_BUILD/latest/$entry to ${BASEDIR}/standalone-bundles/${strippedEntry}_latest.zip" +# echo "copying ${BASEDIR}/release/${UPPER_TCK}_BUILD/latest/$entry to ${BASEDIR}/standalone-bundles/${strippedEntry}.zip" +# cp ${BASEDIR}/release/${UPPER_TCK}_BUILD/latest/$entry ${BASEDIR}/standalone-bundles/${strippedEntry}.zip +# done + + + diff --git a/tck/old-tck/source/docker/pom.getlibs.xml b/tck/old-tck/source/docker/pom.getlibs.xml new file mode 100644 index 0000000..d5e7796 --- /dev/null +++ b/tck/old-tck/source/docker/pom.getlibs.xml @@ -0,0 +1,186 @@ + + + + + org.eclipse.ee4j + project + 1.0.7 + + 4.0.0 + jakarta + 1 + dependency_copy + + + + + + + jakarta-snapshots + https://jakarta.oss.sonatype.org/content/repositories/staging/ + + + + + + + + + commons-codec + commons-codec + 1.9 + + + commons-collections + commons-collections + 3.2.1 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-lang3 + 3.3.2 + + + commons-logging + commons-logging + 1.1.3 + + + net.sourceforge.cssparser + cssparser + 0.9.25 + + + net.sourceforge.htmlunit + htmlunit + 2.15 + + + net.sourceforge.htmlunit + htmlunit-core-js + 2.15 + + + + org.apache.httpcomponents + httpcore + 4.4.9 + + + org.apache.httpcomponents + httpmime + 4.5.5 + + + jaxen + jaxen + 1.1.6 + + + + org.jdom + jdom + 1.1.3 + + + net.sourceforge.nekohtml + nekohtml + 1.9.21 + + + org.w3c.css + sac + 1.3 + + + + xalan + serializer + 2.7.2 + + + xalan + xalan + 2.7.2 + + + xerces + xercesImpl + 2.11.0 + + + xml-apis + xml-apis + 1.4.01 + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + 1.8 + 1.8 + + + + copy-dependencies + process-resources + + copy-dependencies + + + + + + + diff --git a/tck/old-tck/source/docker/pom.getmodules.xml b/tck/old-tck/source/docker/pom.getmodules.xml new file mode 100644 index 0000000..c768b0d --- /dev/null +++ b/tck/old-tck/source/docker/pom.getmodules.xml @@ -0,0 +1,110 @@ + + + + + org.eclipse.ee4j + project + 1.0.7 + + 4.0.0 + jakarta + 1 + dependency_copy + + + + 3.0.0 + 2.1.0 + 3.1.0 + 6.0.0 + 4.2.4 + + + + + + + + + jakarta-snapshots + https://jakarta.oss.sonatype.org/content/repositories/staging/ + + + + + + + jakarta.authentication + jakarta.authentication-api + ${jakarta.authentication-api.version} + provided + + + jakarta.jms + jakarta.jms-api + ${jakarta.jms-api.version} + + + jakarta.servlet + jakarta.servlet-api + ${jakarta.servlet-api.version} + provided + + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation-api.version} + + + org.glassfish.corba + glassfish-corba-orb + ${glassfish-corba-orb.version} + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + 11 + 11 + + + + copy-dependencies + process-resources + + copy-dependencies + + + true + + + + + + + diff --git a/tck/old-tck/source/install/common/build.xml b/tck/old-tck/source/install/common/build.xml new file mode 100644 index 0000000..f89f8b4 --- /dev/null +++ b/tck/old-tck/source/install/common/build.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/install/jaspic/LICENSE.md b/tck/old-tck/source/install/jaspic/LICENSE.md new file mode 100644 index 0000000..5de3d1b --- /dev/null +++ b/tck/old-tck/source/install/jaspic/LICENSE.md @@ -0,0 +1,637 @@ +# Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + + "Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + + "Contributor" means any person or entity that Distributes the Program. + + "Licensed Patents" mean patent claims licensable by a Contributor which + are necessarily infringed by the use or sale of its Contribution alone + or when combined with the Program. + + "Program" means the Contributions Distributed in accordance with this + Agreement. + + "Recipient" means anyone who receives the Program under this Agreement + or any Secondary License (as applicable), including Contributors. + + "Derivative Works" shall mean any work, whether in Source Code or other + form, that is based on (or derived from) the Program and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. + + "Modified Works" shall mean any work in Source Code or other form that + results from an addition to, deletion from, or modification of the + contents of the Program, including, for purposes of clarity any new file + in Source Code form that contains any contents of the Program. Modified + Works shall not include works that contain only declarations, + interfaces, types, classes, structures, or files of the Program solely + in each case in order to link to, bind by name, or subclass the Program + or Modified Works thereof. + + "Distribute" means the acts of a) distributing or b) making available + in any manner that enables the transfer of a copy. + + "Source Code" means the form of a Program preferred for making + modifications, including but not limited to software source code, + documentation source, and configuration files. + + "Secondary License" means either the GNU General Public License, + Version 2.0, or any later versions of that license, including any + exceptions or additional permissions as identified by the initial + Contributor. + + 2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + + 3. REQUIREMENTS + + 3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + + 3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + + 3.3 Contributors may not remove or alter any copyright, patent, + trademark, attribution notices, disclaimers of warranty, or limitations + of liability ("notices") contained within the Program from any copy of + the Program which they Distribute, provided that Contributors may add + their own appropriate notices. + + 4. COMMERCIAL DISTRIBUTION + + Commercial distributors of software may accept certain responsibilities + with respect to end users, business partners and the like. While this + license is intended to facilitate the commercial use of the Program, + the Contributor who includes the Program in a commercial product + offering should do so in a manner which does not create potential + liability for other Contributors. Therefore, if a Contributor includes + the Program in a commercial product offering, such Contributor + ("Commercial Contributor") hereby agrees to defend and indemnify every + other Contributor ("Indemnified Contributor") against any losses, + damages and costs (collectively "Losses") arising from claims, lawsuits + and other legal actions brought by a third party against the Indemnified + Contributor to the extent caused by the acts or omissions of such + Commercial Contributor in connection with its distribution of the Program + in a commercial product offering. The obligations in this section do not + apply to any claims or Losses relating to any actual or alleged + intellectual property infringement. In order to qualify, an Indemnified + Contributor must: a) promptly notify the Commercial Contributor in + writing of such claim, and b) allow the Commercial Contributor to control, + and cooperate with the Commercial Contributor in, the defense and any + related settlement negotiations. The Indemnified Contributor may + participate in any such claim at its own expense. + + For example, a Contributor might include the Program in a commercial + product offering, Product X. That Contributor is then a Commercial + Contributor. If that Commercial Contributor then makes performance + claims, or offers warranties related to Product X, those performance + claims and warranties are such Commercial Contributor's responsibility + alone. Under this section, the Commercial Contributor would have to + defend claims against the other Contributors related to those performance + claims and warranties, and if a court requires any other Contributor to + pay any damages as a result, the Commercial Contributor must pay + those damages. + + 5. NO WARRANTY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR + IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF + TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR + PURPOSE. Each Recipient is solely responsible for determining the + appropriateness of using and distributing the Program and assumes all + risks associated with its exercise of rights under this Agreement, + including but not limited to the risks and costs of program errors, + compliance with applicable laws, damage to or loss of data, programs + or equipment, and unavailability or interruption of operations. + + 6. DISCLAIMER OF LIABILITY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS + SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST + PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE + EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + + 7. GENERAL + + If any provision of this Agreement is invalid or unenforceable under + applicable law, it shall not affect the validity or enforceability of + the remainder of the terms of this Agreement, and without further + action by the parties hereto, such provision shall be reformed to the + minimum extent necessary to make such provision valid and enforceable. + + If Recipient institutes patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that the + Program itself (excluding combinations of the Program with other software + or hardware) infringes such Recipient's patent(s), then such Recipient's + rights granted under Section 2(b) shall terminate as of the date such + litigation is filed. + + All Recipient's rights under this Agreement shall terminate if it + fails to comply with any of the material terms or conditions of this + Agreement and does not cure such failure in a reasonable period of + time after becoming aware of such noncompliance. If all Recipient's + rights under this Agreement terminate, Recipient agrees to cease use + and distribution of the Program as soon as reasonably practicable. + However, Recipient's obligations under this Agreement and any licenses + granted by Recipient relating to the Program shall continue and survive. + + Everyone is permitted to copy and distribute copies of this Agreement, + but in order to avoid inconsistency the Agreement is copyrighted and + may only be modified in the following manner. The Agreement Steward + reserves the right to publish new versions (including revisions) of + this Agreement from time to time. No one other than the Agreement + Steward has the right to modify this Agreement. The Eclipse Foundation + is the initial Agreement Steward. The Eclipse Foundation may assign the + responsibility to serve as the Agreement Steward to a suitable separate + entity. Each new version of the Agreement will be given a distinguishing + version number. The Program (including Contributions) may always be + Distributed subject to the version of the Agreement under which it was + received. In addition, after a new version of the Agreement is published, + Contributor may elect to Distribute the Program (including its + Contributions) under the new version. + + Except as expressly stated in Sections 2(a) and 2(b) above, Recipient + receives no rights or licenses to the intellectual property of any + Contributor under this Agreement, whether expressly, by implication, + estoppel or otherwise. All rights in the Program not expressly granted + under this Agreement are reserved. Nothing in this Agreement is intended + to be enforceable by any entity that is not a Contributor or Recipient. + No third-party beneficiary rights are created under this Agreement. + + Exhibit A - Form of Secondary Licenses Notice + + "This Source Code may also be made available under the following + Secondary Licenses when the conditions for such availability set forth + in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), + version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. + +--- + +## The GNU General Public License (GPL) Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1335 + USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. This General Public + License applies to most of the Free Software Foundation's software and + to any other program whose authors commit to using it. (Some other Free + Software Foundation software is covered by the GNU Library General + Public License instead.) You can apply it to your programs, too. + + When we speak of free software, we are referring to freedom, not price. + Our General Public Licenses are designed to make sure that you have the + freedom to distribute copies of free software (and charge for this + service if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone + to deny you these rights or to ask you to surrender the rights. These + restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether gratis + or for a fee, you must give the recipients all the rights that you have. + You must make sure that they, too, receive or can get the source code. + And you must show them these terms so they know their rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software patents. + We wish to avoid the danger that redistributors of a free program will + individually obtain patent licenses, in effect making the program + proprietary. To prevent this, we have made it clear that any patent must + be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed under + the terms of this General Public License. The "Program", below, refers + to any such program or work, and a "work based on the Program" means + either the Program or any derivative work under copyright law: that is + to say, a work containing the Program or a portion of it, either + verbatim or with modifications and/or translated into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running + the Program is not restricted, and the output from the Program is + covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, provided + that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Program, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to control + compilation and installation of the executable. However, as a special + exception, the source code distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies the + executable. + + If distribution of executable or object code is made by offering access + to copy from a designated place, then offering equivalent access to copy + the source code from the same place counts as distribution of the source + code, even though third parties are not compelled to copy the source + along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and will + automatically terminate your rights under this License. However, parties + who have received copies, or rights, from you under this License will + not have their licenses terminated so long as such parties remain in + full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and all + its terms and conditions for copying, distributing or modifying the + Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further restrictions + on the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties to this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Program at all. For example, if a patent license would + not permit royalty-free redistribution of the Program by all those who + receive copies directly or indirectly through you, then the only way you + could satisfy both it and this License would be to refrain entirely from + distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is implemented + by public license practices. Many people have made generous + contributions to the wide range of software distributed through that + system in reliance on consistent application of that system; it is up to + the author/donor to decide if he or she is willing to distribute + software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be + a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License may + add an explicit geographical distribution limitation excluding those + countries, so that distribution is permitted only in or among countries + not thus excluded. In such case, this License incorporates the + limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a version + number of this License, you may choose any version ever published by the + Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL + DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED + INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF + THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR + OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively convey + the exclusion of warranty; and each file should have at least the + "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + + Also add information on how to contact you by electronic and paper mail. + + If the program is interactive, make it output a short notice like this + when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the + appropriate parts of the General Public License. Of course, the commands + you use may be called something other than `show w' and `show c'; they + could even be mouse-clicks or menu items--whatever suits your program. + + You should also get your employer (if you work as a programmer) or your + school, if any, to sign a "copyright disclaimer" for the program, if + necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + + This General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications + with the library. If this is what you want to do, use the GNU Library + General Public License instead of this License. + +--- + +## CLASSPATH EXCEPTION + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License version 2 cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obligated to + do so. If you do not wish to do so, delete this exception statement + from your version. diff --git a/tck/old-tck/source/install/jaspic/bin/build.xml b/tck/old-tck/source/install/jaspic/bin/build.xml new file mode 100755 index 0000000..630043a --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/build.xml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/install/jaspic/bin/certificates/README b/tck/old-tck/source/install/jaspic/bin/certificates/README new file mode 100644 index 0000000..47bc5fd --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/certificates/README @@ -0,0 +1,14 @@ +CTS Client certificate +---------------------- +This directory contains CTS client certificate stored in different file formats. + +1) cts_cert - This file is used for importing cts client cert + into a truststore . + +2) clientcert.jks - This file is used by the JSSE runtime + to identify CTS client's identity + +3) clientcert.p12 - This file contains cts client cert in pkcs12 format. + + +Note: All 3 files in this directory contains the same certificate named "cts" diff --git a/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.jks b/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.jks new file mode 100644 index 0000000..4e88ce7 Binary files /dev/null and b/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.jks differ diff --git a/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.p12 b/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.p12 new file mode 100644 index 0000000..409e41e Binary files /dev/null and b/tck/old-tck/source/install/jaspic/bin/certificates/clientcert.p12 differ diff --git a/tck/old-tck/source/install/jaspic/bin/certificates/cts_cert b/tck/old-tck/source/install/jaspic/bin/certificates/cts_cert new file mode 100644 index 0000000..0c3863c Binary files /dev/null and b/tck/old-tck/source/install/jaspic/bin/certificates/cts_cert differ diff --git a/tck/old-tck/source/install/jaspic/bin/client_policy.append b/tck/old-tck/source/install/jaspic/bin/client_policy.append new file mode 100755 index 0000000..6b52176 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/client_policy.append @@ -0,0 +1,33 @@ +/* CTS requirement */ +grant { +/* Required by CTS tests to read, write and delete files */ +/* File io permissions should only exist for appclient and web containers. */ +/* For signature tests, read permission is also required for EJB container. */ + permission java.io.FilePermission "<>", "read,write,delete"; + +/* CTS harness requirement */ + permission java.lang.RuntimePermission "setFactory"; + + +/* Required by JAXP tests */ +/* jaxp/extension/com/saxhelpers/ParserFactoryTest.java#negative* */ + permission java.util.PropertyPermission "*", "read,write"; + +/* Required by RMI & CTS Signature Tests */ + permission java.lang.RuntimePermission "modifyThreadGroup"; + permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "createClassLoader"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + +/* Addition securities for the appclient container */ + permission java.lang.RuntimePermission "shutdownHooks"; + permission java.lang.RuntimePermission "createClassLoader"; + permission java.lang.RuntimePermission "setContextClassLoader"; + permission java.lang.RuntimePermission "accessClassInPackage.*"; + permission java.net.NetPermission "setDefaultAuthenticator"; + permission java.lang.RuntimePermission "modifyThreadGroup"; + +/* Needed by JAXR */ + permission java.security.SecurityPermission "insertProvider.SUN"; + +}; diff --git a/tck/old-tck/source/install/jaspic/bin/coverage-build.xml b/tck/old-tck/source/install/jaspic/bin/coverage-build.xml new file mode 100755 index 0000000..31e12b9 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/coverage-build.xml @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/install/jaspic/bin/harness.policy b/tck/old-tck/source/install/jaspic/bin/harness.policy new file mode 100755 index 0000000..16a8bfa --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/harness.policy @@ -0,0 +1,4 @@ +grant { + // "standard" properies that can be read by anyone + permission java.security.AllPermission ; +}; diff --git a/tck/old-tck/source/install/jaspic/bin/java.policy b/tck/old-tck/source/install/jaspic/bin/java.policy new file mode 100755 index 0000000..e21814f --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/java.policy @@ -0,0 +1,80 @@ +// Standard extensions get all permissions by default + +grant codeBase "file:${java.home}/lib/ext/-" { + permission java.security.AllPermission; +}; + +grant codeBase "file:${java.home}/../lib/tools.jar" { + permission java.security.AllPermission; +}; + +//Application Client Container requirement by SUN's RI + +grant codeBase "file:${com.sun.enterprise.home}/lib/classes/" { + permission java.security.AllPermission; +}; + +grant codeBase "file:${jms.home}/classes/" { + permission java.security.AllPermission; +}; + +// Drivers and other system classes should be stored in this +// code base. +grant codeBase "file:${com.sun.enterprise.home}/lib/system/-" { + permission java.security.AllPermission; +}; + +grant codeBase "file:${com.sun.enterprise.home}/lib/jakartaee.jar" { + permission java.security.AllPermission; +}; + + +// default permissions granted to all domains + +grant { + // Jakarta EE security permission set from Jakarta EE platform specification Table 6-2 + permission java.lang.RuntimePermission "loadLibrary.*"; + permission java.lang.RuntimePermission "accessClassInPackage.*"; + permission java.lang.RuntimePermission "exitVM"; + permission java.lang.RuntimePermission "queuePrintJob"; + + permission java.awt.AWTPermission "accessClipboard"; + permission java.awt.AWTPermission "accessEventQueue"; + permission java.awt.AWTPermission "showWindowWithoutWarningBanner"; + + permission java.io.FilePermission "<>", "read,write"; + + permission java.net.SocketPermission "*", "connect,accept,resolve"; + permission java.net.SocketPermission "localhost:1024-", "accept,listen"; + + // "standard" properies that can be read by anyone + permission java.util.PropertyPermission "*", "read"; + + //Required by JAXP tests + //jaxp/extension/com/saxhelpers/ParserFactoryTest.java#negative* + permission java.util.PropertyPermission "org.xml.sax.parser", "write"; + + // Required by TS harness and tests to write and delete files + permission java.io.FilePermission "${cts.tmp}${file.separator}-", "delete"; + permission java.io.FilePermission "${user.home}${file.separator}tmp${file.separator}-", "delete"; + + //Required by SUN RI + permission java.lang.RuntimePermission "modifyThreadGroup"; + + // setting the JSSE provider for lazy authentication of app. clients. + // Please do not change it. + permission java.security.SecurityPermission "putProviderProperty.SunJSSE"; + permission java.security.SecurityPermission "insertProvider.SunJSSE"; + +// TS harness requirement + permission java.lang.RuntimePermission "setFactory"; + + // For executing tests in SameJVM mode: + permission java.net.SocketPermission "localhost", "connect, resolve"; + + //Needed by TS Signature tests + permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "createClassLoader"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + +}; diff --git a/tck/old-tck/source/install/jaspic/bin/logging.properties b/tck/old-tck/source/install/jaspic/bin/logging.properties new file mode 100644 index 0000000..ef3baad --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/logging.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +.level=INFO +jsr196.level=INFO diff --git a/tck/old-tck/source/install/jaspic/bin/login.config b/tck/old-tck/source/install/jaspic/bin/login.config new file mode 100755 index 0000000..2e237eb --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/login.config @@ -0,0 +1,10 @@ +/* The login configuration required by RI */ + +default { + com.sun.enterprise.security.auth.login.ClientPasswordLoginModule required debug=false; +}; + +certificate { + com.sun.enterprise.security.auth.login.ClientCertificateLoginModule required debug=false; +}; + diff --git a/tck/old-tck/source/install/jaspic/bin/password.txt b/tck/old-tck/source/install/jaspic/bin/password.txt new file mode 100644 index 0000000..9940e3e --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/password.txt @@ -0,0 +1,3 @@ +AS_ADMIN_MASTERPASSWORD=changeit +AS_ADMIN_PASSWORD= +AS_ADMIN_USERPASSWORD=@user.password@ diff --git a/tck/old-tck/source/install/jaspic/bin/server_policy.append b/tck/old-tck/source/install/jaspic/bin/server_policy.append new file mode 100755 index 0000000..3b19222 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/server_policy.append @@ -0,0 +1,65 @@ +/* TS requirement */ +grant { +/* Required by TS tests to read, write and delete files */ +/* File io permissions should only exist for appclient and web containers. */ +/* For signature tests, read permission is also required for EJB container. */ + permission java.io.FilePermission "<>", "read,write,delete"; + +/* TS harness requirement */ + permission java.lang.RuntimePermission "setFactory"; + + +/* Required by JAXP tests */ +/* jaxp/extension/com/saxhelpers/ParserFactoryTest.java#negative* */ + permission java.util.PropertyPermission "org.xml.sax.parser", "write"; + +/* Required by RMI tests */ + permission java.lang.RuntimePermission "modifyThreadGroup"; + +/* Needed by TS Signature tests */ + permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "createClassLoader"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.util.PropertyPermission "j2eelogin.name", "write"; + permission java.util.PropertyPermission "j2eelogin.password", "write"; +}; + +grant codebase "file:${com.sun.aas.installRoot}/domains/domain1/lib/applibs/whitebox.jar" { + permission java.security.AllPermission; +}; + +grant codebase "file:${com.sun.aas.installRoot}/domains/domain1/autodeploy/whitebox-mdcomplete.rar" { + permission java.security.AllPermission; +}; + +grant codebase "file:${com.sun.aas.installRoot}/domains/domain1/applications/-" { + permission javax.security.auth.AuthPermission "doAsPrivileged"; + permission javax.security.auth.AuthPermission "modifyPrincipals"; + permission javax.security.auth.AuthPermission "modifyPublicCredentials"; + permission javax.security.auth.AuthPermission "modifyPrivateCredentials"; + permission javax.security.auth.AuthPermission "createLoginContext.fileRealm"; + permission javax.security.auth.PrivateCredentialPermission + "com.sun.enterprise.security.auth.login.common.PasswordCredential * \"*\"", "read"; + permission org.osgi.framework.AdminPermission "*", "*"; + permission jakarta.xml.ws.WebServicePermission "publishEndpoint"; + permission java.security.SecurityPermission "getPolicy"; + permission java.security.SecurityPermission "setPolicy"; + permission java.security.SecurityPermission "getProperty.authconfigprovider.factory"; + permission java.security.SecurityPermission "setProperty.authconfigprovider.factory"; + permission java.security.SecurityPermission "setProperty.authconfigfactory.provider"; + permission java.security.SecurityPermission "authconfigprovider.factory"; +}; + +/* needed for j2eetools cts tests */ +grant { + permission java.security.SecurityPermission "getProperty.policy.url.1"; + permission java.security.SecurityPermission "getProperty.policy.url.2"; + permission java.security.SecurityPermission "getProperty.policy.url.3"; + permission java.security.SecurityPermission "setProperty.policy.url.1"; + permission java.security.SecurityPermission "setProperty.policy.url.2"; + permission java.security.SecurityPermission "setProperty.policy.url.3"; + permission javax.management.MBeanServerPermission "createMBeanServer"; + permission javax.management.MBeanPermission "*", "*"; + permission org.osgi.framework.AdminPermission "*", "*"; + permission java.util.logging.LoggingPermission "control"; +}; diff --git a/tck/old-tck/source/install/jaspic/bin/sig-test-pkg-list.txt b/tck/old-tck/source/install/jaspic/bin/sig-test-pkg-list.txt new file mode 100755 index 0000000..ef5a268 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/sig-test-pkg-list.txt @@ -0,0 +1,28 @@ +# +# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +## +# This file contains a list of all the packages +# contained in the signature files for this +# deliverable. This file is used to exclude valid +# sub-packages from being verified when their +# parent package's signature is checked. +## + +jakarta.security.auth.message +jakarta.security.auth.message.callback +jakarta.security.auth.message.config +jakarta.security.auth.message.module diff --git a/tck/old-tck/source/install/jaspic/bin/sig-test.map b/tck/old-tck/source/install/jaspic/bin/sig-test.map new file mode 100755 index 0000000..4852956 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/sig-test.map @@ -0,0 +1,57 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +############################################################### +# The signature test mapping file for the JavaEE TCK. This file +# should be formatted as a standard java properties file. The +# name is the package name and the value is the version of the +# package that should be tested by the signature tests. +# +# For updates to this file when the JavaEE spec gets updated, +# as a good rule of thumb, we pull out any packages that end +# up as being included with the J2SE. So if any of the packages +# listed below ends up being incorporated into J2SE in the future, +# that will be a hint that those packages can likely be removed +# from this sig-test.map file. +# +# Note: Recording the signatures of a package includes all +# child packages. The signature test tool looks for +# the best signature file to use when playing back +# signatures. Meaning if we have a jakarta.servlet +# signature file and a jakarta.servlet.jsp signature file, +# the signature test tool will use the jakarta.servlet.jsp +# signature file to verify the jakarta.servlet.jsp package +# signatures even though the jakarta.servlet signature +# file contains the jakarta.servlet.jsp package signatures. +# The signatures are in both files (since the API Check +# tool records child package signatures and there does +# not seem to be a way to turn this feature off) but the +# jakarta.servlet.jsp signature file can vary independent +# of the jakarta.servlet signature file. +# +# Command used to record the JavaEE signatures in reflective mode +# +# $TS_HOME/bin/ant -f record-build.xml \ +# -Dsig.source=$JAVAEE_HOME/lib/jmac-api.jar:$JAVAEE_HOME/lib/jakartaee.jar:/java/lib/rt.jar \ +# -Dmap.file=/jaspic-tck/bin/sig-test.map \ +# -Drecorder.type=sigtest \ +# record.sig.batch +# +############################################################### + + +# Authentication +jakarta.security.auth.message=3.0 diff --git a/tck/old-tck/source/install/jaspic/bin/ts.java.security b/tck/old-tck/source/install/jaspic/bin/ts.java.security new file mode 100644 index 0000000..863c9c5 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/ts.java.security @@ -0,0 +1,37 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# This file contains properties that will get appended to the JRE's master +# security properties file (ie java.security) which is located within the +# JAVA_HOME/jre/lib/security directory. The use of this file assumes that +# java.security has "security.overridePropertiesFile=true". +# +# The contents of this file will be appended to the system wide security +# properties (ie java.security) by the appserver when we reference this +# file with the following JVM option during appserver startup: +# java -Djava.security.properties=//cts.java.security +# +# The alternative to using this file is to directly put the properties +# from this file directly into JAVA_HOME/jre/lib/security/java.security +# + + +# authconfigprovider.factory: +# This property is used by the JSR-196 (JASPIC) Technology tests, so that +# the JASPIC tests can specify that the appserver use a non-default +# authconfigprovider. +# +authconfigprovider.factory=com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory diff --git a/tck/old-tck/source/install/jaspic/bin/ts.jte b/tck/old-tck/source/install/jaspic/bin/ts.jte new file mode 100755 index 0000000..b7118f1 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/ts.jte @@ -0,0 +1,947 @@ +# +# Copyright (c) 2006, 2022 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +######################################################################### +## +## JavaTest Environment file for Jakarta EE Platform TCK +## +## Environment specific properties in this file will likely +## have to be modified prior to running the Jakarta EE Platform TCK. +## Instructions for modifying these properties are contained in this +## file. +## +## This file is processed by an external tool that helps generate the +## CTS documents. Therefore this file has a standard format that must +## be followed. This file is a standard Java Properties file with +## very specific comment formattting. Users can write property specific +## comments by using the property name and an ampersand (@). As an +## example the following comment applies to the foo.bar property: +## # @foo.bar - This is a comment pertaining to foo.bar +## # that spans multiple lines. +## This comment must be preceeded by a single hash (#) charater and +## the property name must be prepended with an ampersand (@). The +## comment can appear anywhere in the ts.jte file. If users have +## comments that belong in ts.jte but DO NOT pertain to a particular +## property the user must start the comment with at least 2 hash (#) +## characters. The following is a valid non-property comment: +## ## A valid non-property comment +## ## that spans multiple lines. +######################################################################### + +######################################################################## +## Javatest batch mode work directory and report directory, and policy for +## handling existing work and report directories. These properties affects +## runclient and report targets, but not gui target. +## To disable generating test report, unset report.dir, or set it to "none" +## either here or from command line, as in the following command: +## ant runclient -Dreport.dir="none" +## +# @work.dir The directory used to store Javatest test results and test +# information. +# @report.dir The directory used to store Javatest summary reports of +# test results. +# @if.existing.work.report.dirs specifies how existing work.dir and +# report.dir will be handled, and it must be one of the following values: +# overwrite overwrites all content in work.dir and report.dir +# backup moves all content in work.dir and report.dir to +# work.dir_time_day_bak and report.dir_time_day_bak, +# respectively +# append reuses and preserves the existing work.dir and report.dir +# auto lets the build files decide which mode to use +# (overwrite, backup or append). the value is determined +# like this: +# if.existing.work.report.dirs == auto +# if in CTS workspace +# if.existing.work.report.dirs = overwrite +# else we are in a distribution bundle +# if.existing.work.report.dirs = append +# end if +# else +# if.existing.work.report.dirs = value in this file +# end if +######################################################################## +work.dir=/tmp/JTwork +report.dir=/tmp/JTreport + +if.existing.work.report.dirs=auto + +######################################################################## +# @javatest.timeout.factor This property specifies the scale factor used by +# Javatest to adjust the time JavaTest will wait for a given test to +# complete before returning failure. For instance if the default test timeout +# is 5 minutes, this value will be multiplied by 5 minutes to determine +# the total timeout delay. Note: this value only works with Javatest's +# batch mode (runclient). When using the Javatest GUI users must change +# this timeout factor in the GUI. Configure -> Edit Configuration -> View +# -> choose Standard Values -> select tab Execution -> set Time Factor. +######################################################################## +javatest.timeout.factor=1.0 + +######################################################################## +## Settings for Vendor JASPIC Implementation +# @jaspic.home The location of the vendor's Jakarta EE platform +# implementation. +# @orb.host Hostname of the machine running the vendor's +# implementation. +# @orb.port The port number the vendor implementation is listening +# to for service requests. +######################################################################## +jaspic.home=/sun/glassfish4/glassfish +orb.host=localhost +orb.port=3699 + +######################################################################## +## Settings for Eclipse GlassFish Jakarta EE Implementation +# @jaspic.home.ri The location of the RI. +# @orb.host Hostname of the machine running the RI. +# @orb.port The port number the RI is listening to for service +# requests. +######################################################################## +jaspic.home.ri=${jaspic.home} +orb.host.ri=${orb.host} +orb.port.ri=${orb.port} + +################################################################### +################################################################### +################################################################### +## RI SPECIFIC PROPERTIES LIVE BELOW +################################################################### +################################################################### +################################################################### + +################################################################### +## When installing CTS/RI on Windows, users must install CTS and +## the RI on the same drive. Also note that you should never +## specify drive letters in any path defined in this properties +## file. +## +# @pathsep Users must set this property when running on Windows. +# The appropriate value on windows is a semi-colon (;). +# If you are not running on Windows leave this property +# set to its default value of colon (:). +################################################################### +pathsep=: + + +############################################################### +# @ts.display -- location to display CTS output on Unix +############################################################### +ts.display=:0.0 + + +############################################################### +## Config params needed for Sun Java System Application Server +## (SJSAS) asadmin. You must change these values as needed +## only if you are testing against SJSAS app server +## (jaspic.home is pointing to SJSAS). +# +# @s1as.admin.user -- The SJSAS asadmin user id +# @s1as.admin.passwd -- The SJSAS asadmin user password +# @s1as.admin.host -- The SJSAS host +# @s1as.admin.port -- The SJSAS port +# @s1as.admin -- The SJSAS admin command +# @s1as.server -- The SJSAS server instance being used +# @s1as.domain.dir -- Points to where your domains are installed. +# @s1as.domain.name -- The SJSAS domain being used +# @s1as.domain -- The SJSAS domain path being used +# @s1as.asenv.loc -- location of asenv.conf or asenv.bat +# @s1as.imqbin.loc -- location of the IMQ bin directory +# @s1as.lib -- Library directory for other Jakarta EE RI +# jars +# @s1as.imq.share.lib -- Shared library directory for imq +# @s1as.jvm.options -- Java options needed by SJSAS +# @s1as.java.endorsed.dirs -- endorsed directory used by SJSAS +# @s1as.applicationRoot-- Location of application repository +# Only needed when running on windows +############################################################### +s1as.admin.user=admin +s1as.admin.passwd= +s1as.admin.host=${orb.host} +s1as.admin.port=4848 +s1as.admin=${jaspic.home}/bin/asadmin +s1as.server=server +s1as.domain.dir=${jaspic.home}/domains +s1as.domain.name=domain1 +s1as.domain=${s1as.domain.dir}/${s1as.domain.name} +s1as.asenv.loc=${jaspic.home}/config +s1as.imqbin.loc=${jaspic.home}/imq/bin +s1as.lib=${jaspic.home}/lib +s1as.imq.share.lib=${jaspic.home}/imq/lib +s1as.jvm.options=-Dj2eelogin.name=${user}:-Dj2eelogin.password=${password} +s1as.java.endorsed.dirs=${endorsed.dirs} +s1as.applicationRoot=c: + +sjsas.master.password=changeit +sjsas.instance.config.dir=config + + +########################################################################### +# @endorsed.dirs If using JavaSE 6 or above and you provide newer versions +# of technologies than those contained in Java SE 6, verify +# that the property endorsed.dirs is set to the location of +# the VI api jars for those technologies you wish to +# overrride. For example, JavaSE 6 contains an +# implementation of JAXWS 2.0 which will conflict with +# JAXWS 2.1, therefore this property would need to be set +# so that JAXWS 2.1 would be used during the building of +# tests and during test execution. +# +# @endorsed.dirs.ri If using JavaSE 6 or above and you provide newer versions +# of technologies than those contained in Java SE 6, verify +# that the property endorsed.dirs is set to the location of +# the RI api jars for those technologies you wish to +# overrride. For example, JavaSE 6 contains an +# implementation of JAXWS 2.0 which will conflict with +# JAXWS 2.1, therefore this property would need to be set +# so that JAXWS 2.1 would be used during the building of +# tests and during test execution. +########################################################################### +endorsed.dirs=${jaspic.home}/modules/endorsed +endorsed.dirs.ri=${endorsed.dirs} + +s1as.targets=${s1as.server} + + +############################################################### +# @extension.dir - The extension directory for the app +# server under test. This does not apply +# to the RI. +# +# Note: App server vendors will need to set this to their +# app server's extension directory. The CTS config.vi +# target will copy the CTS library jars to this location. +############################################################### +extension.dir=${s1as.domain}/lib + + +############################################################### +# @tz - your local timezone. For valid values, consult your +# Operating System documentation. +############################################################### +tz=US/Eastern + + +############################################################### +# @alt.dtd.dir DTD location for Jakarta EE and RI xml files. Used +# for xml validation when building tests. If +# jaspic.home.ri is set, /lib/dtds +# will be used and alt.dtd.dir is ignored. +# @alt.schema.dir schema location for Jakarta EE and RI xml files. +# Used for xml validation when building tests. +# If jaspic.home.ri is set, +# /lib/schemas will be used and +# alt.schema.dir is ignored. +############################################################### +alt.dtd.dir=${ts.home}/lib/dtds +alt.schema.dir=${ts.home}/lib/schemas + + +############################################################### +## Classpath properties required by CTS: +# @ts.run.classpath -- Classpath required by the vendor +# appclient container. +# @ts.harness.classpath -- Classes required by javatest +# @ts.classpath -- Classes used to build the CTS tests +# @ts.lib.classpath -- Classes used to build jaspic.jar +############################################################### + +jaspic.classes=${jaspic.home}/modules/war-util.jar:\ + ${jaspic.home}/modules/jaspic.provider.framework.jar:\ + ${jaspic.home}/modules/security.jar:\ + ${jaspic.home}/modules/security-ee.jar:\ + ${jaspic.home}/modules/kernel.jar:\ + ${jaspic.home}/modules/admin-cli.jar:\ + ${jaspic.home}/modules/annotation-framework.jar:\ + ${jaspic.home}/modules/common-util.jar:\ + ${jaspic.home}/modules/config-api.jar:\ + ${jaspic.home}/modules/connectors-runtime.jar:\ + ${jaspic.home}/modules/container-common.jar:\ + ${jaspic.home}/modules/dol.jar:\ + ${jaspic.home}/modules/gf-connectors-connector.jar:\ + ${jaspic.home}/modules/glassfish.jar:\ + ${jaspic.home}/modules/glassfish-naming.jar:\ + ${jaspic.home}/modules/internal-api.jar:\ + ${jaspic.home}/modules/security.jar:\ + ${jaspic.home}/modules/jakarta.servlet-api.jar:\ + ${jaspic.home}/modules/war-util.jar:\ + ${jaspic.home}/modules/jakarta.mail.jar:\ + ${jaspic.home}/modules/jakarta.enterprise.deploy-api.jar:\ + ${jaspic.home}/modules/webservices-osgi.jar:\ + ${jaspic.home}/modules/jaxb-osgi.jar:\ + ${jaspic.home}/modules/jakarta.jms-api.jar:\ + ${jaspic.home}/modules/jakarta.annotation-api.jar:\ + ${jaspic.home}/modules/webservices-api-osgi.jar:\ + ${jaspic.home}/modules/deployment-client.jar:\ + ${jaspic.home}/modules/jakarta.authentication-api.jar + +ts.run.classpath=${jaspic.classes}:${ts.home}/lib/tsharness.jar:${ts.home}/lib/jaspic.jar:${ts.home}/lib/tssv.jar + +ts.harness.classpath=${ts.home}/lib/jaxb-api.jar:${ts.home}/lib/jaxb-impl.jar:${ts.home}/lib/jaxb-xjc.jar:${ts.home}/lib/tsharness.jar:${ts.home}/lib/jaspic.jar:${ts.home}/lib/sigtest.jar:${ts.run.classpath}:${ts.home}/lib/javatest.jar:${ts.home}/lib/jdom-1.1.3.jar:${ant.home}/lib/ant.jar + +#classpath used for building CTS tests only (DO NOT MODIFY) +ts.classpath=${ts.home}/classes:${tools.jar}:${ts.home}/lib/tsharness.jar:${ts.home}/lib/jaspic.jar:${ts.home}/lib/sigtest.jar:${ts.run.classpath}:${ts.home}/lib/javatest.jar:${ts.home}/lib/jdom-1.1.3.jar:${ant.home}/lib/ant.jar + +#classpath used for building jaspic.jar (DO NOT MODIFY) +ts.lib.classpath=${tools.jar}:${ts.harness.classpath} + + +############################################################### +# @s1as.classpathsuffix - The classpath suffix of +# the RI when being used as the app server under test. +############################################################### +s1as.classpathsuffix= + +######################################################################## +## Common environment for both ts_unix and ts_win32 +# +# @command.testExecute - This command is used to execute any test +# clients which are not run inside an +# application client container. For example, +# any URL clients or standalone java clients +# would be executed with this command. Some +# test directories which make use of this command +# are servlet and jsp. +######################################################################## +command.testExecute=com.sun.ts.lib.harness.ExecTSTestCmd \ + CLASSPATH=${jaspic.home.ri}/modules/webservices-osgi.jar:\ + ${jaspic.home.ri}/modules/webservices-security.jar:\ + ${jaspic.home.ri}/modules/ha-api.jar:\ + ${ts.home}/classes:${ts.harness.classpath}:\ + ${ts.home}/lib/jaxen-1.1.6.jar:\ + DISPLAY=${ts.display} \ + HOME="${user.home}" \ + windir=${windir} \ + SYSTEMROOT=${SYSTEMROOT} \ + PATH="${jaspic.home}/nativelib" \ + ${JAVA_HOME}/bin/java \ + -Dcts.tmp=$harness.temp.directory \ + -Djava.protocol.handler.pkgs=javax.net.ssl \ + -Djavax.net.ssl.keyStore=${ts.home}/bin/certificates/clientcert.jks \ + -Djavax.net.ssl.keyStorePassword=changeit \ + -Djavax.net.ssl.trustStore=${s1as.domain}/${sjsas.instance.config.dir}/cacerts.jks \ + -Dcom.sun.aas.installRoot=${jaspic.home} \ + -Dcom.sun.aas.configRoot=${jaspic.home}/config \ + -Dlog.file.location=${log.file.location} \ + -Djava.util.logging.config.file=${ts.home}/bin/logging.properties \ + -Dservlet.is.jsr115.compatible=${servlet.is.jsr115.compatible} \ + -Dsoap.is.jsr115.compatible=${soap.is.jsr115.compatible} \ + -Dprovider.configuration.file=${provider.configuration.file} \ + -Dlogical.hostname.servlet=${logical.hostname.servlet} \ + -Djava.security.properties=${s1as.domain}/config/ts.java.security \ + -Ddeliverable.class=${deliverable.class} $testExecuteClass $testExecuteArgs + +######################################################################## +# -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5000 +## Appclient Command line for the App Server under test +## Licensees modify this command +# +# @command.testExecuteAppClient - This command is used to execute +# the application client container for +# the vendor implementation (vi). +# Please note that $TS_HOME/classes +# should not be in the classpath for +# this command since all client classes +# are self contained in the application +# archive (or referenced via the manifest). +######################################################################## +command.testExecuteAppClient= \ + com.sun.ts.lib.harness.ExecTSTestCmd DISPLAY=${ts.display} HOME="${user.home}" \ + LD_LIBRARY_PATH=${jaspic.home}/lib \ + TMP=${TMP} \ + windir=${windir} \ + SYSTEMROOT=${SYSTEMROOT} \ + PATH="${jaspic.home}/nativelib" \ + APPCPATH=${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/jaspic.jar${pathsep}${jaspic.home}/lib/tssv.jar \ + TZ=${tz} \ + ${JAVA_HOME}/bin/java \ + -Dlog.file.location=${log.file.location} \ + -Djava.util.logging.config.file=${jaspic.home}/domains/domain1/config/logging.properties \ + -Dservlet.is.jsr115.compatible=${servlet.is.jsr115.compatible} \ + -Dsoap.is.jsr115.compatible=${soap.is.jsr115.compatible} \ + -Dprovider.configuration.file=${provider.configuration.file} \ + -Dlogical.hostname.servlet=${logical.hostname.servlet} \ + -Djava.security.properties=${jaspic.home}/domains/domain1/config/ts.java.security \ + -Djava.system.class.loader=org.glassfish.appclient.client.acc.agent.ACCAgentClassLoader \ + -Djava.security.policy=${jaspic.home}/lib/appclient/client.policy \ + -Dcts.tmp=$harness.temp.directory \ + -Djava.security.auth.login.config=${jaspic.home}/lib/appclient/appclientlogin.conf \ + -Djava.protocol.handler.pkgs=javax.net.ssl \ + -Dcom.sun.enterprise.home=${jaspic.home} \ + -Djavax.net.ssl.keyStore=${bin.dir}/certificates/clientcert.jks \ + -Djavax.net.ssl.keyStorePassword=changeit \ + -Djavax.net.ssl.trustStore=${s1as.domain}/${sjsas.instance.config.dir}/cacerts.jks \ + -Dcom.sun.aas.installRoot=${jaspic.home} \ + -Dcom.sun.aas.imqLib=${jaspic.home}/imq/lib \ + -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl \ + -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl \ + -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl \ + -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser \ + -Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter \ + -Dstartup.login=false \ + -Dauth.gui=false \ + -Dcom.sun.aas.configRoot=${jaspic.home}/config \ + -Ddeliverable.class=${deliverable.class} \ + -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true \ + -Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true \ + -javaagent:${jaspic.home}/lib/gf-client.jar=arg=-configxml,arg=${ts.home}/tmp/appclient/jaspic.sun-acc.xml,client=jar=$testExecuteArgs + + + + +######################################################################## +## Command line for standalone clients running against the +## Jakarta EE RI (Do not modify) +######################################################################## +command.testExecute2=com.sun.ts.lib.harness.ExecTSTestCmd \ + CLASSPATH=${ts.home}/classes:${ts.harness.classpath}:\ + ${ts.home}/lib/jaxen-1.1.6.jar:\ + ${ts.home}/lib/saxpath.jar:\ + DISPLAY=${ts.display} \ + HOME="${user.home}" \ + windir=${windir} \ + SYSTEMROOT=${SYSTEMROOT} \ + PATH="${jaspic.home}/nativelib" \ + ${JAVA_HOME}/bin/java \ + -Dcts.tmp=$harness.temp.directory \ + -Djava.security.policy=${ts.home}/bin/harness.policy \ + -Djava.security.manager \ + -Djava.protocol.handler.pkgs=javax.net.ssl \ + -Djavax.net.ssl.keyStore=${ts.home}/bin/certificates/clientcert.jks \ + -Djavax.net.ssl.keyStorePassword=changeit \ + -Djavax.net.ssl.trustStore=${ri.domain}/${ri.instance.config.dir}/cacerts.jks \ + -Dlog.file.location=${log.file.location} \ + -Dprovider.configuration.file=${provider.configuration.file} \ + -Djava.security.properties=${ri.domain}/config/ts.java.security \ + -Ddeliverable.class=${deliverable.class} $testExecuteClass $testExecuteArgs + +######################################################################### +## Environment for ts_unix +## 3 test execution commands inherit from common environment +## defined above: testExecuteAppClient2, testExecuteAppClient, and +## testExecute. If you need to override them, uncomment them in the +## following section. +######################################################################### +env.ts_unix.menu=true +##env.ts_unix.command.testExecute= +##env.ts_unix.command.testExecuteAppClient= +##env.ts_unix.command.testExecuteAppClient2= + + +######################################################################## +## Environment for ts_win32 +## 3 test execution commands inherit from common environment +## defined above: testExecuteAppClient2, testExecuteAppClient, and +## testExecute. If you need to override them, uncomment them in the +## following section. +######################################################################## +env.ts_win32.menu=true +##env.ts_win32.command.testExecute= +##env.ts_win32.command.testExecuteAppClient= +##env.ts_win32.command.testExecuteAppClient2= + +######################################################################### +# @jimage.dir: This property specifies the directory where Java 11+ +# modules will be expanded by the jimage tool for use +# in sigTestClasspath +# @sigTestClasspath: This property must be set when running signature +# tests. This property should be set to a list of +# jar files and/or directories which contain your +# Jakarta EE and Java SE classes. Paths must be +# separated by the appropriate path separator +# (';' windows, ':' Unixes). +# Note that on mac, classes.jar is used instead of rt.jar. +######################################################################### +jimage.dir=${ts.home}/tmp/jdk-bundles + +sigTestClasspath=${jaspic.home}/modules/jakarta.authentication-api.jar:${jaspic.home}/modules/security.jar:${jimage.dir}/java.base${pathsep}${jimage.dir}/java.rmi${pathsep}${jimage.dir}/java.sql${pathsep}${jimage.dir}/java.naming + +######################################################################## +## These properties are used by the harness. "harness.log.port" +## specifies the port that server components use to send logging +## output back to JavaTest. If the default port # is not available +## on the machine running JavaTest, then you can set it here. +## +# +# @harness.temp.directory directory location used by the +# harness to store temporary files +# +# @harness.log.port the port the harness listens on for log mesages +# from remote clients +# +# @harness.log.traceflag used to turn on/off verbose debugging output +# for the tests. +# +# @harness.executeMode used to run the harness in the following modes +# of execution: +# 0 - default (deploy, run, undeploy) +# 1 - deploy only +# 2 - run only +# 3 - undeploy only +# 4 - deploy and run only +# +# @harness.socket.retry.count - denotes the number of time we should +# attempt to create a server socket when intilizing a test +# client. The socket is used for logging purposes. +# +# @harness.log.delayseconds Number of seconds to delay to allow +# reporting from remote clients to finish. +######################################################################## +harness.temp.directory=${ts.home}/tmp +harness.log.port=2000 +harness.log.traceflag=true +harness.executeMode=0 +harness.socket.retry.count=10 +harness.log.delayseconds=1 + + +#################################################################### +# @impl.vi This property must be set to the implementation +# under test. +# @impl.vi.deploy.dir This property must be set to the deploy dir for +# the implementation such that copying archives to +# this dir will initiate deployment of that archive. +# @impl.deploy.timeout.multiplier The time it will wait for deployment to +# succeed or fail +#################################################################### +impl.vi=glassfish +impl.vi.deploy.dir=${s1as.domain}/autodeploy +impl.deploy.timeout.multiplier=1200 + + +######################################################################### +# @wsdlRepository1 Location to publish final wsdl files when using +# file URL publishing for Vendor Jakarta EE implementation. +# @wsdlRepository2 Location to publish final wsdl files when using +# file URL publishing for Sun RI. +######################################################################### +wsdlRepository1=${harness.temp.directory}/wsdlRepository1 +wsdlRepository2=${harness.temp.directory}/wsdlRepository2 + +####################################################################### +# @deployment_host.1 name of machine running the JSR 88 deployment +# process for the vendor's Jakarta EE implementation. +# @deployment_port.1 deployment port (if applicable) for the vendor's +# Jakarta EE implementation. +####################################################################### +deployment_host.1=${orb.host} +deployment_port.1=${s1as.admin.port} + +######################################################################## +# @deploy.delay.in.minutes is no longer used, it was for pruned Jakarta Deployment +######################################################################## + +######################################################################## +## Following are no longer used, were settings for pruned Jakarta Deployment +######################################################################## +#deployManagerJarFile.2 +#deployManageruri.2 +#deployManageruname.2 +#deployManagerpasswd.2 +# +# @porting.ts.deploy2.class.1 +# @porting.ts.deploy2.class.2 +# porting.ts.deploy2.class.1=com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2 +# porting.ts.deploy2.class.2=com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2 + + +############################################################### +## These properties must be set to tell the Test harness the +## class names of your porting class implementations. By default +## both property sets below point to Sun RI specific classes. To +## run interoperability tests, the ".2" set of properties should +## always point to Sun RI classes. The ".1" set should point to +## implementations that work in your specific Jakarta EE environment. +# +# @porting.ts.login.class.1 VI of +# com.sun.ts.lib.porting.TSLoginContextInterface +# @porting.ts.url.class.1 VI of +# com.sun.ts.lib.porting.TSURLInterface +# @porting.ts.jms.class.1 VI of +# com.sun.ts.lib.porting.TSJMSAdminInterface +# @porting.ts.HttpsURLConnection.class.1 VI of +# com.sun.ts.lib.porting.TSHttpsURLConnectionInterface +############################################################### +porting.ts.login.class.1=com.sun.ts.lib.implementation.sun.javaee.GlassFishLoginContext +porting.ts.url.class.1=com.sun.ts.lib.implementation.sun.common.SunRIURL +porting.ts.jms.class.1=com.sun.ts.lib.implementation.sun.javaee.SunRIJMSAdmin +porting.ts.HttpsURLConnection.class.1=com.sun.ts.lib.implementation.sun.javaee.SunRIHttpsURLConnection + + +############################################################### +# The following properties should not be needed unless trying +# to execute the SOAP profile tests within a JavaEE container +# which implies platform.mode is set to jakartaEE +# Even then, these properties should only be needed to +# satisfy some requirements for properly lookups. +############################################################### +porting.ts.deploy2.class.2=com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2 +porting.ts.login.class.2=com.sun.ts.lib.implementation.sun.javaee.GlassFishLoginContext +porting.ts.url.class.2=com.sun.ts.lib.implementation.sun.common.SunRIURL +porting.ts.jms.class.2=com.sun.ts.lib.implementation.sun.javaee.SunRIJMSAdmin +porting.ts.HttpsURLConnection.class.2=com.sun.ts.lib.implementation.sun.javaee.SunRIHttpsURLConnection +namingServiceHost1=${orb.host} +namingServicePort1=${orb.port} +namingServiceHost2=${orb.host} +namingServicePort2=${orb.port} +variable.mapper=org.glassfish.expressly.lang.VariableMapperImpl +# The following Jakarta Deployment properties are not supported +#deployManagerJarFile.2=${jaspic.home}/lib/deployment/sun-as-jsr88-dm.jar +#deployManageruri.2=deployer:Sun:AppServer::${deployment_host.2}:${s1as.admin.port} +#deployManageruname.2=${s1as.admin.user} +#deployManagerpasswd.2=${s1as.admin.passwd} + + +############################################################## +# @certLoginUserAlias User alias for certificate based login. +# This property is used in mutual authentication to pickup the +# certificate based on the user alias. +############################################################## +certLoginUserAlias=cts + +##################################################################### +## The following properties must be set prior to running the Servlet +## or JSP API tests and interoperability tests. +## +## These properties must specify the host and port of the web server, +## in which the servlets and JSPs are deployed. +# +# @webServerHost hostname for the Vendor's Jakarta EE Web Server +# @webServerPort port number of the Vendor's Jakarta EE Web Server +# @webServerHost.2 hostname for the Jakarta EE RI Web Server +# @webServerPort.2 port number of the Jakarta EE RI Web Server +# @ServletClientThreads The ServletClientThreads property configures +# the number of threads used by the client for +# the SingleThreadModel servlet test. If the +# container implementation supports pooling of +# SingleThreadModel servlets, set the value of +# ServletClientThreads to twice the value of +# the default servlet instance pool size. If +# the container implementation only maintains +# a single instance of a SingleTheadModel +# servlet, leave the default value of 2. +##################################################################### +webServerHost=${orb.host} +webServerPort=8080 +webServerHost.2=${orb.host} +webServerPort.2=8002 +ServletClientThreads=2 + + +######################################################################### +## The following properties must be set before running any security +## related tests. The properties user, password, authuser, authpassword, +## and nobodyuser must be set. +## +## The value for user, password, authuser, and authpassword need to be set +## exactly as they are set in the container/server. +# +# @user User defined to exercise rolemapping feature +# @password Associated password for the user +# @authuser User defined to exercise rolemapping feature +# @authpassword Associated password for the authuser +# @nobodyuser This value must be the same value returned by a call to +# getCallerPrincipal().getName() from the ejb-tier when +# an unauthenticated caller in the web tier invokes an +# ejb method. +######################################################################### +user = j2ee +password = j2ee +authuser = javajoe +authpassword = javajoe +nobodyuser = guest +user_vi=j2ee_vi +password_vi=j2ee_vi +user_ri=j2ee_ri +password_ri=j2ee_ri +############################################################### +# @securedWebServicePort must be set to run secbasicssl and +# csiv2 tests. Set this property with your application +# server's secured webservice port. +# @securedWebServicePort.2 points to the secured webservice +# port in Sun's Reference Implementation(RI). +############################################################### +securedWebServicePort=1044 +securedWebServicePort.2=1045 + +############################################################################### +##This property is needed for jms tests. +# +# @jms_timeout - this is the amount of time in milliseconds that synchronous +# receives will wait for a message +############################################################################## +jms_timeout=5000 + + +################################################################### +# @log.file.location This property is used by Jakarta Authorization tests and Jakarta Authentication tests +# to create and analyze provider logs. Specify the log directory in which +# your appserver generates logs. +# +################################################################### +log.file.location=${s1as.domain}/logs + + +################################################################### +# @servlet.is.jsr115.compatible This property is used by Jakarta Authentication tests +# to determine if the servlet container is a Jakarta Authorization compatible +# container. (true = compatible to Jakarta Authorization, false = not compatible.) +# @soap.is.jsr115.compatible This is also used by Jakarta Authentication tests to +# determine if the SOAP container is Jakarta Authorization compatible. +################################################################### +servlet.is.jsr115.compatible=true +soap.is.jsr115.compatible=false + + +################################################################### +## The following properties should be set before running any security +## related Jakarta Authentication tests. +# +# @provider.configuration.file +# This property is used by Jakarta Authentication tests to configure TestSuite's +# AuthConfig Provider and points at an xml file which is used +# to populate the Jakarta Authentication provider information into the active +# ACF. This file contaiins known/expected test provider info. +# +# @schema.file.location +# This points to the directory that the provider-configuration.xsd +# file will live. (The provider-configuration.xsd is used to +# describe the provider.configuration.file (above). +# +# @logical.hostname.servlet +# This used to identify the the name of a logical host that +# processes Servlet requests. Servlet requests may be directed to +# a logical host using various physical or virtual host names or +# addresses, and a message processing runtime may be composed of +# multiple logical hosts (This is required to properly identify +# the servlet profiles AppContextId hostname.) +# If a logical.hostname.servlet does not exist, you can set this +# to the default hostname (eg webServerHost). +$ +# @logical.hostname.soap +# This property is used to identify the name of the logical host +# that processes soap requests. This hostname is used in server +# side Application context Identifier in soap profile. +# +# @appclient.log.output +# The client logging level for appclient container depends on the +# log level specified in sun-acc.xml +# +# This log level directly affects the output of TSLogger which +# logs the Jakarta Authentication calls made in appclient container. +# +# using this property we enable the appclient container's +# logging level to INFO +# +# @vendor.authconfig.factory +# This property specifies vendor's authconfig factory class +# this will be used by Jakarta Authentication tests to register TestSuite's +# provider in Vendor's AuthConfig Factory. +# +# For example for SJSAS RI this value is +# +# vendor.authconfig.factory= +# com.sun.enterprise.security.jmac.config.GFAuthConfigFactory +# +# +################################################################### +provider.configuration.file=${javaee.home}/domains/domain1/config/ProviderConfiguration.xml +schema.file.location=${javaee.home}/lib/schemas +logical.hostname.servlet=server +logical.hostname.soap=localhost +appclient.log.output=true +vendor.authconfig.factory=com.sun.enterprise.security.jmac.config.GFAuthConfigFactory + + +################################################################### +################################################################### +################################################################### +## PROPERTIES USERS WILL NOT HAVE TO SET LIVE BELOW +################################################################### +################################################################### +################################################################### + +## +## The directory seperator for the platform. User should not change +## this property. +## +dirsep=/ + +##build level +##1: compile only +##2: compile and build component archives (e.g., jar's, war's) +##3: compile and build component and application archives +##default is set to 3 +build.level=3 + +## Deliverables wanting ts.* packaging tasks to add extension list +## attributes to the manifest files must set this property to true. +create.manifest.extension.entries=true + +## Deliverables must set this property to the name of the deliverable +## specific library jar file (iff create.manifest.extension.entries is set to +## true) +tslib.name=jaspic + +############################################################### +## Use JaspicDeliverable class when the platform.mode is in standalone mode +## Use CTSDeliverable class when the platform.mode is in JakartaEE mode +############################################################### +#deliverable.class=com.sun.ts.lib.deliverable.jaspic.JaspicDeliverable +#deliverable.class=com.sun.ts.lib.deliverable.jaspic.JaspicJakartaEEDeliverable +deliverable.class=com.sun.ts.lib.deliverable.cts.CTSDeliverable + + +############################################################### +## These properties are used by connector tests and are non configurable +## and must specify valid username,password to establish TSeis connection. +############################################################### +rauser1=cts1 +rapassword1=cts1 +rauser2=cts2 +rapassword2=cts2 + + +############################################################### +## This command is only used when quickly checking any servlet +## or jsp related tests. The test clients will be run in +## the same JVM as JavaTest in this case. This mode can be +## enabled by passing "-Dsame.jvm=true" to the runclient or gui +## targets. NOTE: This option is only to be used for sanity +## checking and not when running CTS for compatibility. +############################################################### +command.testExecuteSameJVM=com.sun.ts.lib.harness.ExecuteTSTestSameJVMCmd \ + $testExecuteClass $testExecuteArgs + +####################################################################### +## platform.mode is used by jaxws tests to know whether to use +## the Jakarta EE Programming Model for service and port access or the +## JAXWS/JASPIC Programming model based on the runtime execution +## platform. +## +## platform.mode=standalone JAXWS/JASPIC Programming Model +## platform.mode=jakartaEE Jakarta EE Programming Model +## +## Note: When you switch platform.mode make sure you change the property +## deliverable.class as well(this is appilcable only for JASPIC tests) +###################################################################### +platform.mode=jakartaEE + + +ts_home=${ts.home} + +########################################################################### +# tools.jar should be set to the location of the tools.jar from the installed +# jdk +########################################################################### +jaxws.ri.lib=/export/home/sun/jaxws211/jaxws-ri/lib +tools.jar=${jaxws.ri.lib}/jaxws-tools.jar + +########################################################################### +# various flags used by the generation tools +########################################################################### +wsgen.ant.classname= +wsgen.classpath=${tools.jar}:${jaspic.classes} +wsgen.verbose=true +wsgen.debug=false +wsimport.ant.classname= +wsimport.classpath=${jaspic.classes}:${tools.jar} +wsimport.verbose=true +wsimport.debug=false +wsimport.jvmargs= + +########################################################################### +# various flags used by Suns generation tools +# DO NOT EDIT +########################################################################### +ri.wsgen.ant.classname=com.sun.tools.ws.ant.WsGen +ri.wsgen.classpath=${jaspic.classes}:${tools.jar} +ri.wsgen.verbose=true +ri.wsgen.debug=false +ri.wsimport.ant.classname=com.sun.tools.ws.ant.WsImport +ri.wsimport.classpath=${jaspic.classes}:${tools.jar} +ri.wsimport.verbose=true +ri.wsimport.debug=false +ri.wsimport.jvmargs= + + +############################################################################### +## These should be deprecated. There is no need to modify the following +## properties... +############################################################################### + + +############################################################### +## These properties are implementations of the pre-1.4 Deployment +## porting interface. The impls defined below use those APIs. +## The TSDeploymentInterface2 interface +## is now the location for deployment porting code for functionality +## not addressed by JSR-88. +# +# @porting.ts.deploy.class.1 This property must point to an implementation +# of com.sun.ts.lib.porting.TSDeploymentInterface. CTS 5 shipped +# with this property set to a standard JSR-88 impl which +# should be able to be used when running against an appserver that supports +# JSR 88. Web Profile impls may not support JSR 88. In CTS 6, the default +# value fo this property points to an impl that deploys via copying/deleting +# to/from the RI autodeploy directory. You have the following choices for +# setting these properties in CTS 6: +# +# 1. Set this property to the standard JSR 88 impl.... +# +# porting.ts.deploy.class.1=com.sun.ts.lib.deliverable.cts.deploy.StandardDeployment14 +# +# If you use the above impl, then you must also set the +# porting.ts.deploy2.class.1 property to a valid impl of +# com.sun.ts.lib.porting.TSDeploymentInterface2. In the case of the RI, +# the porting.ts.deploy2.class.2 property would be set to the +# RI impl of com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2. +# +# 2. Or, you can set this property to deploy/undeploy to/from your impl in +# a custom way. In the case of the RI, it would be set to the following. +# This is the default setting for CTS 6. +# +# porting.ts.deploy.class.1=com.sun.ts.lib.implementation.sun.javaee.glassfish.AutoDeployment +# +# @porting.ts.deploy.class.2 This property must point to an implementation +# of com.sun.ts.lib.porting.TSDeploymentInterface. CTS 5 shipped +# with this property set to a standard JSR-88 impl which +# should be able to be used when running against an appserver that supports +# JSR 88. Web Profile impls may not support JSR 88. In CTS 6, the default +# value fo this property points to an impl that deploys via copying/deleting +# to/from the RI autodeploy directory. This should be left unchanged... +# +# porting.ts.deploy.class.2=com.sun.ts.lib.implementation.sun.javaee.glassfish.AutoDeployment +# +############################################################### +porting.ts.deploy.class.1=com.sun.ts.lib.implementation.sun.javaee.glassfish.AutoDeployment +porting.ts.deploy.class.2=com.sun.ts.lib.implementation.sun.javaee.glassfish.AutoDeploymentSeparateVM + + +#classpath used by standard deployment server to deploy to the RI in a separate +#VM (DO NOT MODIFY) +ts.standard.deployment.server.classpath=${ts.home}/lib/jakarta.xml.bind-api.jar:${ts.home}/lib/jaxb-impl.jar:${ts.home}/lib/jaxb-xjc.jar:${ts.home}/lib/tsharness.jar:${ts.home}/lib/jaspic.jar:${ts.home}/lib/sigtest.jar:${ts.run.classpath}:${ts.home}/lib/javatest.jar:${ts.home}/lib/jdom-1.1.3.jar:${ant.home}/lib/ant.jar:${ts.home}/lib/commons-codec-1.9.jar + +############################################################################### +# The following properties are aliases for the old J2EE properties. These +# properties are now named javaee instead of j2ee and will eventually be phased +# out of the CTS. These props are necessary until the props are renamed +# through out all CTS. +############################################################################### +j2ee.home=${jaspic.home} +j2ee.home.ri=${jaspic.home.ri} +javaee.home=${jaspic.home} +javaee.home.ri=${jaspic.home} + diff --git a/tck/old-tck/source/install/jaspic/bin/ts.jtx b/tck/old-tck/source/install/jaspic/bin/ts.jtx new file mode 100755 index 0000000..5905a93 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/ts.jtx @@ -0,0 +1,19 @@ +# +# Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# This is a dummy exclude list used within the workspace only. It +# is used by all deliverables. DO NOT EDIT. + diff --git a/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/config.vi.xml b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/config.vi.xml new file mode 100755 index 0000000..06b208c --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/config.vi.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/asadmin.bat.concat.template b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/asadmin.bat.concat.template new file mode 100755 index 0000000..ea6bc54 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/asadmin.bat.concat.template @@ -0,0 +1 @@ +exit %ERRORLEVEL% \ No newline at end of file diff --git a/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/password.template b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/password.template new file mode 100755 index 0000000..deef01c --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/password.template @@ -0,0 +1,3 @@ +AS_ADMIN_MASTERPASSWORD=@sjsas.master.password@ +AS_ADMIN_PASSWORD=@sjsas.admin.password@ +AS_ADMIN_USERPASSWORD=@user.password@ diff --git a/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/sun-acc.xml.template b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/sun-acc.xml.template new file mode 100644 index 0000000..a4d4763 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/xml/impl/glassfish/templates/sun-acc.xml.template @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/install/jaspic/bin/xml/verifier-results.xsl b/tck/old-tck/source/install/jaspic/bin/xml/verifier-results.xsl new file mode 100755 index 0000000..50e252d --- /dev/null +++ b/tck/old-tck/source/install/jaspic/bin/xml/verifier-results.xsl @@ -0,0 +1,165 @@ + + + + + + + + + + + + Verifier Results + + + + + Verifier Errors + Error name and description below:
+ : + +
+ +
Verifier Results

+ + Failure Count: +
+
+ + Warning Count: +
+
+ + Error Count: +
+
+ +
+
+ + +
+ + + + + + +


+ Application Results
+ +
+ + +


+ EJB Results
+ +
+ + +


+ Web Results
+ +
+ + +


+ Appclient Results
+ +
+ + +


+ Connector Results
+ +
+ + +


+ Other Test Results
+ +
+ + +
+ + + + + + + + +
Failed Tests
Test NameTest AssertionTest Description
+
+ + + +
+ + + + + + + + +
Passed Tests
Test NameTest AssertionTest Description
+
+
+ + +
+ + + + + + + + +
Warning Tests
Test NameTest AssertionTest Description
+
+ + + +
+ + + + + + + + +
Not Applicable Tests
Test NameTest AssertionTest Description
+
+
+ + + + + + + + + + + +
diff --git a/tck/old-tck/source/install/jaspic/docs/ReleaseNotes-authentication-2.0.html b/tck/old-tck/source/install/jaspic/docs/ReleaseNotes-authentication-2.0.html new file mode 100644 index 0000000..f1d656c --- /dev/null +++ b/tck/old-tck/source/install/jaspic/docs/ReleaseNotes-authentication-2.0.html @@ -0,0 +1,148 @@ + + + + + Jakarta Authentication TCK Release Notes + + + +
+

Jakarta EE Authentication Technology Compatibility Kit, Version 2.0

+

Release Notes, May 2021

+
+

Kit Contents

+

The Jakarta EE Authentication, Version 2.0 Technology Compatibility Kit + (TCK) includes the following items:

+
    +
  • +

    Jakarta EE Authentication TCK tests for signature, API, and + End-to-End tests:

    +
  • +
      +
    • +

      A signature test checks that all of the public + APIs are supported in the Jakarta EE Authentication Version 2.0 + implementation that is being tested

      +
    • +
    • +

      API tests for all of the public APIs under the jakarta.security.auth.message + package

      +
    • +
    • +

      End-To-End tests that demonstrate compliance with + the Jakarta EE Authentication 2.0 Specification

      +
    • +
    +
+
+

Platform Notes

+

The Jakarta EE Authentication TCK tests have been built with JDK 8 (1.8) + and tested with JDK 8 and 11.

+

The Jakarta EE Authentication TCK tests have been run on the following + platforms:

+
    +
  • MAC OS X, El Capitan (10.9.5+)
  • +
  • Oracle Linux 7.1
  • +
  • Windows 10
  • +
  • Alpine Linux v3.12
  • +
+

The Jakarta EE Authentication TCK tests have been run against the Jakarta + Authentication 2.0 Compatible Implementation, Eclipse GlassFish 6.0 and + 6.1.

+
+

Installing, Setting Up, and Running the + Jakarta EE Authentication TCK

+

Refer to the Jakarta EE Authentication TCK 2.0 User's Guide + (HTML, + PDF) + for complete instructions on installing, setting up, and running the + Jakarta Authentication TCK. The online version of the JT Harness version + 5.0 documentation is available here.

+
+

Jakarta EE Authentication TCK Requirements, Facts, and Figures

+
+

The Jakarta EE Authentication TCK requires a minimum of 77 MB of free + disk space:

+
    +
  • Jakarta EE Authentication TCK (zipped): 18 MB
  • +
  • Jakarta EE Authentication TCK (unzipped): 57 MB
  • +
  • Space for Jakarta EE Authentication log/report files: 2 MB minimum + (trace off)
  • +
+

The test suite bundle contains the following:

+
    +
  • EARs: 11
  • +
  • JARs: 35
  • +
  • WARs: 8
  • +
  • Total tests: 88 +
      +
    • Baseline: 7
    • +
    • Servlet Profile: 42
    • +
    • Soap Profile (includes authstatus): 39
    • +
    +
  • +
+

There are multiple levels of compliance available for Jakarta EE + Authentication certification. Jakarta EE Authentication allows for + certification of the following profiles: Baseline, Servlet Profile, SOAP + Profile. Baseline compliance is the most basic level of Jakarta EE + Authentication certification. Servlet Profile compliance also requires + Baseline compliance while SOAP assumes Servlet and Baseline.

+
+
+

Status Information

+

Exclude List

+
+

You can find the exclude list in the Jakarta EE Authentication bundle + in <TS_HOME>/bin/ts.jtx. New Exclude lists will be + released in revised versions of this TCK. Information about updates will + be provided through the Jakarta Authentication specification web site: https://jakarta.ee/specifications/authentication/2.0/

+
+
+

Known Problems and Workarounds

+

Running the Jakarta Authentication TCK Against Jakarta EE CI on Windows

+
+

When configuring and running the TCK against a compatible + implementation (e.g. Eclipse GlassFish 6.0 or 6.1) on Windows, please + make sure to install all related software (Java SE, the Jakarta + Authentication compatible implementation, the TCK, etc.) on the same + drive (for example, C:). If you want to install on a drive + other than C:, please be sure to change the following + properties in <TS_HOME>/bin/ts.jte:

+
ri.applicationRoot=c:
+s1as.applicationRoot=c:
+
+
+

Attributions

+
+

The Jakarta EE Authentication Specification + TCK test suite includes software developed by the Apache Software + Foundation (http://www.apache.org/), + the dom4j Project (http://sourceforge.net/projects/dom4j/), + and the JDOMTM Project (http://www.jdom.org/). + The Apache Ant Contrib project is located at http://ant-contrib.sourceforge.net/.

+
+

+
Copyright © 2013, 2021, Oracle and/or its affiliates. All + rights reserved.
+

+ + diff --git a/tck/old-tck/source/install/jaspic/docs/assertions/JASPICJavadocAssertions.html b/tck/old-tck/source/install/jaspic/docs/assertions/JASPICJavadocAssertions.html new file mode 100644 index 0000000..4f0953c --- /dev/null +++ b/tck/old-tck/source/install/jaspic/docs/assertions/JASPICJavadocAssertions.html @@ -0,0 +1,1569 @@ + + + + + +JavaDoc Assertion Detail + + +
+
+

+ Jakarta Authentication - 2.0
JavaDoc Assertion Detail +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
TotalsTotalActiveDeprecatedRemoved
# of Assertions 10710700
# of Required Assertions 10710700
# of Optional Assertions 0000
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDReturnMethod/FieldDescriptionRequiredDeprecatedTestable
JASPIC:JAVADOC:1AuthExceptionjakarta.security.auth.message.AuthException.AuthException
+
Constructs an AuthException with no detail + message. A detail message is a String that describes this particular exception. true
+
true
JASPIC:JAVADOC:2AuthExceptionjakarta.security.auth.message.AuthException.AuthException
+ + ( String ) +
Constructs an AuthException with the + specified detail message. A detail message is a String that describes this particular exception. true
+
true
JASPIC:JAVADOC:3voidjakarta.security.auth.message.ClientAuth.cleanSubject
+ + ( MessageInfo ,
Subject ) +
Remove implementation specific principals and + credentials from the subject. true
+
true
JASPIC:JAVADOC:4voidjakarta.security.auth.message.ClientAuth.cleanSubject
+ + ( MessageInfo ,
Subject )
throws AuthException
+
If an error occurs during the Subject + processing.true
+
true
JASPIC:JAVADOC:5AuthStatusjakarta.security.auth.message.ClientAuth.secureRequest
+ + ( MessageInfo ,
Subject ) +
Secure a service request message before + sending it to the service. This method is called to transform the request message acquired by + calling getRequestMessage (on messageInfo) into the mechanism-specific form to be sent by the + runtime. This method conveys the outcome of its message processing either by returning an AuthStatus + value or by throwing an AuthException. true
+
true
JASPIC:JAVADOC:6AuthStatusjakarta.security.auth.message.ClientAuth.secureRequest
+ + ( MessageInfo ,
Subject )
throws AuthException
+
When the message processing failed without + establishing a failure response message (in messageInfo).true
+
true
JASPIC:JAVADOC:7AuthStatusjakarta.security.auth.message.ClientAuth.validateResponse
+ + ( MessageInfo ,
Subject ,
Subject ) +
Validate a received service response. This + method is called to transform the mechanism-specific response message acquired by calling + getResponseMessage (on messageInfo) into the validated application message to be returned to the + message processing runtime. If the response message is a (mechanism-specific) meta-message, the + method implementation must attempt to transform the meta-message into the next mechanism-specific + request message to be sent by the runtime. This method conveys the outcome of its message processing + either by returning an AuthStatus value or by throwing an AuthException. true
+
true
JASPIC:JAVADOC:8AuthStatusjakarta.security.auth.message.ClientAuth.validateResponse
+ + ( MessageInfo ,
Subject ,
Subject )
throws AuthException
+
When the message processing failed without + establishing a failure response message (in messageInfo).true
+
true
JASPIC:JAVADOC:9Mapjakarta.security.auth.message.MessageInfo.getMap
+
Get (a reference to) the Map object of this + MessageInfo. Operations performed on the acquired Map must effect the Map within the MessageInfo. true
+
true
JASPIC:JAVADOC:10Objectjakarta.security.auth.message.MessageInfo.getRequestMessage
+
Get the request message object from this + MessageInfo. true
+
true
JASPIC:JAVADOC:11Objectjakarta.security.auth.message.MessageInfo.getResponseMessage
+
Get the response message object from this + MessageInfo. true
+
true
JASPIC:JAVADOC:12voidjakarta.security.auth.message.MessageInfo.setRequestMessage
+ + ( Object ) +
Set the request message object in this + MessageInfo. true
+
true
JASPIC:JAVADOC:13voidjakarta.security.auth.message.MessageInfo.setResponseMessage
+ + ( Object ) +
Set the response message object in this + MessageInfo. true
+
true
JASPIC:JAVADOC:14TargetPolicy[]jakarta.security.auth.message.MessagePolicy.getTargetPolicies
+
Get the target policies that comprise the + authentication policy. true
+
true
JASPIC:JAVADOC:15booleanjakarta.security.auth.message.MessagePolicy.isMandatory
+
Get the MessagePolicy modifier. true
+
true
JASPIC:JAVADOC:16MessagePolicyjakarta.security.auth.message.MessagePolicy.MessagePolicy
+ + ( TargetPolicy[] ,
boolean ) +
Create a MessagePolicy instance with an array + of target policies. true
+
true
JASPIC:JAVADOC:17Stringjakarta.security.auth.message.MessagePolicy.ProtectionPolicy.getID
+
Get the ProtectionPolicy identifier. An + identifier may represent a conceptual protection policy (as is the case with the static identifiers + defined within this interface) or it may identify a procedural policy expression or plan that may be + more difficult to categorize in terms of a conceptual identifier. true
+
true
JASPIC:JAVADOC:18Objectjakarta.security.auth.message.MessagePolicy.Target.get
+ + ( MessageInfo ) +
Get the Object identified by the Target from + the MessageInfo. true
+
true
JASPIC:JAVADOC:19voidjakarta.security.auth.message.MessagePolicy.Target.put
+ + ( MessageInfo ,
Object ) +
Put the Object into the MessageInfo at the + location identified by the target. true
+
true
JASPIC:JAVADOC:20voidjakarta.security.auth.message.MessagePolicy.Target.remove
+ + ( MessageInfo ) +
Remove the Object identified by the Target + from the MessageInfo. true
+
true
JASPIC:JAVADOC:21ProtectionPolicyjakarta.security.auth.message.MessagePolicy.TargetPolicy.getProtectionPolicy
+
Get the ProtectionPolicy that applies to the + targets. true
+
true
JASPIC:JAVADOC:22Target[]jakarta.security.auth.message.MessagePolicy.TargetPolicy.getTargets
+
Get the array of layer-specific target + descriptors that identify the one or more message parts to which the specified message protection + policy applies. true
+
true
JASPIC:JAVADOC:23TargetPolicyjakarta.security.auth.message.MessagePolicy.TargetPolicy.MessagePolicy.TargetPolicy
+ + ( Target[] ,
ProtectionPolicy ) +
Create a TargetPolicy instance with an array + of Targets and with a ProtectionPolicy. true
+
true
JASPIC:JAVADOC:24voidjakarta.security.auth.message.ServerAuth.cleanSubject
+ + ( MessageInfo ,
Subject ) +
Remove method specific principals and + credentials from the subject. true
+
true
JASPIC:JAVADOC:25voidjakarta.security.auth.message.ServerAuth.cleanSubject
+ + ( MessageInfo ,
Subject )
throws AuthException
+
If an error occurs during the Subject + processing.true
+
true
JASPIC:JAVADOC:26AuthStatusjakarta.security.auth.message.ServerAuth.secureResponse
+ + ( MessageInfo ,
Subject ) +
Secure a service response before sending it + to the client. This method is called to transform the response message acquired by calling + getResponseMessage (on messageInfo) into the mechanism-specific form to be sent by the runtime. This + method conveys the outcome of its message processing either by returning an AuthStatus value or by + throwing an AuthException. true
+
true
JASPIC:JAVADOC:27AuthStatusjakarta.security.auth.message.ServerAuth.secureResponse
+ + ( MessageInfo ,
Subject )
throws AuthException
+
When the message processing failed without + establishing a failure response message (in messageInfo).true
+
true
JASPIC:JAVADOC:28AuthStatusjakarta.security.auth.message.ServerAuth.validateRequest
+ + ( MessageInfo ,
Subject ,
Subject ) +
Authenticate a received service request. This + method is called to transform the mechanism-specific request message acquired by calling + getRequestMessage (on messageInfo) into the validated application message to be returned to the + message processing runtime. If the received message is a (mechanism-specific) meta-message, the + method implementation must attempt to transform the meta-message into a corresponding + mechanism-specific response message, or to the validated application request message. The runtime + will bind a validated application message into the the corresponding service invocation. This method + conveys the outcome of its message processing either by returning an AuthStatus value or by throwing + an AuthException. true
+
true
JASPIC:JAVADOC:29AuthStatusjakarta.security.auth.message.ServerAuth.validateRequest
+ + ( MessageInfo ,
Subject ,
Subject )
throws AuthException
+
When the message processing failed without + establishing a failure response message (in messageInfo).true
+
true
JASPIC:JAVADOC:30CallerPrincipalCallbackjakarta.security.auth.message.callback.CallerPrincipalCallback.CallerPrincipalCallback
+ + ( Subject ,
Principal ) +
Create a CallerPrincipalCallback to set the + container's representation of the caller principal true
+
true
JASPIC:JAVADOC:31CallerPrincipalCallbackjakarta.security.auth.message.callback.CallerPrincipalCallback.CallerPrincipalCallback
+ + ( Subject ,
String ) +
Create a CallerPrincipalCallback to set the + container's representation of the caller principal. true
+
true
JASPIC:JAVADOC:32Stringjakarta.security.auth.message.callback.CallerPrincipalCallback.getName
+
Get the caller principal name. true
+
true
JASPIC:JAVADOC:33Principaljakarta.security.auth.message.callback.CallerPrincipalCallback.getPrincipal
+
Get the caller principal. true
+
true
JASPIC:JAVADOC:34Subjectjakarta.security.auth.message.callback.CallerPrincipalCallback.getSubject
+
Get the Subject in which the handler will + distinguish the caller principal true
+
true
JASPIC:JAVADOC:35CertStoreCallbackjakarta.security.auth.message.callback.CertStoreCallback.CertStoreCallback
+
Create a CertStoreCallback. true
+
true
JASPIC:JAVADOC:36CertStorejakarta.security.auth.message.callback.CertStoreCallback.getCertStore
+
Used by the CertStore user to obtain the + CertStore set within the Callback. true
+
true
JASPIC:JAVADOC:37voidjakarta.security.auth.message.callback.CertStoreCallback.setCertStore
+ + ( CertStore ) +
Used by the CallbackHandler to set the + CertStore within the Callback. true
+
true
JASPIC:JAVADOC:38String[]jakarta.security.auth.message.callback.GroupPrincipalCallback.getGroups
+
Get the array of group names. true
+
true
JASPIC:JAVADOC:39Subjectjakarta.security.auth.message.callback.GroupPrincipalCallback.getSubject
+
Get the Subject in which the handler will + establish the group principals. true
+
true
JASPIC:JAVADOC:40GroupPrincipalCallbackjakarta.security.auth.message.callback.GroupPrincipalCallback.GroupPrincipalCallback
+ + ( Subject ,
String[] ) +
Create a GroupPrincipalCallback to establish + the container's representation of the corresponding group principals within the Subject. true
+
true
JASPIC:JAVADOC:41voidjakarta.security.auth.message.callback.PasswordValidationCallback.clearPassword
+
Clear the password. true
+
true
JASPIC:JAVADOC:42char[]jakarta.security.auth.message.callback.PasswordValidationCallback.getPassword
+
Get the password. Note that this method + returns a reference to the password. If a clone of the array is created it is the caller's + responsibility to zero out the password information after it is no longer needed. true
+
true
JASPIC:JAVADOC:43booleanjakarta.security.auth.message.callback.PasswordValidationCallback.getResult
+
Get the authentication result. true
+
true
JASPIC:JAVADOC:44Subjectjakarta.security.auth.message.callback.PasswordValidationCallback.getSubject
+
Get the subject. true
+
true
JASPIC:JAVADOC:45Stringjakarta.security.auth.message.callback.PasswordValidationCallback.getUsername
+
Get the username. true
+
true
JASPIC:JAVADOC:46PasswordValidationCallbackjakarta.security.auth.message.callback.PasswordValidationCallback.PasswordValidationCallback
+ + ( Subject ,
String ,
char[] ) +
Create a PasswordValidationCallback. true
+
true
JASPIC:JAVADOC:47voidjakarta.security.auth.message.callback.PasswordValidationCallback.setResult
+ + ( boolean ) +
Set the authentication result. true
+
true
JASPIC:JAVADOC:48Certificate[]jakarta.security.auth.message.callback.PrivateKeyCallback.getChain
+
Used to obtain the certicicate chain set + within the Callback. true
+
true
JASPIC:JAVADOC:49PrivateKeyjakarta.security.auth.message.callback.PrivateKeyCallback.getKey
+
Used to obtain the private key set within the + Callback. true
+
true
JASPIC:JAVADOC:50Requestjakarta.security.auth.message.callback.PrivateKeyCallback.getRequest
+
Used by the CallbackHandler to get the + Request object that identifies the private key to be returned. true
+
true
JASPIC:JAVADOC:51PrivateKeyCallbackjakarta.security.auth.message.callback.PrivateKeyCallback.PrivateKeyCallback
+ + ( Request ) +
Constructs this PrivateKeyCallback with a + private key Request object. The request object identifies the private key to be returned. The + corresponding certificate chain for the private key is also returned. If the request object is null, + the handler of the callback relies on its own default. true
+
true
JASPIC:JAVADOC:52voidjakarta.security.auth.message.callback.PrivateKeyCallback.setKey
+ + ( PrivateKey ,
Certificate[] ) +
Used by the CallbackHandler to set the + requested private key and the corresponding certificate chain within the Callback. If the requested + private key or chain could not be found, then both values must be set to null. true
+
true
JASPIC:JAVADOC:53Stringjakarta.security.auth.message.callback.PrivateKeyCallback.AliasRequest.getAlias
+
Get the alias. true
+
true
JASPIC:JAVADOC:54AliasRequestjakarta.security.auth.message.callback.PrivateKeyCallback.AliasRequest.PrivateKeyCallback.AliasRequest
+ + ( String ) +
Construct an AliasRequest with an alias. The + alias is used to directly identify the private key to be returned. The corresponding certificate + chain for the private key is also returned. If the alias is null, the handler of the callback relies + on its own default. true
+
true
JASPIC:JAVADOC:55Stringjakarta.security.auth.message.callback.PrivateKeyCallback.DigestRequest.getAlgorithm
+
Get the algorithm identifier. true
+
true
JASPIC:JAVADOC:56byte[]jakarta.security.auth.message.callback.PrivateKeyCallback.DigestRequest.getDigest
+
Get the digest value. true
+
true
JASPIC:JAVADOC:57DigestRequestjakarta.security.auth.message.callback.PrivateKeyCallback.DigestRequest.PrivateKeyCallback.DigestRequest
+ + ( byte[] ,
String ) +
Constructs a DigestRequest with a digest + value and algorithm identifier. The digest of the certificate whose private key is returned must + match the provided digest. The certificate digest is computed by applying the specified algorithm to + the bytes of the certificate. For example: + MessageDigest.getInstance(algorithm).digest(cert.getEncoded()) . The corresponding certificate chain + for the private key is also returned. If the digest or algorithm parameters are null, the handler of + the callback relies on its own defaults. true
+
true
JASPIC:JAVADOC:58X500Principaljakarta.security.auth.message.callback.PrivateKeyCallback.IssuerSerialNumRequest.getIssuer
+
Get the issuer. true
+
true
JASPIC:JAVADOC:59BigIntegerjakarta.security.auth.message.callback.PrivateKeyCallback.IssuerSerialNumRequest.getSerialNum
+
Get the serial number. true
+
true
JASPIC:JAVADOC:60IssuerSerialNumRequestjakarta.security.auth.message.callback.PrivateKeyCallback.IssuerSerialNumRequest.PrivateKeyCallback.IssuerSerialNumRequest
+ + ( X500Principal ,
BigInteger ) +
Constructs a IssuerSerialNumRequest with an + issuer/serial number. The issuer/serial number is used to identify a public key certificate. The + corresponding private key is returned in the callback. The corresponding certificate chain for the + private key is also returned. If the issuer/serialNumber parameters are null, the handler of the + callback relies on its own defaults. true
+
true
JASPIC:JAVADOC:61byte[]jakarta.security.auth.message.callback.PrivateKeyCallback.SubjectKeyIDRequest.getSubjectKeyID
+
Get the subjectKeyID. true
+
true
JASPIC:JAVADOC:62SubjectKeyIDRequestjakarta.security.auth.message.callback.PrivateKeyCallback.SubjectKeyIDRequest.PrivateKeyCallback.SubjectKeyIDRequest
+ + ( byte[] ) +
Construct a SubjectKeyIDRequest with an + subjectKeyID. The subjectKeyID is used to directly identify the private key to be returned. The + corresponding certificate chain for the private key is also returned. If the subjectKeyID is null, + the handler of the callback relies on its own default. true
+
true
JASPIC:JAVADOC:63SecretKeyjakarta.security.auth.message.callback.SecretKeyCallback.getKey
+
Used to obtain the secret key set within the + Callback. true
+
true
JASPIC:JAVADOC:64Requestjakarta.security.auth.message.callback.SecretKeyCallback.getRequest
+
Used by the CallbackHandler to get the + Request object which identifies the secret key to be returned. true
+
true
JASPIC:JAVADOC:65SecretKeyCallbackjakarta.security.auth.message.callback.SecretKeyCallback.SecretKeyCallback
+ + ( Request ) +
Constructs this SecretKeyCallback with a + secret key Request object. The request object identifies the secret key to be returned. If the alias + is null, the handler of the callback relies on its own default. true
+
true
JASPIC:JAVADOC:66voidjakarta.security.auth.message.callback.SecretKeyCallback.setKey
+ + ( SecretKey ) +
Used by the CallbackHandler to set the + requested secret key within the Callback. true
+
true
JASPIC:JAVADOC:67Stringjakarta.security.auth.message.callback.SecretKeyCallback.AliasRequest.getAlias
+
Get the alias. true
+
true
JASPIC:JAVADOC:68AliasRequestjakarta.security.auth.message.callback.SecretKeyCallback.AliasRequest.SecretKeyCallback.AliasRequest
+ + ( String ) +
Construct an AliasRequest with an alias. The + alias is used to directly identify the secret key to be returned. If the alias is null, the handler + of the callback relies on its own default. true
+
true
JASPIC:JAVADOC:69KeyStorejakarta.security.auth.message.callback.TrustStoreCallback.getTrustStore
+
Used by the TrustStore user to obtain the + TrustStore set within the Callback. true
+
true
JASPIC:JAVADOC:70voidjakarta.security.auth.message.callback.TrustStoreCallback.setTrustStore
+ + ( KeyStore ) +
Used by the CallbackHandler to set the + trusted certificate keystore within the Callback. true
+
true
JASPIC:JAVADOC:71TrustStoreCallbackjakarta.security.auth.message.callback.TrustStoreCallback.TrustStoreCallback
+
Create a TrustStoreCallback. true
+
true
JASPIC:JAVADOC:72Stringjakarta.security.auth.message.config.AuthConfig.getAppContext
+
Get the application context identifier of + this authentication context configuration object. true
+
true
JASPIC:JAVADOC:73Stringjakarta.security.auth.message.config.AuthConfig.getAuthContextID
+ + ( MessageInfo ) +
Get the authentication context identifier + corresponding to the request and response objects encapsulated in messageInfo. true
+
true
JASPIC:JAVADOC:74Stringjakarta.security.auth.message.config.AuthConfig.getMessageLayer
+
Get the message layer name of this + authentication context configuration object. true
+
true
JASPIC:JAVADOC:75booleanjakarta.security.auth.message.config.AuthConfig.isProtected
+
Used to determine whether the authentication + context configuration object encapsulates any protected authentication contexts. true
+
true
JASPIC:JAVADOC:76voidjakarta.security.auth.message.config.AuthConfig.refresh
+
Causes a dynamic anthentication context + configuration object to update the internal state that it uses to process calls to its + getAuthContext method. true
+
true
JASPIC:JAVADOC:77AuthConfigFactoryjakarta.security.auth.message.config.AuthConfigFactory.AuthConfigFactory
+

+
true
+
true
JASPIC:JAVADOC:78String[]jakarta.security.auth.message.config.AuthConfigFactory.detachListener
+ + ( RegistrationListener ,
String ,
String ) +
Disassociate the listener from all the + provider registrations whose layer and appContext values are matched by the corresponding arguments + to this method. Factories should periodically notify Listeners to effectively detach listeners that + are no longer in use. true
+
true
JASPIC:JAVADOC:79AuthConfigProviderjakarta.security.auth.message.config.AuthConfigFactory.getConfigProvider
+ + ( String ,
String ,
RegistrationListener ) +
Get a registered AuthConfigProvider from the + factory. Get the provider of ServerAuthConfig and ClientAuthConfig objects registered for the + identified message layer and application context. All factories shall employ the following + precedence rules to select the registered AuthConfigProvider that matches the layer and appContext + arguments: The provider specifically registered for the values passed as the layer and appContext + arguments shall be selected. If no provider is selected according to the preceding rule, the + provider specifically registered for the value passed as the appContext argument and for all (that + is, null) layers shall be selected. If no provider is selected according to the preceding rules, the + provider specifically registered for the value passed as the layer argument and for all (that is, + null) appContexts shall be selected. If no provider is selected according to the preceding rules, + the provider registered for all (that is, null) layers and for all (that is, null) appContexts shall + be selected. If no provider is selected according to the preceding rules, the factory shall + terminate its search for a registered provider. The above precedence rules apply equivalently to + registrations created with a null or non-null className argument. true
+
true
JASPIC:JAVADOC:80AuthConfigFactoryjakarta.security.auth.message.config.AuthConfigFactory.getFactory
+
Get the system-wide AuthConfigFactory + implementation. If a non-null system-wide factory instance is defined at the time of the call, for + example, with setFactory, it will be returned. Otherwise, an attempt will be made to construct an + instance of the default AuthConfigFactory implementation class. The fully qualified class name of + the default factory implementation class is obtained from the value of the + authconfigprovider.factory security property. When an instance of the default factory implementation + class is successfully constructed by this method, this method will set it as the system-wide factory + instance. The absolute pathname of the Java security properties file is + JAVA_HOME/lib/security/java.security, where JAVA_HOME refers to the directory where the JDK was + installed. true
+
true
JASPIC:JAVADOC:81RegistrationContextjakarta.security.auth.message.config.AuthConfigFactory.getRegistrationContext
+ + ( String ) +
Get the the registration context for the + identified registration. true
+
true
JASPIC:JAVADOC:82String[]jakarta.security.auth.message.config.AuthConfigFactory.getRegistrationIDs
+ + ( AuthConfigProvider ) +
Get the registration identifiers for all + registrations of the provider instance at the factory. true
+
true
JASPIC:JAVADOC:83voidjakarta.security.auth.message.config.AuthConfigFactory.refresh
+
Cause the factory to reprocess its persisent + declarative representation of provider registrations. A factory should only replace an existing + registration when a change of provider implementation class or initialization properties has + occurred. true
+
true
JASPIC:JAVADOC:84Stringjakarta.security.auth.message.config.AuthConfigFactory.registerConfigProvider
+ + ( String ,
Map ,
String ,
String ,
String ) +
Registers within the factory and records + within the factory's persistent declarative representation of provider registrations a provider of + ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application context + identifier. This method typically constructs an instance of the provider before registering it with + the factory. Factories may extend or modify the persisted registrations of existing provider + instances, if those instances were registered with ClassName and properties arguments equivalent to + those passed in the current call. This method employs the two argument constructor required to be + supported by every implementation of the AuthConfigProvider interface, and this method must pass a + null value for the factory argument of the constructor. AuthConfigProviderImpl + AuthConfigProviderImpl(Map properties, AuthConfigFactory factory). At most one registration may + exist within the factory for a given combination of message layer and appContext. Any pre-existing + registration with identical values for layer and appContext is replaced by a subsequent + registration. When replacement occurs, the registration identifier, layer, and appContext identifier + remain unchanged, and the AuthConfigProvider (with initialization properties) and description are + replaced. Within the lifetime of its Java process, a factory must assign unique registration + identifiers to registrations, and must never assign a previously used registration identifier to a + registration whose message layer and or appContext identifier differ from the previous use. + Programmatic registrations performed by using this method must update (according to the replacement + rules described above) the persistent declarative representation of provider registrations employed + by the factory constructor. true
+
true
JASPIC:JAVADOC:85Stringjakarta.security.auth.message.config.AuthConfigFactory.registerConfigProvider
+ + ( AuthConfigProvider ,
String ,
String ,
String ) +
Registers within the (in-memory) factory, a + provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application + context identifier. This method does NOT effect the factory's persistent declarative representation + of provider registrations, and is intended to be used by providers to perform self-Registration. At + most one registration may exist within the factory for a given combination of message layer and + appContext. Any pre-existing registration with identical values for layer and appContext is replaced + by a subsequent registration. When replacement occurs, the registration identifier, layer, and + appContext identifier remain unchanged, and the AuthConfigProvider (with initialization properties) + and description are replaced. Within the lifetime of its Java process, a factory must assign unique + registration identifiers to registrations, and must never assign a previously used registration + identifier to a registration whose message layer and or appContext identifier differ from the + previous use. true
+
true
JASPIC:JAVADOC:86booleanjakarta.security.auth.message.config.AuthConfigFactory.removeRegistration
+ + ( String ) +
Remove the identified provider registration + from the factory (and from the persistent declarative representation of provider registrations, if + appropriate) and invoke any listeners associated with the removed registration. true
+
true
JASPIC:JAVADOC:87voidjakarta.security.auth.message.config.AuthConfigFactory.setFactory
+ + ( AuthConfigFactory ) +
Set the system-wide AuthConfigFactory + implementation. If an implementation was set previously, it will be replaced. Listeners are not + notified of a change to the registered factory. true
+
true
JASPIC:JAVADOC:88Stringjakarta.security.auth.message.config.AuthConfigFactory.RegistrationContext.getAppContext
+
Get the application context identifier from + the registration context true
+
true
JASPIC:JAVADOC:89Stringjakarta.security.auth.message.config.AuthConfigFactory.RegistrationContext.getDescription
+
Get the description from the registration + context true
+
true
JASPIC:JAVADOC:90Stringjakarta.security.auth.message.config.AuthConfigFactory.RegistrationContext.getMessageLayer
+
Get the layer name from the registration + context true
+
true
JASPIC:JAVADOC:91booleanjakarta.security.auth.message.config.AuthConfigFactory.RegistrationContext.isPersistent
+
Get the persisted status from the + registration context. true
+
true
JASPIC:JAVADOC:92ClientAuthConfigjakarta.security.auth.message.config.AuthConfigProvider.getClientAuthConfig
+ + ( String ,
String ,
CallbackHandler ) +
Get an instance of ClientAuthConfig from this + provider. The implementation of this method returns a ClientAuthConfig instance that describes the + configuration of ClientAuthModules at a given message layer, and for use in an identified + application context. true
+
true
JASPIC:JAVADOC:93ClientAuthConfigjakarta.security.auth.message.config.AuthConfigProvider.getClientAuthConfig
+ + ( String ,
String ,
CallbackHandler )
throws AuthException
+
If this provider does not support the + assignment of a default CallbackHandler to the returned ClientAuthConfig.true
+
true
JASPIC:JAVADOC:94ServerAuthConfigjakarta.security.auth.message.config.AuthConfigProvider.getServerAuthConfig
+ + ( String ,
String ,
CallbackHandler ) +
Get an instance of ServerAuthConfig from this + provider. The implementation of this method returns a ServerAuthConfig instance that describes the + configuration of ServerAuthModules at a given message layer, and for a particular application + context. true
+
true
JASPIC:JAVADOC:95ServerAuthConfigjakarta.security.auth.message.config.AuthConfigProvider.getServerAuthConfig
+ + ( String ,
String ,
CallbackHandler )
throws AuthException
+
If this provider does not support the + assignment of a default CallbackHandler to the returned ServerAuthConfig.true
+
true
JASPIC:JAVADOC:96voidjakarta.security.auth.message.config.AuthConfigProvider.refresh
+
Causes a dynamic configuration provider to + update its internal state such that any resulting change to its state is reflected in the + corresponding authentication context configuration objects previously created by the provider within + the current process context. true
+
true
JASPIC:JAVADOC:97ClientAuthContextjakarta.security.auth.message.config.ClientAuthConfig.getAuthContext
+ + ( String ,
Subject ,
Map ) +
Get a ClientAuthContext instance from this + ClientAuthConfig. The implementation of this method returns a ClientAuthContext instance that + encapsulates the ClientAuthModules used to secure and validate requests/responses associated with + the given authContextID. Specifically, this method accesses this ClientAuthConfig object with the + argument authContextID to determine the ClientAuthModules that are to be encapsulated in the + returned ClientAuthContext instance. The ClientAuthConfig object establishes the request and + response MessagePolicy objects that are passed to the encapsulated modules when they are initialized + by the returned ClientAuthContext instance. It is the modules' responsibility to enforce these + policies when invoked. true
+
true
JASPIC:JAVADOC:98ClientAuthContextjakarta.security.auth.message.config.ClientAuthConfig.getAuthContext
+ + ( String ,
Subject ,
Map )
throws AuthException
+
If this method fails.true
+
true
JASPIC:JAVADOC:99voidjakarta.security.auth.message.config.RegistrationListener.notify
+ + ( String ,
String ) +
Notify the listener that a registration with + which it was associated was replaced or unregistered. When a RegistrationListener is associated with + a provider registration within the factory, the factory must call its notify method when the + corresponding registration is unregistered or replaced. true
+
true
JASPIC:JAVADOC:100ServerAuthContextjakarta.security.auth.message.config.ServerAuthConfig.getAuthContext
+ + ( String ,
Subject ,
Map ) +
Get a ServerAuthContext instance from this + ServerAuthConfig. The implementation of this method returns a ServerAuthContext instance that + encapsulates the ServerAuthModules used to validate requests and secure responses associated with + the given authContextID. Specifically, this method accesses this ServerAuthConfig object with the + argument authContextID to determine the ServerAuthModules that are to be encapsulated in the + returned ServerAuthContext instance. The ServerAuthConfig object establishes the request and + response MessagePolicy objects that are passed to the encapsulated modules when they are initialized + by the returned ServerAuthContext instance. It is the modules' responsibility to enforce these + policies when invoked. true
+
true
JASPIC:JAVADOC:101ServerAuthContextjakarta.security.auth.message.config.ServerAuthConfig.getAuthContext
+ + ( String ,
Subject ,
Map )
throws AuthException
+
If this method fails.true
+
true
JASPIC:JAVADOC:102Class[]jakarta.security.auth.message.module.ClientAuthModule.getSupportedMessageTypes
+
Get the one or more Class objects + representing the message types supported by the module. true
+
true
JASPIC:JAVADOC:103voidjakarta.security.auth.message.module.ClientAuthModule.initialize
+ + ( MessagePolicy ,
MessagePolicy ,
CallbackHandler ,
Map ) +
Initialize this module with request and + response message policies to enforce, a CallbackHandler, and any module-specific configuration + properties. The request policy and the response policy must not both be null. true
+
true
JASPIC:JAVADOC:104voidjakarta.security.auth.message.module.ClientAuthModule.initialize
+ + ( MessagePolicy ,
MessagePolicy ,
CallbackHandler ,
Map )
throws + AuthException
+
If module initialization fails, including for + the case where the options argument contains elements that are not supported by the module.true
+
true
JASPIC:JAVADOC:105Class[]jakarta.security.auth.message.module.ServerAuthModule.getSupportedMessageTypes
+
Get the one or more Class objects + representing the message types supported by the module. true
+
true
JASPIC:JAVADOC:106voidjakarta.security.auth.message.module.ServerAuthModule.initialize
+ + ( MessagePolicy ,
MessagePolicy ,
CallbackHandler ,
Map ) +
Initialize this module with request and + response message policies to enforce, a CallbackHandler, and any module-specific configuration + properties. The request policy and the response policy must not both be null. true
+
true
JASPIC:JAVADOC:107voidjakarta.security.auth.message.module.ServerAuthModule.initialize
+ + ( MessagePolicy ,
MessagePolicy ,
CallbackHandler ,
Map )
throws + AuthException
+
If module initialization fails, including for + the case where the options argument contains elements that are not supported by the module.true
+
true
+ + diff --git a/tck/old-tck/source/install/jaspic/docs/assertions/JASPICSpecAssertions.html b/tck/old-tck/source/install/jaspic/docs/assertions/JASPICSpecAssertions.html new file mode 100644 index 0000000..797b9e0 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/docs/assertions/JASPICSpecAssertions.html @@ -0,0 +1,4203 @@ + + + + + +Specification Assertion Detail + + +
+
+

+ Jakarta Authentication - 2.0
Specification Assertion Detail +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
TotalsTotalActiveDeprecatedRemoved
# of Assertions 25324670
# of Required Assertions 23122470
# of Optional Assertions 222200
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDChapterSectionDescriptionRequiredDependencyImplementation SpecificDefined byStatusTestable
JASPIC:SPEC:111.1 A message processing runtime may acquire the + authentication context objects that it uses to invoke authentication modules by interacting with an + authentication context configuration object true
+
falsetechnologyactivefalse
JASPIC:SPEC:211.1 An authentication context configuration + object is an implementation of either the ClientAuthConfig or ServerAuthConfig interface as defined + by this specification. true
+
falsetechnologyactivefalse
JASPIC:SPEC:311.3 A message processing runtime may acquire + authentication context configuration objects by interacting with a provider of authentication + context configuration objects. true
+
falsetechnologyactivefalse
JASPIC:SPEC:411.4 A message processing runtime may interact + with the factory to obtain or establish the provider registered for an application context and + messaging layer. true
+
falsetechnologyactivefalse
JASPIC:SPEC:511.7 Authentication modules should be implemented + such that they may be invoked concurrently and such that they are able to apply and establish + independent security identities for concurrent invocations. true
+
falsetechnologyactivefalse
JASPIC:SPEC:611.7 In a multi-message authentication scenario, + it is the responsibility of the authentication modules involved in the authentication to tie + together or correlate the messages that comprise the authentication exchange. In addition to message + correlation to tie to together the messages required to complete an authentication, message + correlation may also be employed post-authentication such that a prior authentication result or + session may be applied to a subsequent invocation. Modules are expected to perform their message + correlation function based on the parameters of their invocation and with the benefit of any + additional facilities provided by the invoking runtime (e.g., via their CallbackHandler). true
+
falsetechnologyactivefalse
JASPIC:SPEC:721.1 A message processing runtime that wishes to + invoke authentication modules configured according to this specification, must use the + AuthConfigFactory.getFactory method to obtain a factory implementation. true
+
falsetechnologyactivetrue
JASPIC:SPEC:821.1 The runtime must invoke the getConfigProvider + method of the factory to obtain the AuthConfigProvider. The runtime must specify appropriate + (non-null) layer and application context identifiers in its call to getConfigProvider. true
+
falsetechnologyactivetrue
JASPIC:SPEC:921.1 A runtime may continue to reuse a provider + for as long as it wishes. However, a runtime that wishes to be notified of changes to the factory + that would cause the factory to return a different provider for the layer and appContext arguments + should include a (non-null) RegistrationListener as an argument in the call used to acquire the + provider. true
+
falsetechnologyactivefalse
JASPIC:SPEC:1021.1.2 The factory implementation must satisfy the + requirements defined by the AuthConfigFactory class. In particular, it must offer a public, zero + argument constructor that supports the construction and registration of AuthConfigProvider objects + from a persistent declarative representation. true
+
falsetechnologyactivetrue
JASPIC:SPEC:1121.2 Once the runtime has obtained the appropriate + (non-null) AuthConfigProvider, it must obtain from the provider the authentication context + configuration object corresponding to the messaging layer, its role as client or server, and the + application context for which it will be exchanging messages. It does this by invoking + getClientAuthConfig or getServerAuthConfig as appropriate to the role of the runtime in the message + exchange. true
+
falsetechnologyactivetrue
JASPIC:SPEC:1221.2 A runtime operating at points 1 and 4 in the + messaging model must invoke getClientAuthConfig to acquire its configuration object. true
+
falsetechnologyactivetrue
JASPIC:SPEC:1321.2 A runtime operating at points 2 and 3 in the + messaging model must invoke getServerAuthConfig to acquire its configuration object. true
+
falsetechnologyactivetrue
JASPIC:SPEC:1421.2 The call to acquire the configuration object + must specify the same values for layer and application context identifier that were used to acquire + the provider true
+
falsetechnologyactivetrue
JASPIC:SPEC:1521.2 A runtime may continue to reuse an acquired + authentication context configuration object for as long as it is acting as client or server of the + corresponding application. A runtime should reacquire an authentication context configuration object + when it is notified (via a RegistrationListener) that it must reacquire the AuthConfigProvider from + which the configuration object was acquired (and after having reacquired the provider). true
+
falsetechnologyactivefalse
JASPIC:SPEC:1621.2.2 The provider implementation must satisfy the + requirements defined by the AuthConfigProvider interface. In particular, it must return non-null + authentication configuration objects. true
+
falsetechnologyactivetrue
JASPIC:SPEC:1721.2.2 When the provider is a dynamic configuration + provider, any change to the internal state of the provider occurring as the result of a call to its + refresh method must be recognized by every authentication context configuration object obtained from + the provider. true
+
falsetechnologyactivefalse
JASPIC:SPEC:1821.2.2 The provider implementation must provide a + configuration facility that may be used to configure the information required to initialize + authentication contexts for the (one or more) authentication context configuration scopes (defined + by layer and application context) for which the provider is registered (at the factory). true
+
falsetechnologyactivefalse
JASPIC:SPEC:1921.3 At points (1) and (2) in the messaging model, + the message processing runtime must obtain the authentication context identifier corresponding to + the request message processing being performed by the runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:2021.3 The identifier may be acquired by calling the + getOperation method of the authentication context configuration object (obtained in the preceding + step). If the messaging runtime chooses to obtain the operation identifier by this means, it must + provide a MessageInfo object as argument to the getOperation call, and the MessageInfo must have + been initialized such that its getRequestMessage method will return the request message being + processed by the runtime. The type of the returned request message must be as defined by the profile + of this specification being followed by the messaging runtime. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2121.3 Alternatively and depending on the + requirements relating to operation identifier inherent in the profile being followed by the + messaging runtime, the runtime may obtain the operation identifier by other means. Where a profile + defines or facilitates other means by which a messaging runtime may acquire the operation + identifier, the identifier acquired by any such means must be equivalent to the identifier that + would be acquired by calling getOperation as described above. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2221.3.2 The configuration implementation must satisfy + the requirements defined by the AuthConfig interface with respect to the getOperation method. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2321.4 At points (1) and (2) in the messaging model, + the message processing runtime must invoke the getAuthContext method of the authentication context + configuration object (obtained in step 2) to obtain the authentication context object corresponding + to the message that is to be processed. This is accomplished by invoking getAuthContext with the + operation/message identifier corresponding to the request message and obtained as described above. true
+
falsetechnologyactivetrue
JASPIC:SPEC:2421.4 If required by the profile of this + specification being followed by the runtime, the call to getAuthContext must pass a Map containing + the required property elements. The value of the Subject argument provided by the runtime in its + call to getAuthContext must correpond to the requirements of the profile of this specification being + followed by the runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:2521.4 Once an authentication context is acquired, + it may be reused to process subsequent requests of the application for which an equivalent + authentication context identifier, Subject, and properties Map (as used in the getAuthContext) + applies. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2621.4 Runtimes that wish to be dynamic with respect + to changes in context configuration, should call getAuthContext for every request. An authentication + context configuration object may return the same authentication context object for different + authentication context identifiers for which the same module configuration and message protection + policy applies. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2721.4 At points (3) and (4) in the messaging model, + the runtime may repeat the context acquisition performed at point (2) and (1) respectively, or it + may reuse the previously acquired context. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2821.4 The configuration implementation must satisfy + the requirements defined by the corresponding ClientAuthConfig or ServerAuthConfig interface with + respect to the getAuthContext method. In this regard, the configuration implementation must + determine the authentication modules that are to comprise the acquired context, and it must provide + the context implementation with sufficient information to initialize the modules of the context. true
+
falsetechnologyactivefalse
JASPIC:SPEC:2921.4 The getAuthContext method must return null + when no authentication modules are to be invoked for an identified authentication context at the + layer and application context represented by the configuration object true
+
falsetechnologyactivetrue
JASPIC:SPEC:3021.4 The AuthConfigProvider from which the + authentication context configuration object was acquired must provide a configuration facility by + which the information required to initialize authentication contexts may be configured and + associated with one or more authentication context identifiers within the (one or more) layer and + application context scopes for which the provider is registered (at the factory). true
+
falsetechnologyactivefalse
JASPIC:SPEC:3121.5 Every context implementation must satisfy the + requirements as defined by the corresponding ClientAuthContext or ServerAuthContext interface. true
+
falsetechnologyactivefalse
JASPIC:SPEC:3221.5 Every context must delegate calls made to the + methods of its corresponding ClientAuth or ServerAuth interface to the corresponding methods of its + one or more authentication modules. true
+
falsetechnologyactivefalse
JASPIC:SPEC:3321.5 When a context encapsulates multiple + authentication modules, the context must embody the control logic to determine which modules of the + context are to be invoked and in what order. Contexts which encapsulate alternative sufficient + modules, must ensure that the same message values are passed to each invoked alternative of the + context. When a context invokes multiple authentication modules, the context must combine the + AuthStatus values returned by the invoked authentication modules to establish the AuthStatus value + returned by the context to the messaging runtime. The context implementation must define the logic + for combining the returned AuthStatus values. true
+
falsetechnologyactivefalse
JASPIC:SPEC:3421.5 If a non-null authentication context object + is returned by getAuthContext, the corresponding message processing runtime must invoke the methods + of the acquired authentication context to process the corresponding request and response messages as + defined below. Otherwise, the message processing runtime, must proceed with its normal processing of + the corresponding messages and without invoking the methods of an authentication context object. true
+
falsetechnologyactivefalse
JASPIC:SPEC:3521.5 At point (1) in the message processing model + : the message processing runtime must call the secureRequest method of the ClientAuthContext. true
+
falsetechnologyactivetrue
JASPIC:SPEC:3621.5 (At point 1 in message processing model) The + messageInfo argument to the call must have been initialized such that its getRequestMessage method + will return the request message being processed by the runtime. The type of the returned request + message must be as defined by the profile being followed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:3721.5 (At point 1 in message processing model) If a + non-null Subject was used to acquire the ClientAuthContext, the same Subject must be passed as the + clientSubject in this call. If a non-null clientSubject is used in this call, it must not be + read-only, and the same clientSubject argument must be passed in all calls to validateResponse made + for the one or more responses processed to complete the message exchange. true
+
falsetechnologyactivetrue
JASPIC:SPEC:3821.5 (At point 1 in message processing model) If + the call to secureRequest returns: AuthStatus.SEND_SUCCESS - the runtime should send (without + calling secureRequest) the request message acquired by calling messageInfo.getRequestMessage. After + sending the request, the runtime should proceed to point (4) in the message processing model (to + receive and validate the response). true
+
falsetechnologyactivefalse
JASPIC:SPEC:3921.5 (At point 1 in message processing model) If + the call to secureRequest returns: AuthStatus.SEND_CONTINUE - the module has returned, in + messageInfo, an initial request message to be sent. Moreover, the module is informing the client + runtime that it will be required to continue the message dialog by sending the message resulting + from validation of the response to the initial message. If the runtime will be unable to continue + the dialog by sending the message resulting from validation of the response, the runtime must not + send the initial request and it must convey its inability by returning an error to the client + application. Otherwise, the runtime should send (without calling secureRequest) the request message + acquired by calling messageInfo.getRequestMessage. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4021.5 (At point 1 in message processing model) If + the call to validateRequest returns: AuthStatus.FAILURE (Befor service Invocation) - The runtime + should return an error to the client application. The runtime should derive the returned error from + the response message acquired by calling messageInfo.getResponseMessage. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4121.5 (At point 1 in message processing model) If + the call to secureRequest throws an AuthException - the runtime should use the exception to convey + to the client runtime that the request failed. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4221.5 At point (4) in the message processing model: + the message processing runtime must call the validateResponse method of the ClientAuthContext. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4321.5 In the call made to validateResponse, the + runtime must pass the same MessageInfo instance that was passed to secureRequest (at the start of + the message exchange). The messageInfo argument must have been initialized such that its + getResponseMessage method will return the response message being processed by the runtime.The type + of the required return messages must be as defined by the profile being followed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:4421.5 The value of the clientSubject argument to + the (validateResponse) call must be the same as that passed in the call to secureRequest for the + corresponding request. true
+
falsetechnologyactivetrue
JASPIC:SPEC:4521.5 The serviceSubject argument to the + (validateResponse) call may be non-null, in which it may be used by modules to store Principals and + credentials determined to pertain to the source of the response. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4621.5 If the call to validateResponse returns: + AuthStatus.SUCCESS - The runtime should use the response message acquired by calling + messageInfo.getResponseMessage.to create the return value to be returned to the client. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4721.5 If the call to validateResponse returns: + AuthStatus.SEND_CONTINUE - if the runtime it is unable to process this status value it must return + an error to the client application indicating its inability to process this status value. To process + this status value, the runtime must send (without calling secureRequest) the (continuation) request + message obtained by calling messageInfo.getRequestMessage, and it must receive and process via + validateResponse (at least) the next corresponding response or error (before returning a value to + the client). true
+
falsetechnologyactivetrue
JASPIC:SPEC:4821.5 If the call to validateResponse returns: + AuthStatus.FAILURE- the runtime should return an error to the client application. The runtime should + derive the returned error from the response message acquired by calling + messageInfo.getResponseMessage. true
+
falsetechnologyactivefalse
JASPIC:SPEC:4921.5 If the call to validateResponse throws an + AuthException - runtime should use the exception to convey to the client runtime that the request + failed. true
+
falsetechnologyactivefalse
JASPIC:SPEC:5021.5 At point (2) in the message processing model: + the message processing runtime must call the validateRequest method of the ServerAuthContext. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5121.5 (at point 2 in MPR model) The messageInfo + argument to the call must have been initialized such that its getRequestMessage method will return + the request message being processed by the runtime. For some profiles of this specification, the + runtime must also initialize messageInfo such that its getResponseMessage method will return the + response message being processed by the runtime. The type of the required return messages must be as + defined by the profile being followed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5221.5 (At point (2) in the message processing + model) The clientSubject argument must be non-null and it must not be read-only. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5321.5 (At point (2) in the message processing + model) If a non-null Subject was used to acquire the ServerAuthContext, the same Subject must be + passed as the serviceSubject in this call. true
+
falsetechnologyactivetrue
JASPIC:SPEC:31321.5.2 (At point (2) in the message processing + model) If a non-null serviceSubject is used in this call, it must not be read-only. true
+
falsetechnologyactivetrue
JASPIC:SPEC:31421.5.2 (At point (2) in the message processing + model) the same serviceSubject must be passed in the call to secureResponse for the corresponding + response (if there is one). true
+
falsetechnologyactivefalse
JASPIC:SPEC:5421.5 If the call to validateRequest returns: + AuthStatus.SUCCESS - the runtime should proceed to authorize the request using the clientSubject, + perform the application request processing (depending on the authorization result), and proceed to + point (3) as appropriate. true
+
falsetechnologyactivefalse
JASPIC:SPEC:5521.5 If the call to validateRequest returns: + AuthStatus.SEND_SUCCESS - The runtime must NOT proceed to authorize the request or perform the + application request processing. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5621.5 If the call to validateRequest returns: + AuthStatus.SEND_CONTINUE - The runtime must NOT proceed to authorize the request or perform the + application request processing. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5721.5 If the call to validateRequest returns: + AuthStatus.SEND_FAILURE - (If the failure occurred after the service invocation), the runtime must + perform whatever processing it requires to complete the processing of a request that failed after a + successful service invocation, and prior to communicating the invocation result to the client + runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:31521.5 If the call to validateRequest returns: + AuthStatus.SEND_FAILURE - (If the failure occurred befor the service invocation), the runtime must + NOT proceed to authorize the request or perform the application request processing. true
+
falsetechnologyactivetrue
JASPIC:SPEC:5821.5 If the call to validateRequest throws an + AuthException (Befor Service Invocation) - the runtime must NOT proceed to authorize the request or + perform the application request processing. true
+
falsetechnologyactivetrue
JASPIC:SPEC:31621.5 If the call to validateRequest throws an + AuthException - (If the failure occurred after the service invocation) the runtime must perform + whatever processing it requires to complete the processing of a request that failed after a + successful service invocation, and prior to communicating the invocation result to the client + runtime. true
+
falsetechnologyactivefalse
JASPIC:SPEC:5921.5 At point (3) in the message processing model: + the message processing runtime must call the secureResponse method of the ServerAuthContext. true
+
falsetechnologyactivetrue
JASPIC:SPEC:6021.5 In the call made to secureResponse, the + runtime must pass the same MessageInfo instance that was passed to validateRequest (for the + corresponding request message). The messageInfo argument must have been initialized such that its + getResponseMessage method will return the response message being processed by the runtime. The type + of the required return messages must be as defined by the profile being followed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:6121.5 The value of the serviceSubject argument to + the (secureResponse) call must be the same as that passed in the call to validateRequest for the + corresponding request. true
+
falsetechnologyactivetrue
JASPIC:SPEC:6221.5 If the call to secureResponse returns: + AuthStatus.SEND_SUCCESS - the runtime should send (without calling secureResponse) the response + message acquired by calling messageInfo.getResponseMessage at which time, the processing of the + application request and its corresponding response will be complete. true
+
falsetechnologyactivefalse
JASPIC:SPEC:6321.5 If the call to secureResponse returns: + AuthStatus.SEND_CONTINUE - the runtime should send (without calling secureResponse) the response + message acquired by calling messageInfo.getResponseMessage. The processing of the response is not + finished, and as such, its outcome is not yet known. true
+
falsetechnologyactivefalse
JASPIC:SPEC:6421.5 If the call to secureResponse returns: + AuthStatus.SEND_FAILURE - the runtime must perform whatever processing it requires to complete the + processing of a request that failed after (or during) service invocation, and prior to communicating + the invocation result to the client runtime. This may include sending (without calling + secureResponse) the response message acquired by calling messageInfo.getResponseMessage. true
+
falsetechnologyactivefalse
JASPIC:SPEC:6521.5 If the call to secureResponse throws an + AuthException - the runtime must perform whatever processing it requires to complete the processing + of a request that failed after (or during) service invocation, and prior to communicating the + invocation result to the client runtime. the runtime may send (without calling secureResponse) an + appropriate response message of its choice. if a failure message is returned, it should indicate + that the failure in request processing occurred after the successful invocation of the service. true
+
falsetechnologyactivefalse
JASPIC:SPEC:6621.5 The authentication module implementations + within the context must satisfy the requirements as defined by the corresponding ClientAuthModule or + ServerAuthModule interface. true
+
falsetechnologyactivefalse
JASPIC:SPEC:6731 The message layer value used to select the + AuthConfigProvider and ServerAuthConfig objects for this (servlet) profile must be HttpServlet true
+
falsetechnologyactivetrue
JASPIC:SPEC:6832 The application context identifier (that is, + the appContext parameter value) used to select the AuthConfigProvider and ServerAuthConfig objects + for a specific application shall be the String value constructed by concatenating the host name, a + blank separator character, and the decoded context path corresponding to the web module. true
+
falsetechnologyactivetrue
JASPIC:SPEC:6933 The MessageInfo argument used in any call + made by the message processing runtime to validateRequest or secureResponse must have been + initialized such that the non-null objects returned by the getRequestMessage and getResponseMessage + methods of the MessageInfo are an instanceof HttpServletRequest and HttpServletResponse, + respectively. true
+
falsetechnologyactivetrue
JASPIC:SPEC:7034 The getSupportedMessageTypes method of all + authentication modules integrated for use with this profile, must include + jakarta.servlet.http.HttpServletRequest.class and jakarta.servlet.http.HttpServeletResponse.class in + its return value. true
+
falsetechnologyactivefalse
JASPIC:SPEC:7135 The CallbackHandler passed to + ServerAuthModule.initialize is determined by the handler argument passed in the + AuthConfigProvider.getServerAuthConfig call that acquired the corresponding authentication context + configuration object. The handler argument must not be null. true
+
falsetechnologyactivefalse
JASPIC:SPEC:7235 The CallbackHandler passed to + ServerAuthModule.initialize must support the following callbacks: CallerPrincipalCallback, + GroupPrincipalCallback, PasswordValidationCallback. true
+
falsetechnologyactivetrue
JASPIC:SPEC:7335 The argument handler and the CallbackHandler + passed through to the authentication modules must be initialized with any application context + required to process its supported callbacks on behalf of the corresponding application. true
+
falsetechnologyactivefalse
JASPIC:SPEC:31836 The factory implementation returned by + calling the getFactory method of the abstract AuthConfigFactory class must have been configured such + that it returns a non-null AuthConfigProvider for those application contexts for which pluggable + authentication modules have been configured at the ?HttpServlet? layer. true
+
falsetechnologyactivefalse
JASPIC:SPEC:7436 For each application context for which it is + servicing requests, the runtime must call getConfigProvider to acquire the provider object + corresponding to the layer and application context. The layer and appContext arguments to + getConfigProvider must be as defined in Section 3.1, Message Layer Identifier and Section 3.2, + Application Context Identifier respectively true
+
falsetechnologyactivetrue
JASPIC:SPEC:7536 If a non-null AuthConfigProvider is returned, + the messaging runtime must call getServerAuthConfig on the provider to obtain the authentication + context configuration object pertaining to the application context at the layer. The layer and + appContext arguments of the call to getServerAuthConfig must be the same as those used to acquire + the provider, and the handler argument must be as defined in Section 3.5, CallbackHandler + Requirements. true
+
falsetechnologyactivetrue
JASPIC:SPEC:7636 A null return value from getConfigProvider + indicates that pluggable authentication modules have not been configured at the layer for the + application context and that the messaging runtime must proceed to perform its servlet security + constraint processing without reliance on this profile. true
+
falsetechnologyactivefalse
JASPIC:SPEC:7737 When a non-null AuthConfigProvider is + returned by the factory, the provider must have been configured with the information required to + initialize the authentication contexts for the (one or more) authentication context configuration + scopes (defined by layer and application context) for which the provider is registered (at the + factory). true
+
falsetechnologyactivetrue
JASPIC:SPEC:7837 When a non-null AuthConfigProvider is + returned by the factory, the messaging runtime must call getAuthContext on the authentication + context configuration object (obtained from the provider). true
+
falsetechnologyactivetrue
JASPIC:SPEC:7937 For all values of the authContextID argument + that satisfy the requirements of Section 3.7.1, the call to getAuthContext must return a non-null + authentication context. true
+
falsetechnologyactivetrue
JASPIC:SPEC:8037.1 the authentication context identifier used in + the call to getAuthContext must be equivalent to the value that would be acquired by calling + getAuthContextID with the MessageInfo that will be used in the call to validateRequest. true
+
falsetechnologyactivetrue
JASPIC:SPEC:8137.2 A null value may be passed as the Subject + argument in the getAuthContext call. true
+
falsetechnologyactivefalse
JASPIC:SPEC:30037.2 If the runtime is a Jakarta Authorization compatible + Servlet container, the properties argument passed in all calls to getAuthContext must contain the + following key-value pair: (key) jakarta.security.jacc.PolicyContext (value) The PolicyContext + identifier value that the container must set. true
+
falsetechnologyactivetrue
JASPIC:SPEC:8337.3 When the runtime is not a Jakarta Authorization compatible + Servlet container, the properties argument used in all calls to getAuthContext must not include a + jakarta.security.jacc.PolicyContext key-value pair, and a null value may be passed for the + properties argument. true
+
falsetechnologyactivefalse
JASPIC:SPEC:8437.4 Each ServerAuthContext obtained via + getAuthContext must initialize its encapsulated ServerAuthModule objects with a non-null value for + requestPolicy. The encapsulated authentication modules may be initialized with a null value for + responsePolicy. true
+
falsetechnologyactivefalse
JASPIC:SPEC:8537.4 The requestPolicy used to initialize the + authentication modules of the ServerAuthContext must be constructed such that the value obtained by + calling isMandatory on the requestPolicy accurately reflects whether (i.e., true return value) or + not (i.e, false return value) authentication is required to access the web resource corresponding to + the HttpServletRequest to which the ServerAuthContext will be applied. true
+
falsetechnologyactivefalse
JASPIC:SPEC:8637.4 The message processing runtime is responsible + for determining if authentication is required and must convey the results of its determination as + described in Section 3.8.1, 'MessageInfo Requirements,' on page 29. true
+
falsetechnologyactivefalse
JASPIC:SPEC:8737.4 Calling getTargetPolicies on the request + MessagePolicy must return an array containing at least one TargetPolicy whose ProtectionPolicy will + be interpreted by the modules of the context to mean that the source of the corresponding targets + within the message is to be authenticated. To that end, calling the getID method on the + ProtectionPolicy must return one of the following values: ProtectionPolicy.AUTHENTICATE_SENDER, + ProtectionPolicy.AUTHENTICATE_CONTENT true
+
falsetechnologyactivetrue
JASPIC:SPEC:8838 At point (2) in the message processing model, + the runtime must call validateRequest on the ServerAuthContext. true
+
falsetechnologyactivetrue
JASPIC:SPEC:8938 If the request has satisfied the connection + requirements, the message processing runtime must call validateRequest independent of whether or not + access to the resource would be authorized prior to the call to validateRequest. validateRequest + must be called for all requests, including requests to a form-based login form. true
+
falsetechnologyactivetrue
JASPIC:SPEC:9038 If the call to validateRequest returns + AuthStatus.SUCCESS, the runtime must establish return values for getUserPrincipal, getRemoteUser, + and getAuthType as defined in Section 3.8.4. true
+
falsetechnologyactivetrue
JASPIC:SPEC:30138 If the applicable requestPolicy indicates + that authentication is NOT required, the runtime may choose to continue the invocation of the + resource under the runtime?s representation of the unauthenticated caller identity. A runtime must + not choose to continue the invocation if the HttpServletResponse.isCommitted() returns true. true
+
falsetechnologyactivefalse
JASPIC:SPEC:9138 In a Jakarta Authorization compatible runtime, the identity + must be comprised of exactly the Principal objects of the clientSubject. true
+
falsetechnologyactivefalse
JASPIC:SPEC:9238 In a non-Jakarta Authorization compatible Servlet runtime, + the identity must include the caller Principal (established during the validateRequest processing + using the corresponding CallerPrincipalCallback). (and may include any of the Principal objects of + the clientSubject.) true
+
falsetechnologyactivetrue
JASPIC:SPEC:9338 If the request is not authorized, the runtime + must return the HTTP status code required by the Servlet spec. true
+
falsetechnologyactivetrue
JASPIC:SPEC:31738 The request must be dispatched to the + resource if the request was determined to be authorized; otherwise it must NOT be dispatched and the + runtime must proceed to point (3) in the message processing model. true
+
falsetechnologyactivetrue
JASPIC:SPEC:30238 If the request is dispatched to the resource + and the resource invocation throws an exception to the runtime, the runtime must set, within the + response, an HTTP status code which satisfies any applicable requirements defined within the servlet + specification. true
+
falsetechnologyactivefalse
JASPIC:SPEC:30338 If the request is dispatched to the resource, + and the resource was configured to run-as its caller, then for invocations originating from the + resource where caller propagation is required, the identity established using the + CallerPrincipalCallback must be used as the propagated identity true
+
falsetechnologyactivetrue
JASPIC:SPEC:9438 The call to secureResponse must not be made + if the resource throws an exception to the calling runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:30438 If invocation of the resource completes + without throwing an exception, the runtime must proceed to point (3) in the message processing + model. true
+
falsetechnologyactivetrue
JASPIC:SPEC:30538 At point (3) in the message processing model, + the runtime must call secureResponse on the same ServerAuthContext used in the corresponding call to + validateRequest and with the same MessageInfo object. true
+
falsetechnologyactivetrue
JASPIC:SPEC:9538.1 The messageInfo argument used in the call to + validateRequest must have been initialized by the runtime such that its getRequestMessage and + getResponseMessage methods will return the HttpServletRequest and HttpServletResponse objects + corresponding to the messages (respectively) being processed by the runtime. This must be the case + even when the target of the request is a static page (that is, not a servlet). true
+
falsetechnologyactivetrue
JASPIC:SPEC:30638.1.1 This profile requires that the message + processing runtime conditionally establish the following key-value pair within the Map of the + MessageInfo object passed in the calls to getAuthContextID, validateRequest, and secureResponse. + (key) jakarta.security.auth.message.MessagePolicy.isMandatory (val) Any non-null String value, s, + for which Boolean.valueOf(s).booleanValue() == true. The MessageInfo map must contain this key and + its associated value, if and only if authentication is required to perform the resource access + corresponding to the HttpServletRequest to which the ServerAuthContext will be applied. true
+
falsetechnologyactivetrue
JASPIC:SPEC:30738.1.1 Authentication is required if use of the HTTP + method of the HttpServletRequest at the resource identified by the HttpServletRequest is covered by + a Servlet auth-constraint, or in a Jakarta Authorization compatible runtime, if the corresponding + WebResourcePermission is NOT granted2 to an unauthenticated caller true
+
falsetechnologyactivefalse
JASPIC:SPEC:31938.1.1 In a Jakarta Authorization compatible runtime, the + corresponding WebResourcePermission may be constructed directly from the HttpServletRequest as + follows: public WebResourcePermission(HttpServletRequest request); The authentication context + configuration system must use the value of this property to establish the corresponding value within + the requestPolicy passed to the authentication modules of the ServerAuthContext acquired to process + the MessageInfo.t true
+
falsetechnologyactivefalse
JASPIC:SPEC:9638.2 A new clientSubject must be instantiated and + passed in the call to validateRequest. true
+
falsetechnologyactivetrue
JASPIC:SPEC:9738.3 validateRequest may be called either before + the service invocation (to establish the caller identity) or after the service invocation (when a + multi-message dialog is required to secure the response). The module implementation is responsible + for recording any state and performing any processing required to differentiate these two different + types of calls to validateRequest. true
+
falsetechnologyactivefalse
JASPIC:SPEC:9838.3.1 When validateRequest is called before the + service invocation on a module initialized with a mandatory requestPolicy (as defined by the return + value from requestPolicy.isMandatory()), the module must only return AuthStatus.SUCCESS if it was + able to completely satisfy the request authentication policy. In this case, the module (or its + context) must also have used the CallbackHandler passed to it by the runtime to handle a + CallerPrincipalCallback using the clientSubject as argument to the callback. If more than one module + of a context uses the CallbackHandler to handle this callback, the context is responsible for + coordinating the calls such that the appropriate caller principal value is established. true
+
falsetechnologyactivetrue
JASPIC:SPEC:9938.3.1 If the module was not able to completely + satisfy the request authentication policy, it must: return AuthStatus.SEND_CONTINUE - if it has + established a response (available to the runtime by calling messageInfo.getResponseMessage) that + must be sent by the runtime for the request validation to be effectively continued by the client. + The module must have set the HTTP status code of the response to a value (e.g., HTTP 401 + unauthorized, HTTP 303 see other, or HTTP 307 temporary redirect) that will indicate to the client + that it should retry the request. true
+
falsetechnologyactivefalse
JASPIC:SPEC:10038.3.1 If the module was not able to completely + satisfy the request authentication policy, it must: return AuthStatus.SEND_FAILURE - if the request + validation failed, and when the client should not retry the request. The module must have + established a response message (available to the runtime by calling messageInfo.getResponseMessage) + that may be sent by the runtime to inform the client that the request failed. The module must have + set the HTTP status code of the response to a value (e.g., HTTP 403 forbidden or HTTP 404 not found) + that will indicate to the client that it should NOT retry the request. The runtime may choose not to + send a response message, or to send a different response message (given that it also contains an + analogous HTTP status code). true
+
falsetechnologyactivefalse
JASPIC:SPEC:10138.3.1 If the module was not able to completely + satisfy the request authentication policy, it must: throw an AuthException - if the request + validation failed, and when the client should not retry the request, and when the module has not + defined a response, to be sent by the runtime. If the runtime chooses to send a response, it must + define the HTTP status code and descriptive content (of the response). The HTTP status code of the + response must indicate to the client (e.g., HTTP 403 forbidden, HTTP 404 not found, or HTTP 500 + internal server error) that the request failed and that it should NOT be retried. The decriptive + content set in the response may be obtained from the AuthException. true
+
falsetechnologyactivefalse
JASPIC:SPEC:10238.3.1 When validateRequest is called before the + service invocation on a module that was initialized with an optional requestPolicy (i.e., + requestPolicy.isMandatory() returns false), the module should attempt to satisfy the request + authentication policy, but it must do so without requiring additional messages or interactions + involving the client. true
+
falsetechnologyactivefalse
JASPIC:SPEC:10338.3.1 If the module returns AuthStatus.SUCCESS (and + the authentication policy was satisfied), the module (or its context) must employ a + CallerPrincipalCallback. If the authentication policy was not satisfied, and yet the module chooses + to return AuthStatus.SUCCESS, the module (or its context) must use a CallerPrincipalCallback to + establish the containers representation of the unauthenticated caller within the clientSubject. true
+
falsetechnologyactivetrue
JASPIC:SPEC:32038.3.1 If the module throws an AuthException, or + returns any value other that AuthStatus.SUCCESS, the runtime must NOT proceed to the service + invocation. The runtime must process an AuthException as described above for a request with a + mandatory requestPolicy. true
+
falsetechnologyactivetrue
JASPIC:SPEC:10438.3.2 When validateRequest is called after the + service invocation, the module must return AuthStatus.SEND_SUCCESS when the module has successfully + secured the application response message and made it available through + messageInfo.getResponseMessage. The module must have set the HTTP status code within the response to + HTTP 200 (OK). For the request to be successfully completed, the runtime must send the response + message returned by the module. true
+
falsetechnologyactivefalse
JASPIC:SPEC:10538.3.2 If the module returns + AuthStatus.SEND_FAILURE, it must have established a response message in messageInfo, and it must + have set the HTTP status code within the response to HTTP 500 (internal server error). The runtime + may choose not to send a response message, or to send a different response message (given that it + also contains an HTTP 500 status code). true
+
falsetechnologyactivefalse
JASPIC:SPEC:10638.3.2 When the module throws an AuthException, the + runtime may chose not to send a response. If the runtime sends a response, the runtime must set the + HTTP status code to HTTP 500 (internal server error), and the runtime must define the decriptive + content of the response (perhaps by obtaining it from the AuthException). true
+
falsetechnologyactivefalse
JASPIC:SPEC:10738.3.2 The module must return + AuthStatus.SEND_CONTINUE if the response dialog is to continue. This status value is used to inform + the calling runtime that, to successfully complete the response processing, it will need to be + capable of continuing the message dialog by processing at least one additional request/response + exchange (after having sent the response message returned in messageInfo). The module must have + established (in messageInfo) a response message that will cause the client to continue the response + processing (i.e., retry the request). For the response processing to be successfully completed, the + runtime must send the response message returned by the module. true
+
falsetechnologyactivefalse
JASPIC:SPEC:10838.3.3 When secureResponse is called on a module + that was initialized with an undefined responsePolicy (i.e., responsePolicy == null), the module + must return AuthStatus.SUCCESS. Otherwise, the AuthStatus return value and AuthException semantics + of secureResponse are as defined in Section 3.8.3.2, validateRequest After Service Invocation. true
+
falsetechnologyactivefalse
JASPIC:SPEC:30838.3.4 A ServerAuthModule must only call + MessageInfo.setResponseMessage() to wrap or unwrap the existing response within MessageInfo. true
+
falsetechnologyactivefalse
JASPIC:SPEC:30938.3.4 During secureResponse processing, a + ServerAuthModule must unwrap the messages in MessageInfo that it wrapped during its validateRequest + processing. The unwrapped values must be established in MessageInfo when secureResponse returns. true
+
falsetechnologyactivefalse
JASPIC:SPEC:31038.3.4 During validateRequest processing, a + ServerAuthModule must NOT unwrap a message in MessageInfo, and must NOT establish a wrapped message + in MessageInfo unless the ServerAuthModule returns AuthStatus.SUCCESS. true
+
falsetechnologyactivefalse
JASPIC:SPEC:31138.3.4 When a ServerAuthModule returns a wrapped + message in MessageInfo, or unwraps a message in MessageInfo, the message processing runtime must + ensure that the HttpServletRequest and HttpServletResponse objects established by the + ServerAuthModule are used in downstream processing. true
+
falsetechnologyactivefalse
JASPIC:SPEC:32138.4 The message processing runtime must fulfill + the requirements defined in this section when, at point (2) in the messaging model, validateRequest + returns AuthStatus.SUCCESS. In this case, the runtime must modify the HttpServletRequest as + necessary to ensure that the Principal returned by getUserPrincipal and the String returned by + getRemoteUser correspond, respectively, to the Principal established by validateRequest (via the + CallerPrincipalCallback) and to the String obtained by calling getName on the established Principal. + (Except when getUserPrincipal returns null; in which case the value returned by getRemoteUser must + be null) true
+
falsetechnologyactivetrue
JASPIC:SPEC:32238.4 The runtime must also ensure that the value + returned by calling getAuthType on the HttpServletRequest is consistent in terms of being null or + non-null with the value returned by getUserPrincipal. true
+
falsetechnologyactivefalse
JASPIC:SPEC:32338.4 When getAuthType is to return a non-null + value, the runtime must consult the Map of the MessageInfo object used in the call to + validateRequest to determine if it contains an entry for the key identified in the following table. + If the Map contains an entry for the key, the runtime must obtain (from the Map) the value + corresponding to the key and establish it as the getAuthType return value. (from Table 2-2, the + key=jakarta.servlet.http.authType and the value=a non-null String value) true
+
falsetechnologyactivetrue
JASPIC:SPEC:32438.4 (When getAuthType is to return a non-null + value, the runtime must consult the Map of the MessageInfo object used in the call to + validateRequest to determine if it contains an entry for the key identified in the following table.) + If the Map does not contain an entry for the key, and an auth-method is defined in the login-config + element of the deployment descriptor for the web application, the runtime must establish the value + from the auth-method as the value returned by getAuthType. true
+
falsetechnologyactivetrue
JASPIC:SPEC:32538.4 (When getAuthType is to return a non-null + value, the runtime must consult the Map of the MessageInfo object used in the call to + validateRequest to determine if it contains an entry for the key identified in the following table.) + If the Map does not contain an entry for the key, and the deployment descriptor does not define an + auth-method, the runtime must establish a non-null value of its choice as the value returned by + getAuthType. true
+
falsetechnologyactivetrue
JASPIC:SPEC:10940 This profile is composed of two internal + profiles that partition the requirements of the profile into those that must be satisfied by client + runtimes and those that must be satisfied by server runtimes. This profile is equally applicable to + SOAP versions 1.1 and 1.2. true
+
falsetechnologyactivefalse
JASPIC:SPEC:11041 The message layer value used to select the + AuthConfigProvider and ServerAuthConfig objects for this profile must be SOAP true
+
falsetechnologyactivetrue
JASPIC:SPEC:11142 The application context identifier (i.e., the + appContext parameter value) used by a client runtime to select the AuthConfigProvider, + ClientAuthConfig objects pertaining to a client-side application context configuration scope must be + as defined in Section 4.8.1. Similarly the application context identifier used by a server runtime + to select the AuthConfigProvider and ClientAuthConfig objects pertaining to an server-side + application context configuration scope must be defined in Section 4.9.1 true
+
falsetechnologyactivetrue
JASPIC:SPEC:11243 The MessageInfo argument used in any call + made by the message processing runtime to secureRequest, validateResponse, validateRequest, or + secureResponse must have been initialized such that the non-null objects returned by the + getRequestMessage and getResponseMessage methods of the MessageInfo are an instanceof + jakarta.xml.soap.SOAPMessage. true
+
falsetechnologyactivetrue
JASPIC:SPEC:11344 The getSupportedMessageTypes method of all + authentication modules integrated for use with this profile, must include + jakarta.xml.soap.SOAPMessage.class in its return value. true
+
falsetechnologyactivetrue
JASPIC:SPEC:11445 The CallbackHandler passed to an + authentication module's initialize method is determined by the handler argument passed in the call + to AuthConfigProvider.getClientAuthConfig or getServerAuthConfig that acquired the corresponding + authentication context configuration object. The handler argument must not be null, and the argument + handler and the CallbackHandler passed to the initialize method of an authentication modules should + support the following callbacks, and it must be possible to configure the runtime such that the + CallbackHandler passed at module initialization supports the following callbacks (in addition to any + others required to be supported by the applicable internal profile): CertStoreCallback, + PrivateKeyCallback, SecretKeyCallback, TrustStoreCallback true
+
falsetechnologyactivetrue
JASPIC:SPEC:11545 The CallbackHandler must be initialized with + any application context required to process the supported callbacks on behalf of the corresponding + application. true
+
falsetechnologyactivefalse
JASPIC:SPEC:11646 The factory implementation returned by + calling the getFactory method of the abstract AuthConfigFactory class must have been configured such + that it returns a non-null AuthConfigProvider for those application contexts for which pluggable + authentication modules have been configured at the SOAP layer. true
+
falsetechnologyactivetrue
JASPIC:SPEC:11746 For each application context for which it is + servicing requests, the runtime must call getConfigProvider to acquire the provider object + corresponding to the layer and application context. The layer and appContext arguments to + getConfigProvider must be as defined in Section 4.1, Message Layer Identifier and Section 4.2, + Application Context Identifier respectively. true
+
falsetechnologyactivetrue
JASPIC:SPEC:11846 A null return value from getConfigProvider + indicates that pluggable authentication modules have not been configured at the layer for the + application context and that the messaging runtime must proceed to perform its SOAP message + processing without reliance on this profile. true
+
falsetechnologyactivetrue
JASPIC:SPEC:11947 In cases where a runtime chooses to delegate + authentication session management to authentication contexts and their contained authentication + modules, the AuthConfigPrivider must have been configured, as described in Section 2.1.2.2, What the + Provider Must Do, to return non-null authentication contexts for all operation identifiers, + independent of whether or not the corresponding operation is protected. true
+
falsetechnologyactivefalse
JASPIC:SPEC:12047.1 If getOperation returns a non-null operation + identifier, then the operation identifier must be the String value corresponding to the operation + name appearing in the service description (i.e., WSDL). true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:12147.1 As defined in Section 2.1.3, “Acquire + AuthContext Identifier,” on page 17, the authentication context identifier used in the call to + getAuthContext must be equivalent to the value that would be acquired by calling getAuthContextID + with the MessageInfo that will be used in the corresponding call to secureRequest (by a client + runtime) or validateRequest (by a server runtime). true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:12247.2 Each authentication context object obtained + via getAuthContext must initialize its encapsulated authentication modules with a non-null + requestPolicy and/or a non-null responsePolicy; such that at least one of requestPolicy or + responsePolicy is not null. true
+
falsetechnologyactivetrue
JASPIC:SPEC:12348.1 Unless the client runtime is embedded in a + server runtime (e.g.; an invocation of a web service by a servlet running in a Servlet container), + The CallbackHandler passed to ClientAuthModule.initialize must support the following callbacks: + NameCallback, PasswordCallback true
+
falsetechnologyactivetrue
JASPIC:SPEC:12448.2 If a non-null AuthConfigProvider is returned + (by the call to getConfigProvider), the messaging runtime must call getClientAuthConfig on the + provider to obtain the authentication context configuration object pertaining to the application + context at the layer. The layer and appContext arguments of the call to getClientAuthConfig must be + the same as those used to acquire the provider, and the handler argument must be as defined in + Section 4.8.1, ?CallbackHandler Requirements? for a client runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:12548.3 If a non-null AuthConfigProvider is returned + (by the call to getConfigProvider), the messaging runtime must call getClientAuthConfig on the + provider to obtain the authentication context configuration object pertaining to the application + context at the layer. The layer and appContext arguments of the call to getClientAuthConfig must be + the same as those used to acquire the provider, and the handler argument must be as defined in + Section 4.8.2, CallbackHandler Requirements, for a client runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:12648.3 A null return value from getAuthContext + indicates that pluggable authentication modules have not been configured for the operation within + the authentication context configuration scope, and that the client runtime must proceed to perform + its SOAP message processing without reliance on this profile. true
+
falsetechnologyactivetrue
JASPIC:SPEC:12748.4.1 A non-null Subject corresponding to the + client must be passed as the clientSubject in the getAuthContext call. true
+
falsetechnologyactivetrue
JASPIC:SPEC:12848.4.2 A null value may be passed for the properties + argument in all calls made to getAuthContext true
+
falsetechnologyactivefalse
JASPIC:SPEC:12948.4.3 Each ClientAuthContext obtained via + getAuthContext must initialize its encapsulated ClientAuthModule objects with requestPolicy and + responsePolicy objects (or null values) that are compatible with the requirements and capabilities + of the service invocation at the service. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13048.5 If the client runtime obtained a non-null + ClientAuthContext by using the operation identifier corresponding to the request message, then at + point (1) in the message processing model, the runtime must call secureRequest on the + ClientAuthContext, and at point (4) the runtime must call validateResponse on the ClientAuthContext. + + true
+
falsetechnologyactivetrue
JASPIC:SPEC:13148.4.1 The messageInfo argument used in a call to + secureRequest must have been initialized by the runtime such that its getRequestMessage will return + the SOAP request message being processed by the runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13248.5.1 When a corresponding call is made to + validateResponse, it must be made with the same messageInfo and clientSubject arguments used in the + corresponding call to secureRequest, and it must have been initiialized by the runtime such that its + getResponseMessage method will return the SOAP response message being processed by the runtime. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13348.5.1 This profile requires that the message + processing runtime establish the following key-value pairs within the Map of the MessageInfo passed + in the calls to secureRequest and validateResponse Key= jakarta.xml.ws.wsdl.service Value= qualified + service name, represented as a javax.xml.namespace.QName.. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13448.5.2 The clientSubject used in the call to + getAuthContext must be used in the call to secureRequest and for any corresponding calls to + validateResponse. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13548.5.3 When secureRequest is called on a module that + was initialized with a mandatory request policy (as defined by the return value from + requestPolicy.isMandatory()), the module must only return AuthStatus.SEND_SUCCESS if it was able to + completely satisfy the request policy. true
+
falsetechnologyactivefalse
JASPIC:SPEC:13648.5.3 If the module was not able to completely + satisfy the response policy, it must: return AuthStatus.SEND_CONTINUE - if it has established a + request (available to the runtime by calling messageInfo.getRequestMessage) that must be sent by the + runtime for the response validation to be effectively continued by the client. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13748.5.3 If the module was not able to completely + satisfy the response policy, it must: return AuthStatus.FAILURE - if the response validation failed. + The module must have established a response message containing a SOAP fault element (available to + the runtime by calling messageInfo.getResponseMessage) that may be returned to the application to + indicate that the request failed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13848.5.3 If the module was not able to completely + satisfy the response policy, it must: throw an AuthException - if the response validation failed. + The runtime may choose to return a response message containing a SOAP fault element, in which case, + the runtime must define the content of the message and of the fault, and may do so based on the + content of the AuthException. true
+
falsetechnologyactivetrue
JASPIC:SPEC:13948.5.3 When secureRequest is called on a module that + was initialized with an optional requestPolicy (i.e., requestPolicy.isMandatory() returns false), + the module should attempt to satisfy the request policy but it must do so without requiring + additional messages or interactions involving the service. Independent of whether the request policy + is satisfied, the module may return AuthStatus.SUCCESS. false
+
falsetechnologyactivetrue
JASPIC:SPEC:14048.5.4 When validateResponse is called after the + service invocation on a module that was initialized with an undefined response policy (i.e., + responsePolicy == null), the module must return AuthStatus.SUCCESS. true
+
falsetechnologyactivetrue
JASPIC:SPEC:14148.5.4 When validateResponse is called after the + service invocation on a module that was initialized with a mandatory response policy (as defined by + the return value from responsePolicy.isMandatory()), the module must only return AuthStatus.SUCCESS + if it was able to completely satisfy the response policy. true
+
falsetechnologyactivefalse
JASPIC:SPEC:14248.5.4 If the module was not able to completely + satisfy the response policy, it must: return AuthStatus.SEND_CONTINUE - if it has established a + request (available to the runtime by calling messageInfo.getRequestMessage) that must be sent by the + runtime for the response validation to be effectively continued by the client. true
+
falsetechnologyactivefalse
JASPIC:SPEC:14348.5.4 If the module was not able to completely + satisfy the response policy, it must: return AuthStatus.FAILURE - if the response validation failed. + The module must have established a response message containing a SOAP fault element (available to + the runtime by calling messageInfo.getResponseMessage) that may be returned to the application to + indicate that the request failed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:14448.5.4 If the module was not able to completely + satisfy the response policy, it must: throw an AuthException - if the response validation failed. + The runtime may choose to return a response message containing a SOAP fault element, in which case, + the runtime must define the content of the message and of the fault, and may do so based on the + content of the AuthException. true
+
falsetechnologyactivetrue
JASPIC:SPEC:14548.5.4 When validateResponse is called after the + service invocation on a module that was initialized with an optional responsePolicy (i.e., + responsePolicy.isMandatory() returns false), the module should attempt to satisfy the response + policy but it must do so without requiring additional messages or interactions involving the + service. false
+
falsetechnologyactivetrue
JASPIC:SPEC:14648.5.4 Independent of whether the response policy is + satisfied, the module may return AuthStatus.SUCCESS. if the module determines that an invalid + security context was used to secure the response, then the module may return AuthStatus.FAILURE false
+
falsetechnologyactivetrue
JASPIC:SPEC:14748.5.4 When validateResponse is called before the + service invocation, the module must return AuthStatus.SEND_CONTINUE if the request dialog is to + continue. true
+
falsetechnologyactivefalse
JASPIC:SPEC:14848.5.4 If the module returns AuthStatus.FAILURE, it + must have established a SOAP message containing a SOAP fault element as the response in messageInfo + and that may be returned to the application to indicate that the request failed. If the module + throws an AuthException, the runtime may choose to return a response message containing a SOAP fault + element, in which case, the runtime must define the content of the message and of the fault, and may + do so based on the content of the AuthException. true
+
falsetechnologyactivefalse
JASPIC:SPEC:14949.2 The CallbackHandler passed to + ServerAuthModule.initialize must support the following callbacks: CallerPrincipalCallback, + GroupPrincipalCallback , PasswordValidationCallback . true
+
falsetechnologyactivetrue
JASPIC:SPEC:15049.3 If a non-null AuthConfigProvider is returned + (by the call to getConfigProvider), the messaging runtime must call getServerAuthConfig on the + provider to obtain the authentication context configuration object pertaining to the application + context at the layer. true
+
falsetechnologyactivetrue
JASPIC:SPEC:15149.3 A null return value from getAuthContext + indicates that pluggable authentication modules have not been configured for the operation at the + layer and for the application context and that the server runtime must proceed to perform its SOAP + message processing without reliance on this profile. true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:15249.3.1 A null value may be passed for the properties + argument in all calls made to getAuthContext true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:15349.4.2 When a non-null requestPolicy is used to + initialize the authentication modules of the ServerAuthContext must be constructed such that the + value obtained by calling isMandatory on the requestPolicy accurately reflects whether (i.e., true + return value) or not (i.e, false return value) message protection is required to access the web + service invocation corresponding to the MessageInfo used to acquire the ServerAuthContext. + Similarly, the responsePolicy used to initialize the authentication modules must be constructed such + that the value obtained by calling isMandatory on the responsePolicy accurately reflects whether + (i.e., true return value) or not (i.e, false return value) message protection is required (within + the SOAP messaging layer) on the response(if there is one) resulting from the corresponding + webservice invocation. true
+
falsetechnologyactivetrue
JASPIC:SPEC:15449.4.2 Calling getTargetPolicies on the + requestPolicy corresponding to a web service invocation for which a SOAP layer client identity is to + be established as the caller identity must return an array containing at least one TargetPolicy for + which calling getProtectionPolicy.getID() returns one of the following values: + ProtectionPolicy.AUTHENTICATE_SENDER, ProtectionPolicy.AUTHENTICATE_CONTENT true
+
falsetechnologyactivetrue
JASPIC:SPEC:15549.5 If the server runtime obtained a non-null + ServerAuthContext by using the authentication context identifier corresponding to the request + message, then at point (2) in the message processing model, the runtime must call validateRequest on + the ServerAuthContext, and at point (3) the runtime must call secureResponse on the + ServerAuthContext. true
+
falsetechnologyactivetrue
JASPIC:SPEC:15649.4 If the call to validateRequest returns + AuthStatus.SUCCESS, the runtime must perform any web service authorization processing2 required by + the runtime as a prerequisite to accessing the target resource. If authentication is required for + the request to be authorized, the runtime must determine whether the authentication identity + established in the clientSubject is authorized to access the resource. true
+
falsetechnologyactivetrue
JASPIC:SPEC:15749.5 In a Jakarta Authorization compatible runtime, the identity + tested for authorization must be comprised of exactly the Principal objects of the clientSubject. If + the request is NOT authorized, and the message-exchange pattern is not one-way, the runtime must set + within the response (within messageInfo) a SOAP fault element as defined by the runtime. If the + request was determined to be authorized, it must be dispatched to the resource. Otherwise the + request must NOT be dispatched and the runtime must proceed to point (3) in the message processing + model (as appropriate to the message exchange pattern). true
+
falsetechnologyactivefalse
JASPIC:SPEC:15849.4 If the invocation of the resource results in + an exception being thrown by the resource to the runtime and the message exchange pattern is not + one-way, the runtime must set within the response (within messageInfo) a SOAP fault element as + defined by the runtime. Following the resource invocation, and if the message exchange pattern is + not one-way, the runtime must proceed to point (3) in the message processing model. At point (3) in + the message processing model, the runtime must call secureResponse on the same ServerAuthContext + used in the corresponding call to validateRequest and with the same MessageInfo object. true
+
falsetechnologyactivetrue
JASPIC:SPEC:15949.4 The call to secureResponse must not be made + if the resource throws an exception to the calling runtime. true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:16049.4 This profile requires that the message + processing runtime establish the following key-value pairs within the Map of the MessageInfo object + passed in the calls to validateRequest and secureResponse. Key= jakarta.xml.ws.wsdl.service value= + the application context identifier as defined in Sec 4.2 Application Context Identifier. true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:16149.5.2 A new clientSubject must be instantiated and + passed in any calls made to validateRequest. true
+
falsetechnologyactivefalse
JASPIC:SPEC:16249.5.3 When validateRequest is called before the + service invocation on a module that was initialized with an undefined request policy (i.e., + requestPolicy == null), the module must return AuthStatus.SUCCESS true
+
falsetechnologyactivetrue
JASPIC:SPEC:16349.5.3 When validateRequest is called before the + service invocation on a module initialized with a mandatory request policy (as defined by the return + value from requestPolicy.isMandatory()), the module must only return AuthStatus.SUCCESS if it was + able to completely satisfy the request policy. true
+
falsetechnologyactivetrue
JASPIC:SPEC:16449.5.3 If the module returns AuthStatus.SUCCESS, and + the request policy was satisfied (and included a TargetPolicy element as described above), then the + module (or its context) must employ the CallerPrincipalCallback as described above. If the request + policy was not satisfied (and included a TargetPolicy element as described above), and yet the + module chooses to return AuthStatus.SUCCESS, the module (or its context) must use a + CallerPrincipalCallback to establish the container’s representation of the unauthenticated + caller within the clientSubject true
+
falsetechnologyactivetrue
JASPIC:SPEC:16549.5.3 If the module determines that an invalid or + incomplete security context was used to secure the request, then the module may return + AuthStatus.SEND_FAILURE, AuthStatus.SEND_CONTINUE, or throw an AuthException.If the module throws an + AuthException, or returns any value other that AuthStatus.SUCCESS, the runtime must NOT proceed to + the service invocation. The runtime must process an AuthException as described above for a request + with a mandatory requestPolicy. The runtime must process any return value other than + AuthStatus.SUCCESS as it would be processed if it were returned for a request with a mandatory + requestPolicy. true
+
falsetechnologyactivetrue
JASPIC:SPEC:16649.5.3 If the module was not able to completely + satisfy the request policy, it must: return AuthStatus.SEND_FAILURE - if the request validation + failed, and when the module has established a SOAP message containing a fault element (available to + the runtime by calling messageInfo.getResponseMessage) that may be sent by the runtime to inform the + client that the request failed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:16749.5.3 If the module was not able to completely + satisfy the request policy, it must: throw an AuthException - if the request validation failed, and + when the module has NOT defined a response, to be sent by the runtime. If the runtime chooses to + send a response, it must define a SOAP message containing a SOAP fault element, and may use the + content of the AuthException to do so. true
+
falsetechnologyactivetrue
JASPIC:SPEC:16849.5.3 When validateRequest is called before the + service invocation on a module that was initialized with an optional request policy (i.e., + requestPolicy.isMandatory() returns false), the module should attempt to satisfy the request policy + but it must do so without requiring additional messages or interactions involving the client. If the + request policy is satisfied, and it included a TargetPolicy element with a PotectionPolicy of + AUTHENTICATE_SOURCE or AUTHENTICATE_CONTENT, then the module must employ the CallerPrincipalCallback + as described above. true
+
falsetechnologyactivetrue
JASPIC:SPEC:16949.4.3 Independent of whether the authentication + policy is satisfied, the module may return AuthStatus.SUCCESS. if the module determines that an + invalid security context was used to secure the request, or that the request requires additional + processing (e.g. decryption) to be suitable for processing by the runtime, then the module may + return AuthStatus.FAILURE or throw an AuthException. In which case, the runtime must determine + whether to terminate the request or to (attempt to) process it. true
+
falsetechnologydeprecatedfalse
JASPIC:SPEC:17049.5.3 When validateRequest is called after the + service invocation, the module must return AuthStatus.SEND_SUCCESS when the module has successfully + secured the application response message and made it available via messageInfo.getResponseMessage. + For the request to be successfully completed, the runtime must send the response message returned by + the module. true
+
falsetechnologyactivetrue
JASPIC:SPEC:17149.5.3 When securing of the application response + message has failed, and the response dialog is to be terminated, the module must return + AuthStatus.SEND_FAILURE or throw an AuthException. true
+
falsetechnologyactivetrue
JASPIC:SPEC:17249.5.3 If the module returns + AuthStatus.SEND_FAILURE, it must have established a SOAP message containing a SOAP fault element as + the response in messageInfo. The runtime may choose not to send a response message, or to send a + different response message. true
+
falsetechnologyactivetrue
JASPIC:SPEC:17349.5.3 When the module throws an AuthException, the + runtime may chose not to send a response. If the runtime sends a response, the runtime must define + the content of the response. true
+
falsetechnologyactivefalse
JASPIC:SPEC:17449.5.3 The module must return + AuthStatus.SEND_CONTINUE if the response dialog is to continue. This status value is used to inform + the calling runtime that (in order to successfully complete the response processing) it will need to + be capable of continuing the message dialog by processing at least one additional request/response + exchange (after having sent the response message returned in messageInfo). true
+
falsetechnologyactivefalse
JASPIC:SPEC:17549.5.4 When secureResponse is called on a module + that was initialized with an undefined responsePolicy (i.e., responsePolicy == null), the module + must return AuthStatus.SUCCESS. Otherwise, the AuthStatus return value and AuthException semantics + of secureResponse are as defined in validateRequest After Service Invocation. true
+
falsetechnologyactivetrue
JASPIC:SPEC:17651 The ServerAuthModule must create an instance + of a javax.security.auth.login.LoginContext. If the ServerAuthModule passes a custom + javax.security.auth.login.Configuration object to the constructor, then it also passes a custom + value as the name input. true
+
falsetechnologyactivefalse
JASPIC:SPEC:17751 If the ServerAuthModule does not pass a + custom Configuration object to the constructor, then it must pass its own fully qualified class name + as the name input. In this case, the configuration administrator must configure the relevant + LoginModule objects in an entry for that class name, or must configure the LoginModule objects into + the standard default entry called other. true
+
falsetechnologyactivefalse
JASPIC:SPEC:17851 If the ServerAuthModule passes a Subject to + the LoginContext constructor, it must pass its client Subject. true
+
falsetechnologyactivefalse
JASPIC:SPEC:17951 The ServerAuthModule must pass a + CallbackHandler to the constructor and the passed CallbackHandler must conform to the requirements + of Section 5.3, Standard Callbacks. true
+
falsetechnologyactivetrue
JASPIC:SPEC:18051 A new LoginContext instance should be created + for each new request, and a LoginContext instance should not be shared across different requests. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18151 Once a LoginContext object has been created, + the LoginContext.login method may be invoked from within the ServerAuthModule.validateRequest method + to delegate security processing to the LoginModule objects configured in the LoginContext. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18252 A LoginModule must only perform + protocolindependent security processing (for example, verifying a username/password that was + transmitted in the request). true
+
falsetechnologyactivefalse
JASPIC:SPEC:18352 A LoginModule requests information from the + ServerAuthModule using the ServerAuthModule provided CallbackHandler. Since the LoginModule must + only perform protocol-independent operations, it follows that any callback it requests from the + handler must also be protocol-independent. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18453 This profile requires that the + CallbackHandler provided by the ServerAuthModule to the LoginContext constructor support the + javax.security.auth.callback.NameCallback and the javax.security.auth.callback.PasswordCallback. + + true
+
falsetechnologyactivefalse
JASPIC:SPEC:32653 If the ServerAuthModule passes its client + Subject to the LoginContext constructor, the CallbackHandler provided to the LoginContext + constructor must also support the GroupPrincipalCallback. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18554 If authentication succeeds, a LoginModule may + update its Subject instance with authenticated Principal and credential objects. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18654 If the ServerAuthModule did not pass its + client Subject to the LoginContext constructor, then it must transfer the Principals and credentials + from the LoginContext Subject to the client Subject. true
+
falsetechnologyactivefalse
JASPIC:SPEC:32754 If the ServerAuthModule is implementing a + profile of this specification that requires the module to employ the CallerPrincipalCallback, then + the ServerAuthModule must satisfy this requirement using the CallbackHandler provided to the + ServerAuthModule, and the CallerPrincipalCallback must be constructed using the name value that + would be obtained by the LoginModule if it uses its CallbackHandler to handle a NameCallback. (note + 1: The CallerPrincipalCallback may be constucted with a String argument containing the name value, + or with a Principal argument whose getName method returns the name value.) true
+
falsetechnologyactivefalse
JASPIC:SPEC:18755 When ServerAuthModule.cleanSubject is called + on the client Subject, the cleanSubject method must invoke the LoginContext.logout method. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18856 If the LoginContext instance throws a + LoginException, the ServerAuthModule must throw a corresponding AuthException. The LoginException + may be established as the cause of the AuthException. true
+
falsetechnologyactivefalse
JASPIC:SPEC:18961 The message layer value used to select the + AuthConfigProvider and ServerAuthConfig objects for this profile must be JMS false
+
falsetechnologyactivetrue
JASPIC:SPEC:19062 The application context identifier (i.e., the + appContext parameter value) used to select the AuthConfigProvider, ClientAuthConfig, and + ServerAuthConfig objects for a specific application shall be the name of the Destination. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19163 The MessageInfo argument used in any call + made by the message processing runtime to validateRequest or secureResponse must have been + initialized such that the non-null objects returned by the getRequestMessage and getResponseMessage + methods of the AuthParam are an instanceof javax.jmx.Message. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19264 The getSupportedMessageTypes method of all + authentication modules integrated for use with this profile, must include jakarta.jms.Message in its + return value. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19366 The factory implementation returned by + calling the getFactory method of the abstract AuthConfigFactory class must have been configured such + that it returns a non-null AuthConfigProvider for those application contexts for which pluggable + authentication modules have been configured at the JMS layer. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19466 For each JMS Destination for which it is + servicing requests, the runtime must call getConfigProvider to acquire the corresponding provider + object. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19566 For each JMS Destination for which it is + servicing requests, the runtime must call getConfigProvider to acquire the corresponding provider + object. The layer and appContext arguments to getConfigProvider must be as defined in Section 6.1, + 'Message Layer Identifier' and Section 6.2, 'Application Context Identifier' respectively. false
+
falsetechnologyactivetrue
JASPIC:SPEC:19666 A null return value from getConfigProvider + indicates that pluggable authentication modules have not been configured at the layer for the + application context and that the messaging runtime must proceed to perform its JMS message + processing without reliance on this profile. false
+
falsetechnologyactivefalse
JASPIC:SPEC:19767 When a non-null AuthConfigProvider is + returned by the factory, the provider must have been configured with the information required to + initialize the authentication contexts for the (one or more) JMS Destinations for which the provider + is registered (at the factory). false
+
falsetechnologyactivetrue
JASPIC:SPEC:19867.1 If getOperation returns a non-null operation + identifier, then the operation identifier must be the String value defined as follows: - When the + message is a request for a QueueConnection or a TopicConnection, then the operation identifier is + the String value representing the JNDI name of the Connection Factory. - When the message is a + request to create a publisher or subscriber, or a sender or receiver, then the operation identifier + must be the String value corresponding to the Destination name. false
+
falsetechnologyactivefalse
JASPIC:SPEC:19968 The following must be satisfied by a runtime + operating in the client role: A runtime may operate in both the client and server roles. false
+
falsetechnologyactivefalse
JASPIC:SPEC:20068.4.1 The messageInfo argument used in a call to + secureRequest must have been initialized by the runtime such that its getRequestMessage will return + the JMS request message being processed by the runtime. false
+
falsetechnologyactivetrue
JASPIC:SPEC:20168.4.1 When a corresponding call is made to + validateResponse, it must be made with the same messageInfo and clientSubject arguments used in the + corresponding call to secureRequest, and it must have been initialized by the runtime such that its + getResponseMessage method will return the JMS response message being processed by the runtime. false
+
falsetechnologyactivetrue
JASPIC:SPEC:20268.4.3 When secureRequest is called on a module that + was initialized with a mandatory request policy (as defined by the return value from + requestPolicy.isMandatory()), the module must only return AuthStatus.SEND_SUCCESS if it was able to + completely satisfy the request policy. false
+
falsetechnologyactivefalse
JASPIC:SPEC:20368.4.3 When secureRequest is called on a module that + was initialized with a mandatory request policy (as defined by the return value from + requestPolicy.isMandatory()), If the module was not able to completely satisfy the response policy, + it must: - return AuthStatus.SEND_CONTINUE - if it has established a request - return + AuthStatus.FAILURE - if the response validation failed. - throw an AuthException - if the response + validation failed. false
+
falsetechnologyactivefalse
JASPIC:SPEC:20468.4.3 When secureRequest is called on a module that + was initialized with an optional requestPolicy (i.e.,requestPolicy.isMandatory() returns false), if + the module attempts to satisfy the request policy, it must do so without requiring additional + messages or interactions involving the service. false
+
falsetechnologyactivefalse
JASPIC:SPEC:20569 The requirements of this profile that must be + satisfied by a runtime operating in the server role are: - Receives a message from a Sender before + reaching the Queue - Receives a message from a Publisher on the way to a Topic - Receives a request + for creation of a TopicPublisher or QueueSender - Receives a message from the a JMS Provider false
+
falsetechnologyactivefalse
JASPIC:SPEC:20669.4.1 The messageInfo argument used in a call to + validateRequest must have been initialized by the runtime such that its getRequestMessage will + return the JMS request message being processed by the runtime. false
+
falsetechnologyactivetrue
JASPIC:SPEC:20769.4.1 When a corresponding call is made to + secureResponse, it must be made with the same messageInfo and serviceSubject arguments used in the + corresponding call to validateRequest, and it must have been initialized by the runtime such that + its getResponseMessage method will return the JMS response message being processed by the runtime. false
+
falsetechnologyactivetrue
JASPIC:SPEC:20848.1 The application context identifier used by a + client-runtime to acquire the AuthConfigProvider and ClientAuthConfig objects pertaining to the + client side processing of a web service invocation shall begin with a client scope identifier that + identifies the client. If the client-runtime may host multiple client applications, then the client + scope identifier must differentiate among the client applications deployed within the runtime. In + runtimes where applications are differentiated by unambiguous application identifiers, an + application identifier may be used as the client scope identifier. Where application identifiers are + not defined or suitable, the location (for example, its file path) of the client archive from which + the invocation will originate may be used as the client scope identifier In addition to its client + scope identifier, the application context identifier must include a client reference to the service. + If a service reference is defined for the invocation (for example, by using a WebServiceRef + annotation as defined in the JAXWS 2.0 or JAXWS 2.1 Specifications), the client reference to the + service must be the name value of the service reference. If a service reference was not defined for + the invocation, the client reference to the service must be the web service URL. A client + application context identifier must be the String value composed by concatenating the client scope + identifier, a blank separator character, and the client reference to the service. AppContextID ::= + client-scope-identfier blank client-reference true
+
falsetechnologyactivetrue
JASPIC:SPEC:20949.1 The application context identifier used by a + server-runtime to acquire the AuthConfigProvider and ServerAuthConfig objects pertaining to the + endpoint side processing of an invocation shall be the String value constructed by concatenating a + host name, a blank separator character, and the path3 component of the service endpoint URI + corresponding to the webservice. AppContextID ::= hostname blank service-endpoint-uri In the + definition of server-side application context identifiers, this profile uses the term host name to + refer to the logical host that performs the service corresponding to a service invocation. Web + service invocations may be directed to a logical host using various physical or virtual host names + or addresses, and a message processing runtime may be composed of multiple logical hosts. Systems or + administrators that register AuthConfigProvider objects with specific server-side application + context identifiers must have an ability to determine the hostname for which they wish to perform + the registration. true
+
falsetechnologyactivetrue
JASPIC:SPEC:328PackageHead - + jakarta.security.auth.message.configAuthConfigFactory getConfigProvider(): All factories shall + employ the following precedence rules to select the registered AuthConfigProvider that matches the + layer and appContext arguments: 1. The provider that is specifically registered for both the + corresponding message layer and appContext shall be selected. 2. If no provider is selected + according to the preceding rule, the provider specifically registered for the corresponding + appContext and for all message layers shall be selected. 3. If no provider is selected according to + the preceding rules, the provider specifically registered for the corresponding message layer and + for all appContexts shall be selected. 4. If no provider is selected according to the preceding + rules, the provider registered for all message layers and for all appContexts shall be selected. 5. + If no provider is selected according to the preceding rules, the factory shall terminate its search + for a registered provider. The above precedence rules apply equivalently to registrations created + with a null or non-null className argument. true
+
falsetechnologyactivetrue
JASPIC:SPEC:329PackageHead - + jakarta.security.auth.message.configAuthConfigFactory getFactory(): If a non-null system-wide + factory instance is defined at the time of the call, for example, with setFactory, it will be + returned. true
+
falsetechnologyactivetrue
JASPIC:SPEC:330PackageHead - + jakarta.security.auth.message.configAuthConfigFactory getFactory(): The fully qualified class name + of the default factory implementation class is obtained from the value of the + authconfigprovider.factory security property. true
+
falsetechnologyactivetrue
JASPIC:SPEC:331PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(className, properties, + layer, appContext, description): At most one registration may exist within the factory for a given + combination of message layer and appContext. Any pre-existing registration with identical values for + layer and appContext is replaced by a subsequent registration. true
+
falsetechnologyactivetrue
JASPIC:SPEC:332PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(className, properties, + layer, appContext, description): [At most one registration may exist within the factory for a given + combination of message layer and appContext. Any pre-existing registration with identical values for + layer and appContext is replaced by a subsequent registration.] When replacement occurs, the + registration identifier, layer, and appContext identifier remain unchanged, and the + AuthConfigProvider (with initialization properties) and description are replaced. true
+
falsetechnologyactivetrue
JASPIC:SPEC:333PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(className, properties, + layer, appContext, description): Within the lifetime of its Java process, a factory must assign + unique registration identifiers to registrations, and must never assign a previously used + registration identifier to a registration whose message layer and or appContext identifier differ + from the previous use. true
+
falsetechnologyactivetrue
JASPIC:SPEC:334PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(provider, layer, + appContext, description): Registers within the (in-memory) factory, a provider of ServerAuthConfig + and/or ClientAuthConfig objects for a message layer and application context identifier. true
+
falsetechnologyactivetrue
JASPIC:SPEC:335PackageHead - + jakarta.security.auth.message.configAuthConfigFactory setFactory() Set the system-wide + AuthConfigFactory implementation. If an implementation was set previously, it will be replaced. + Listeners are not notified of a change to the registered factory. true
+
falsetechnologyactivetrue
JASPIC:SPEC:336PackageHead - + jakarta.security.auth.message.configAuthConfigFactory.RegistrationContext isPersistent() Returns: A boolean indicating + whether the registration is the result of a className based registration, or an instance-based (for + example, self-) registration. Only registrations performed using the five argument + registerConfigProvider method are persistent. true
+
falsetechnologyactivetrue
JASPIC:SPEC:33721.1.1 When a listener argument is included in the + call to acquire a provider, the factory will invoke the notify method of the listener when the + correspondence between the provider and the layer and application context for which is had been + acquired is no longer in effect. When the notify method is invoked by the factory, the runtime + should reacquire an AuthConfigProvider for the layer and application context. true
+
falsetechnologyactivetrue
JASPIC:SPEC:338PackageHead - + jakarta.security.auth.message.configRegistrationListener notify() The AuthConfigFactory will invoke + the notify method of the RegistrationListener if the corresponding provider registration is + unregistered or replaced at the factory. true
+
falsetechnologyactivetrue
JASPIC:SPEC:339PackageHead - + jakarta.security.auth.message.configAuthConfigFactory detachListener() The AuthConfigFactory will + invoke the notify method of the RegistrationListener if the corresponding provider registration is + unregistered or replaced at the factory. Returns: An array of String values where each value + identifies a provider registration from which the listener was removed. This method never returns + null; it returns an empty array if the listener was not removed from any registrations. true
+
falsetechnologyactivetrue
JASPIC:SPEC:340PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(className, properties, + layer, appContext, description) When replacement occurs, the registration identifier, layer, and + appContext identifier remain unchanged, and the AuthConfigProvider (with initialization properties) + and description are replaced. true
+
falsetechnologyactivetrue
JASPIC:SPEC:341PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(className, properties, + layer, appContext, description) Programmatic registrations performed by using this method must + update (according to the replacement rules described above) the persistent declarative + representation of provider registrations employed by the factory constructor. true
+
falsetechnologyactivetrue
JASPIC:SPEC:342PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(acp, layer, + appContext, description) At most one registration may exist within the factory for a given + combination of message layer and appContext. Any pre-existing registration with identical values for + layer and appContext is replaced by a subsequent registration. true
+
falsetechnologyactivetrue
JASPIC:SPEC:343PackageHead - + jakarta.security.auth.message.configAuthConfigFactory registerConfigProvider(acp, layer, + appContext, description) When replacement occurs, the registration identifier, layer, and appContext + identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and + description are replaced. true
+
falsetechnologyactivetrue
JASPIC:SPEC:344PackageHead - + jakarta.security.auth.message.configAuthConfigFactory removeRegistration() Remove the identified + provider registration from the factory (and from the persistent declarative representation of + provider registrations, if appropriate) and invoke any listeners associated with the removed + registration. Verify this returns True when there is a registration with the specified identifier + and it was removed. true
+
falsetechnologyactivetrue
JASPIC:SPEC:345PackageHead - + jakarta.security.auth.message.configAuthConfigFactory removeRegistration() Remove the identified + provider registration from the factory (and from the persistent declarative representation of + provider registrations, if appropriate) and invoke any listeners associated with the removed + registration. Verify this returns false when the registrationID is invalid. true
+
falsetechnologyactivetrue
+ + diff --git a/tck/old-tck/source/install/jaspic/docs/index.html b/tck/old-tck/source/install/jaspic/docs/index.html new file mode 100755 index 0000000..a8ec88d --- /dev/null +++ b/tck/old-tck/source/install/jaspic/docs/index.html @@ -0,0 +1,69 @@ + + + + + + Welcome to the Jakarta Authentication TCK + + +
+

Welcome to the Jakarta EE Authentication TCK, Version 2.0
+ Your Starting Point

+
+
+

Jakarta EE Authentication TCK 2.0 Documentation

+

The Jakarta EE Authentication Technology Compatibility Kit (TCK) 2.0 + documentation includes the following:

+
    +
  • +

    The Jakarta EE + Authentication TCK 2.0 Release Notes provide late-breaking + information about the Jakarta EE Authentication TCK, Version 2.0.

    +
  • +
  • +

    The Jakarta EE Authentication 2.0 Technology Compatibility Kit + User's Guide provides the information you need to install, + configure, and run the Jakarta EE Authentication TCK. The User's Guide + also contains the rules you need to pass for certification.

    +
  • +
  • +

    The API documentation for the porting + interfaces provides information about the porting packages you + need to implement for this TCK.

    +
  • +
  • +

    The Javadoc + Assertion List lists all the javadoc assertions from Jakarta EE + Authentication 2.0 Specification.

    +
  • +
  • +

    The Specification + Assertion List lists all the specification assertions from + Jakarta EE Authentication 2.0 Specification.

    +
  • +
+

JT Harness Documentation

+

The online version of the JT Harness version 5.0 documentation is + available here.

+
+

+
Copyright © 2013, 2021, Oracle and/or its affiliates. All + rights reserved.
+

+ + diff --git a/tck/old-tck/source/install/jaspic/other/testsuite.jtt b/tck/old-tck/source/install/jaspic/other/testsuite.jtt new file mode 100755 index 0000000..50dc1d5 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/other/testsuite.jtt @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# +name=Jakarta Authentication Compatibility Test Suite Version 2.0 +classpath=$TS_HOME/lib/tsharness.jar +testsuite=com.sun.ts.lib.harness.TS diff --git a/tck/old-tck/source/install/jaspic/other/vehicle.properties b/tck/old-tck/source/install/jaspic/other/vehicle.properties new file mode 100755 index 0000000..2a63419 --- /dev/null +++ b/tck/old-tck/source/install/jaspic/other/vehicle.properties @@ -0,0 +1,51 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# A properties file to determine whether a test directory is service test +# directory, and if so the vehicles in which the tests should be run. +# +# An entry key is a test directory relative to the testsutie root (i.e., +# ${TS_HOME}/src) with unix file separator (forward slash). An entry value +# is a list of vehilce names separated by a space. Althoug other reasonable +# delimiters may also work, a single space is recommended for consistency. +# Acceptable vehicle names are combinations of the following strings: +# ejb, servlet, jsp, appclient, and standalone. Each item may only appear +# once in one entry vale. +# +# For examples, some invalid entries: +# /files/ts/src/com/sun/ts/tests/samples/jdbc = ejb jsp servlet appclient +# com\sun\ts\tests\samples\jdbc = ejb jsp servlet appclient +# com\\sun\\ts\\tests\\samples\\jdbc = ejb jsp servlet appclient +# samples/jdbc = ejb jsp servlet appclient +# /com/sun/ts/tests/samples/jdbc = ejb servlet jsp appclient +# com/sun/ts/tests/samples/jdbc = ejb.servlet.jsp.appclient +# com/sun/ts/tests/samples/jdbc = ejb/servlet/jsp/appclient +# +# Entry order is insignificant. As a good practice, make the entry key +# (test directory) specific. For example, +# com/sun/ts/tests = ejb jsp servlet +# conveys to the harness that all tests under com/sun/ts/tests are service +# tests that should be run in 3 vehicles: ejb jsp servlet. +# +# This file may be modified for debugging purpose only. When testing for +# compatibility certification, the original version of this file must be +# used. Do NOT make modifications without maintaining a backup copy. +# + + + +com/sun/ts/tests/jaspic/spi/baseline = jaspicservlet + diff --git a/tck/old-tck/source/internal/docs/dtd/javadoc_assertions.dtd b/tck/old-tck/source/internal/docs/dtd/javadoc_assertions.dtd new file mode 100755 index 0000000..e36379f --- /dev/null +++ b/tck/old-tck/source/internal/docs/dtd/javadoc_assertions.dtd @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/internal/docs/dtd/spec_assertions.dtd b/tck/old-tck/source/internal/docs/dtd/spec_assertions.dtd new file mode 100755 index 0000000..666abba --- /dev/null +++ b/tck/old-tck/source/internal/docs/dtd/spec_assertions.dtd @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/internal/docs/jaspic/JASPICJavadocAssertions.xml b/tck/old-tck/source/internal/docs/jaspic/JASPICJavadocAssertions.xml new file mode 100644 index 0000000..0d19246 --- /dev/null +++ b/tck/old-tck/source/internal/docs/jaspic/JASPICJavadocAssertions.xml @@ -0,0 +1,1436 @@ + + + + + + 108 + 1 + JASPIC + JASPIC + Jakarta Authentication + 2.0 + + + 1 + + Constructs an AuthException with no detail message. + A detail message is a String that describes this particular exception. + + jakarta.security.auth.message + AuthException + + + + 2 + + Constructs an AuthException with the specified detail message. + A detail message is a String that describes this particular exception. + + jakarta.security.auth.message + AuthException + + + java.lang.String + + + + + 3 + + Remove implementation specific principals and credentials from the subject. + + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + + + + 4 + If an error occurs during the Subject processing. + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 5 + + Secure a service request message before sending it to the service. + This method is called to transform the request message acquired by calling getRequestMessage (on messageInfo) into the + mechanism-specific form to be sent by the runtime. This method conveys the outcome of its message + processing either by returning an AuthStatus value or by throwing an AuthException. + + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + + + + 6 + When the message processing failed without establishing a failure response message (in + messageInfo). + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 7 + + Validate a received service response. + This method is called to transform the mechanism-specific response message acquired by calling getResponseMessage (on + messageInfo) into the validated application message to be returned to the message processing runtime. If + the response message is a (mechanism-specific) meta-message, the method implementation must attempt to + transform the meta-message into the next mechanism-specific request message to be sent by the runtime. + This method conveys the outcome of its message processing either by returning an AuthStatus value or by + throwing an AuthException. + + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + javax.security.auth.Subject + + + + + 8 + When the message processing failed without establishing a failure response message (in + messageInfo). + jakarta.security.auth.message + ClientAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 9 + + Get (a reference to) the Map object of this MessageInfo. + Operations performed on the acquired Map must effect the Map within the MessageInfo. + + jakarta.security.auth.message + MessageInfo + + + + 10 + + Get the request message object from this MessageInfo. + + jakarta.security.auth.message + MessageInfo + + + + 11 + + Get the response message object from this MessageInfo. + + jakarta.security.auth.message + MessageInfo + + + + 12 + + Set the request message object in this MessageInfo. + + jakarta.security.auth.message + MessageInfo + + + java.lang.Object + + + + + 13 + + Set the response message object in this MessageInfo. + + jakarta.security.auth.message + MessageInfo + + + java.lang.Object + + + + + 14 + + Get the target policies that comprise the authentication policy. + + + jakarta.security.auth.message + MessagePolicy + + + + 15 + + Get the MessagePolicy modifier. + + jakarta.security.auth.message + MessagePolicy + + + + 16 + + Create a MessagePolicy instance with an array of target policies. + + jakarta.security.auth.message + MessagePolicy + + + jakarta.security.auth.message.MessagePolicy.MessagePolicy.TargetPolicy[] + boolean + + + + + 17 + + Get the ProtectionPolicy identifier. + An identifier may represent a conceptual protection policy (as is the case with the static identifiers defined within + this interface) or it may identify a procedural policy expression or plan that may be more difficult to + categorize in terms of a conceptual identifier. + + jakarta.security.auth.message + MessagePolicy.ProtectionPolicy + + + + 18 + + Get the Object identified by the Target from the MessageInfo. + + jakarta.security.auth.message + MessagePolicy.Target + + + jakarta.security.auth.message.MessageInfo + + + + + 19 + + Put the Object into the MessageInfo at the location identified by the target. + + jakarta.security.auth.message + MessagePolicy.Target + + + jakarta.security.auth.message.MessageInfo + java.lang.Object + + + + + 20 + + Remove the Object identified by the Target from the MessageInfo. + + jakarta.security.auth.message + MessagePolicy.Target + + + jakarta.security.auth.message.MessageInfo + + + + + 21 + + Get the ProtectionPolicy that applies to the targets. + + jakarta.security.auth.message + MessagePolicy.TargetPolicy + + + + 22 + + Get the array of layer-specific target descriptors that identify the one or more message parts to which the specified + message protection policy applies. + + jakarta.security.auth.message + MessagePolicy.TargetPolicy + + + + 23 + + Create a TargetPolicy instance with an array of Targets and with a ProtectionPolicy. + + jakarta.security.auth.message + MessagePolicy.TargetPolicy + + + jakarta.security.auth.message.MessagePolicy.MessagePolicy.Target[] + jakarta.security.auth.message.MessagePolicy.MessagePolicy.ProtectionPolicy + + + + + 24 + + Remove method specific principals and credentials from the subject. + + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + + + + 25 + If an error occurs during the Subject processing. + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 26 + + Secure a service response before sending it to the client. + This method is called to transform the response message acquired by calling getResponseMessage (on messageInfo) into the + mechanism-specific form to be sent by the runtime. This method conveys the outcome of its message + processing either by returning an AuthStatus value or by throwing an AuthException. + + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + + + + 27 + When the message processing failed without establishing a failure response message (in + messageInfo). + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 28 + + Authenticate a received service request. + This method is called to transform the mechanism-specific request message acquired by calling getRequestMessage (on + messageInfo) into the validated application message to be returned to the message processing runtime. If + the received message is a (mechanism-specific) meta-message, the method implementation must attempt to + transform the meta-message into a corresponding mechanism-specific response message, or to the validated + application request message. The runtime will bind a validated application message into the the + corresponding service invocation. This method conveys the outcome of its message processing either by + returning an AuthStatus value or by throwing an AuthException. + + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + javax.security.auth.Subject + + + + + 29 + When the message processing failed without establishing a failure response message (in + messageInfo). + jakarta.security.auth.message + ServerAuth + + + jakarta.security.auth.message.MessageInfo + javax.security.auth.Subject + javax.security.auth.Subject + + jakarta.security.auth.message.AuthException + + + + 30 + + Create a CallerPrincipalCallback to set the container's representation of the caller principal + + jakarta.security.auth.message.callback + CallerPrincipalCallback + + + javax.security.auth.Subject + java.security.Principal + + + + + 31 + + Create a CallerPrincipalCallback to set the container's representation of the caller principal. + + jakarta.security.auth.message.callback + CallerPrincipalCallback + + + javax.security.auth.Subject + java.lang.String + + + + + 32 + + Get the caller principal name. + + jakarta.security.auth.message.callback + CallerPrincipalCallback + + + + 33 + + Get the caller principal. + + jakarta.security.auth.message.callback + CallerPrincipalCallback + + + + 34 + + Get the Subject in which the handler will distinguish the caller principal + + jakarta.security.auth.message.callback + CallerPrincipalCallback + + + + 35 + + Create a CertStoreCallback. + + jakarta.security.auth.message.callback + CertStoreCallback + + + + 36 + + Used by the CertStore user to obtain the CertStore set within the Callback. + + jakarta.security.auth.message.callback + CertStoreCallback + + + + 37 + + Used by the CallbackHandler to set the CertStore within the Callback. + + jakarta.security.auth.message.callback + CertStoreCallback + + + java.security.cert.CertStore + + + + + 38 + + Get the array of group names. + + jakarta.security.auth.message.callback + GroupPrincipalCallback + + + + 39 + + Get the Subject in which the handler will establish the group principals. + + jakarta.security.auth.message.callback + GroupPrincipalCallback + + + + 40 + + Create a GroupPrincipalCallback to establish the container's representation of the corresponding group principals within + the Subject. + + jakarta.security.auth.message.callback + GroupPrincipalCallback + + + javax.security.auth.Subject + java.lang.String[] + + + + + 41 + + Clear the password. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + + 42 + + Get the password. + Note that this method returns a reference to the password. If a clone of the array is created it is the caller's + responsibility to zero out the password information after it is no longer needed. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + + 43 + + Get the authentication result. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + + 44 + + Get the subject. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + + 45 + + Get the username. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + + 46 + + Create a PasswordValidationCallback. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + javax.security.auth.Subject + java.lang.String + char[] + + + + + 47 + + Set the authentication result. + + jakarta.security.auth.message.callback + PasswordValidationCallback + + + boolean + + + + + 48 + + Used to obtain the certicicate chain set within the Callback. + + jakarta.security.auth.message.callback + PrivateKeyCallback + + + + 49 + + Used to obtain the private key set within the Callback. + + jakarta.security.auth.message.callback + PrivateKeyCallback + + + + 50 + + Used by the CallbackHandler to get the Request object that identifies the private key to be returned. + + jakarta.security.auth.message.callback + PrivateKeyCallback + + + + 51 + + Constructs this PrivateKeyCallback with a private key Request object. + The request object identifies the private key to be returned. The corresponding certificate chain for the private key + is also returned. If the request object is null, the handler of the callback relies on its own default. + + jakarta.security.auth.message.callback + PrivateKeyCallback + + + jakarta.security.auth.message.callback.PrivateKeyCallback.PrivateKeyCallback.Request + + + + + 52 + + Used by the CallbackHandler to set the requested private key and the corresponding certificate chain within the + Callback. + If the requested private key or chain could not be found, then both values must be set to null. + + jakarta.security.auth.message.callback + PrivateKeyCallback + + + java.security.PrivateKey + java.security.cert.Certificate[] + + + + + 53 + + Get the alias. + + jakarta.security.auth.message.callback + PrivateKeyCallback.AliasRequest + + + + 54 + + Construct an AliasRequest with an alias. + The alias is used to directly identify the private key to be returned. The corresponding certificate chain for the + private key is also returned. If the alias is null, the handler of the callback relies on its own + default. + + jakarta.security.auth.message.callback + PrivateKeyCallback.AliasRequest + + + java.lang.String + + + + + 55 + + Get the algorithm identifier. + + jakarta.security.auth.message.callback + PrivateKeyCallback.DigestRequest + + + + 56 + + Get the digest value. + + jakarta.security.auth.message.callback + PrivateKeyCallback.DigestRequest + + + + 57 + + Constructs a DigestRequest with a digest value and algorithm identifier. + The digest of the certificate whose private key is returned must match the provided digest. The certificate digest is + computed by applying the specified algorithm to the bytes of the certificate. For example: + MessageDigest.getInstance(algorithm).digest(cert.getEncoded()) . The corresponding certificate chain for + the private key is also returned. If the digest or algorithm parameters are null, the handler of the + callback relies on its own defaults. + + jakarta.security.auth.message.callback + PrivateKeyCallback.DigestRequest + + + byte[] + java.lang.String + + + + + 58 + + Get the issuer. + + jakarta.security.auth.message.callback + PrivateKeyCallback.IssuerSerialNumRequest + + + + 59 + + Get the serial number. + + jakarta.security.auth.message.callback + PrivateKeyCallback.IssuerSerialNumRequest + + + + 60 + + Constructs a IssuerSerialNumRequest with an issuer/serial number. + The issuer/serial number is used to identify a public key certificate. The corresponding private key is returned in the + callback. The corresponding certificate chain for the private key is also returned. If the + issuer/serialNumber parameters are null, the handler of the callback relies on its own defaults. + + jakarta.security.auth.message.callback + PrivateKeyCallback.IssuerSerialNumRequest + + + javax.security.auth.x500.X500Principal + java.math.BigInteger + + + + + 61 + + Get the subjectKeyID. + + jakarta.security.auth.message.callback + PrivateKeyCallback.SubjectKeyIDRequest + + + + 62 + + Construct a SubjectKeyIDRequest with an subjectKeyID. + The subjectKeyID is used to directly identify the private key to be returned. The corresponding certificate chain for + the private key is also returned. If the subjectKeyID is null, the handler of the callback relies on its + own default. + + jakarta.security.auth.message.callback + PrivateKeyCallback.SubjectKeyIDRequest + + + byte[] + + + + + 63 + + Used to obtain the secret key set within the Callback. + + jakarta.security.auth.message.callback + SecretKeyCallback + + + + 64 + + Used by the CallbackHandler to get the Request object which identifies the secret key to be returned. + + jakarta.security.auth.message.callback + SecretKeyCallback + + + + 65 + + Constructs this SecretKeyCallback with a secret key Request object. + The request object identifies the secret key to be returned. If the alias is null, the handler of the callback relies + on its own default. + + jakarta.security.auth.message.callback + SecretKeyCallback + + + jakarta.security.auth.message.callback.SecretKeyCallback.SecretKeyCallback.Request + + + + + 66 + + Used by the CallbackHandler to set the requested secret key within the Callback. + + jakarta.security.auth.message.callback + SecretKeyCallback + + + javax.crypto.SecretKey + + + + + 67 + + Get the alias. + + jakarta.security.auth.message.callback + SecretKeyCallback.AliasRequest + + + + 68 + + Construct an AliasRequest with an alias. + The alias is used to directly identify the secret key to be returned. If the alias is null, the handler of the callback + relies on its own default. + + jakarta.security.auth.message.callback + SecretKeyCallback.AliasRequest + + + java.lang.String + + + + + 69 + + Used by the TrustStore user to obtain the TrustStore set within the Callback. + + jakarta.security.auth.message.callback + TrustStoreCallback + + + + 70 + + Used by the CallbackHandler to set the trusted certificate keystore within the Callback. + + jakarta.security.auth.message.callback + TrustStoreCallback + + + java.security.KeyStore + + + + + 71 + + Create a TrustStoreCallback. + + jakarta.security.auth.message.callback + TrustStoreCallback + + + + 72 + + Get the application context identifier of this authentication context configuration object. + + jakarta.security.auth.message.config + AuthConfig + + + + 73 + + Get the authentication context identifier corresponding to the request and response objects encapsulated in + messageInfo. + + jakarta.security.auth.message.config + AuthConfig + + + jakarta.security.auth.message.MessageInfo + + + + + 74 + + Get the message layer name of this authentication context configuration object. + + jakarta.security.auth.message.config + AuthConfig + + + + 75 + + Used to determine whether the authentication context configuration object encapsulates any protected authentication + contexts. + + jakarta.security.auth.message.config + AuthConfig + + + + 76 + + Causes a dynamic anthentication context configuration object to update the internal state that it uses to process calls to + its getAuthContext method. + + jakarta.security.auth.message.config + AuthConfig + + + + 77 + + jakarta.security.auth.message.config + AuthConfigFactory + + + + 78 + + Disassociate the listener from all the provider registrations whose layer and appContext values are matched by the corresponding + arguments to this method. + Factories should periodically notify Listeners to effectively detach listeners that are no longer in use. + + jakarta.security.auth.message.config + AuthConfigFactory + + + jakarta.security.auth.message.config.RegistrationListener + java.lang.String + java.lang.String + + + + + 79 + + Get a registered AuthConfigProvider from the factory. + Get the provider of ServerAuthConfig and ClientAuthConfig objects registered for the identified message layer and + application context. All factories shall employ the following precedence rules to select the registered + AuthConfigProvider that matches the layer and appContext arguments: The provider specifically registered + for the values passed as the layer and appContext arguments shall be selected. If no provider is + selected according to the preceding rule, the provider specifically registered for the value passed as + the appContext argument and for all (that is, null) layers shall be selected. If no provider is selected + according to the preceding rules, the provider specifically registered for the value passed as the layer + argument and for all (that is, null) appContexts shall be selected. If no provider is selected according + to the preceding rules, the provider registered for all (that is, null) layers and for all (that is, + null) appContexts shall be selected. If no provider is selected according to the preceding rules, the + factory shall terminate its search for a registered provider. The above precedence rules apply + equivalently to registrations created with a null or non-null className argument. + + jakarta.security.auth.message.config + AuthConfigFactory + + + java.lang.String + java.lang.String + jakarta.security.auth.message.config.RegistrationListener + + + + + 80 + + Get the system-wide AuthConfigFactory implementation. + If a non-null system-wide factory instance is defined at the time of the call, for example, with setFactory, it will + be returned. Otherwise, an attempt will be made to construct an instance of the default + AuthConfigFactory implementation class. The fully qualified class name of the default factory + implementation class is obtained from the value of the authconfigprovider.factory security property. + When an instance of the default factory implementation class is successfully constructed by this method, + this method will set it as the system-wide factory instance. The absolute pathname of the Java security + properties file is JAVA_HOME/lib/security/java.security, where JAVA_HOME refers to the directory where + the JDK was installed. + + jakarta.security.auth.message.config + AuthConfigFactory + + + + 81 + + Get the the registration context for the identified registration. + + jakarta.security.auth.message.config + AuthConfigFactory + + + java.lang.String + + + + + 82 + + Get the registration identifiers for all registrations of the provider instance at the factory. + + jakarta.security.auth.message.config + AuthConfigFactory + + + jakarta.security.auth.message.config.AuthConfigProvider + + + + + 83 + + Cause the factory to reprocess its persisent declarative representation of provider registrations. + A factory should only replace an existing registration when a change of provider implementation class or + initialization properties has occurred. + + jakarta.security.auth.message.config + AuthConfigFactory + + + + 84 + + Registers within the factory and records within the factory's persistent declarative representation of provider registrations + a provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application + context identifier. + This method typically constructs an instance of the provider before registering it with the factory. Factories may + extend or modify the persisted registrations of existing provider instances, if those instances were + registered with ClassName and properties arguments equivalent to those passed in the current call. This + method employs the two argument constructor required to be supported by every implementation of the + AuthConfigProvider interface, and this method must pass a null value for the factory argument of the + constructor. AuthConfigProviderImpl AuthConfigProviderImpl(Map properties, AuthConfigFactory factory). + At most one registration may exist within the factory for a given combination of message layer and + appContext. Any pre-existing registration with identical values for layer and appContext is replaced by + a subsequent registration. When replacement occurs, the registration identifier, layer, and appContext + identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and description + are replaced. Within the lifetime of its Java process, a factory must assign unique registration + identifiers to registrations, and must never assign a previously used registration identifier to a + registration whose message layer and or appContext identifier differ from the previous use. Programmatic + registrations performed by using this method must update (according to the replacement rules described + above) the persistent declarative representation of provider registrations employed by the factory + constructor. + + jakarta.security.auth.message.config + AuthConfigFactory + + + java.lang.String + java.util.Map + java.lang.String + java.lang.String + java.lang.String + + + + + 85 + + Registers within the (in-memory) factory, a provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer + and application context identifier. + This method does NOT effect the factory's persistent declarative representation of provider registrations, and is + intended to be used by providers to perform self-Registration. At most one registration may exist within + the factory for a given combination of message layer and appContext. Any pre-existing registration with + identical values for layer and appContext is replaced by a subsequent registration. When replacement + occurs, the registration identifier, layer, and appContext identifier remain unchanged, and the + AuthConfigProvider (with initialization properties) and description are replaced. Within the lifetime of + its Java process, a factory must assign unique registration identifiers to registrations, and must never + assign a previously used registration identifier to a registration whose message layer and or appContext + identifier differ from the previous use. + + jakarta.security.auth.message.config + AuthConfigFactory + + + jakarta.security.auth.message.config.AuthConfigProvider + java.lang.String + java.lang.String + java.lang.String + + + + + 86 + + Remove the identified provider registration from the factory (and from the persistent declarative representation of + provider registrations, if appropriate) and invoke any listeners associated with the removed + registration. + + jakarta.security.auth.message.config + AuthConfigFactory + + + java.lang.String + + + + + 87 + + Set the system-wide AuthConfigFactory implementation. + If an implementation was set previously, it will be replaced. Listeners are not notified of a change to the registered + factory. + + jakarta.security.auth.message.config + AuthConfigFactory + + + jakarta.security.auth.message.config.AuthConfigFactory + + + + + 88 + + Get the application context identifier from the registration context + + jakarta.security.auth.message.config + AuthConfigFactory.RegistrationContext + + + + 89 + + Get the description from the registration context + + jakarta.security.auth.message.config + AuthConfigFactory.RegistrationContext + + + + 90 + + Get the layer name from the registration context + + jakarta.security.auth.message.config + AuthConfigFactory.RegistrationContext + + + + 91 + + Get the persisted status from the registration context. + + jakarta.security.auth.message.config + AuthConfigFactory.RegistrationContext + + + + 92 + + Get an instance of ClientAuthConfig from this provider. + The implementation of this method returns a ClientAuthConfig instance that describes the configuration of + ClientAuthModules at a given message layer, and for use in an identified application context. + + jakarta.security.auth.message.config + AuthConfigProvider + + + java.lang.String + java.lang.String + javax.security.auth.callback.CallbackHandler + + + + + 93 + If this provider does not support the assignment of a default CallbackHandler to the returned + ClientAuthConfig. + jakarta.security.auth.message.config + AuthConfigProvider + + + java.lang.String + java.lang.String + javax.security.auth.callback.CallbackHandler + + jakarta.security.auth.message.AuthException + + + + 94 + + Get an instance of ServerAuthConfig from this provider. + The implementation of this method returns a ServerAuthConfig instance that describes the configuration of + ServerAuthModules at a given message layer, and for a particular application context. + + jakarta.security.auth.message.config + AuthConfigProvider + + + java.lang.String + java.lang.String + javax.security.auth.callback.CallbackHandler + + + + + 95 + If this provider does not support the assignment of a default CallbackHandler to the returned + ServerAuthConfig. + jakarta.security.auth.message.config + AuthConfigProvider + + + java.lang.String + java.lang.String + javax.security.auth.callback.CallbackHandler + + jakarta.security.auth.message.AuthException + + + + 96 + + Causes a dynamic configuration provider to update its internal state such that any resulting change to its state is + reflected in the corresponding authentication context configuration objects previously created by the + provider within the current process context. + + jakarta.security.auth.message.config + AuthConfigProvider + + + + 97 + + Get a ClientAuthContext instance from this ClientAuthConfig. + The implementation of this method returns a ClientAuthContext instance that encapsulates the ClientAuthModules used to + secure and validate requests/responses associated with the given authContextID. Specifically, this + method accesses this ClientAuthConfig object with the argument authContextID to determine the + ClientAuthModules that are to be encapsulated in the returned ClientAuthContext instance. The + ClientAuthConfig object establishes the request and response MessagePolicy objects that are passed to + the encapsulated modules when they are initialized by the returned ClientAuthContext instance. It is the + modules' responsibility to enforce these policies when invoked. + + jakarta.security.auth.message.config + ClientAuthConfig + + + java.lang.String + javax.security.auth.Subject + java.util.Map + + + + + 98 + If this method fails. + jakarta.security.auth.message.config + ClientAuthConfig + + + java.lang.String + javax.security.auth.Subject + java.util.Map + + jakarta.security.auth.message.AuthException + + + + 99 + + Notify the listener that a registration with which it was associated was replaced or unregistered. + When a RegistrationListener is associated with a provider registration within the factory, the factory must call its + notify method when the corresponding registration is unregistered or replaced. + + jakarta.security.auth.message.config + RegistrationListener + + + java.lang.String + java.lang.String + + + + + 100 + + Get a ServerAuthContext instance from this ServerAuthConfig. + The implementation of this method returns a ServerAuthContext instance that encapsulates the ServerAuthModules used to + validate requests and secure responses associated with the given authContextID. Specifically, this + method accesses this ServerAuthConfig object with the argument authContextID to determine the + ServerAuthModules that are to be encapsulated in the returned ServerAuthContext instance. The + ServerAuthConfig object establishes the request and response MessagePolicy objects that are passed to + the encapsulated modules when they are initialized by the returned ServerAuthContext instance. It is the + modules' responsibility to enforce these policies when invoked. + + jakarta.security.auth.message.config + ServerAuthConfig + + + java.lang.String + javax.security.auth.Subject + java.util.Map + + + + + 101 + If this method fails. + jakarta.security.auth.message.config + ServerAuthConfig + + + java.lang.String + javax.security.auth.Subject + java.util.Map + + jakarta.security.auth.message.AuthException + + + + 102 + + Get the one or more Class objects representing the message types supported by the module. + + jakarta.security.auth.message.module + ClientAuthModule + + + + 103 + + Initialize this module with request and response message policies to enforce, a CallbackHandler, and any module-specific + configuration properties. + The request policy and the response policy must not both be null. + + jakarta.security.auth.message.module + ClientAuthModule + + + jakarta.security.auth.message.MessagePolicy + jakarta.security.auth.message.MessagePolicy + javax.security.auth.callback.CallbackHandler + java.util.Map + + + + + 104 + If module initialization fails, including for the case where the options argument contains + elements that are not supported by the module. + jakarta.security.auth.message.module + ClientAuthModule + + + jakarta.security.auth.message.MessagePolicy + jakarta.security.auth.message.MessagePolicy + javax.security.auth.callback.CallbackHandler + java.util.Map + + jakarta.security.auth.message.AuthException + + + + 105 + + Get the one or more Class objects representing the message types supported by the module. + + jakarta.security.auth.message.module + ServerAuthModule + + + + 106 + + Initialize this module with request and response message policies to enforce, a CallbackHandler, and any module-specific + configuration properties. + The request policy and the response policy must not both be null. + + jakarta.security.auth.message.module + ServerAuthModule + + + jakarta.security.auth.message.MessagePolicy + jakarta.security.auth.message.MessagePolicy + javax.security.auth.callback.CallbackHandler + java.util.Map + + + + + 107 + If module initialization fails, including for the case where the options argument contains + elements that are not supported by the module. + jakarta.security.auth.message.module + ServerAuthModule + + + jakarta.security.auth.message.MessagePolicy + jakarta.security.auth.message.MessagePolicy + javax.security.auth.callback.CallbackHandler + java.util.Map + + jakarta.security.auth.message.AuthException + + + + diff --git a/tck/old-tck/source/internal/docs/jaspic/JASPICSpecAssertions.xml b/tck/old-tck/source/internal/docs/jaspic/JASPICSpecAssertions.xml new file mode 100755 index 0000000..1c1a18f --- /dev/null +++ b/tck/old-tck/source/internal/docs/jaspic/JASPICSpecAssertions.xml @@ -0,0 +1,3483 @@ + + + + + + + 346 + 1 + JASPIC + JASPIC + Jakarta Authentication + 2.0 + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + JASPIC:SPEC:1 + A message processing runtime may acquire the authentication context objects thatit uses to + invoke authentication modules by interacting with an authentication context configuration object + + + authentication + + + + + JASPIC:SPEC:2 + An authentication context configuration object is an implementation of either the + ClientAuthConfig or ServerAuthConfig interface as defined by this specification. + + + authentication + + + + + JASPIC:SPEC:3 + A message processing runtime may acquire authentication context configuration objects + by interacting with a provider of authentication context configuration objects. + + + authentication + + + + + JASPIC:SPEC:4 + A message processing runtime may interact with the factory to obtain or establish the provider + registered for an application context and messaging layer. + + + authentication + + + + + JASPIC:SPEC:5 + Authentication modules should be implemented such that they may be invoked concurrently and + such that they are able to apply and establish independent security identities for concurrent + invocations. + + + Module + + + + + JASPIC:SPEC:6 + In a multi-message authentication scenario, it is the responsibility of the authentication + modules + involved in the authentication to tie together or correlate the messages that comprise the + authentication exchange. In addition to message correlation to tie to together the messages + required to complete an authentication, message correlation may also be employed post-authentication + such that a prior authentication result or session may be applied to a subsequent invocation. Modules + are expected to perform their message correlation function based on the parameters of their invocation + and with the benefit of any additional facilities provided by the invoking runtime (e.g., via their + CallbackHandler). + + + multi-message + + + + + + JASPIC:SPEC:7 + A message processing runtime that wishes to invoke authentication modules configured according + to this specification, must use the AuthConfigFactory.getFactory method to obtain a factory + implementation. + + + + Module + + + + + JASPIC:SPEC:8 + The runtime must invoke the getConfigProvider method of the factory to obtain the + AuthConfigProvider. The runtime must specify appropriate (non-null) layer and application context + identifiers in its call to getConfigProvider. + + + + getConfigProvider + + + + + JASPIC:SPEC:9 + A runtime may continue to reuse a provider for as long as it wishes. However, a runtime that + wishes to be notified of changes to the factory that would cause the factory to return a different + provider for the layer and appContext arguments should include a (non-null) RegistrationListener as an + argument in the call used to acquire the provider. + + + provider + + + + + JASPIC:SPEC:10 + The factory implementation must satisfy the requirements defined by the AuthConfigFactory + class. In particular, it must offer a public, zero argument constructor that supports the construction + and registration of AuthConfigProvider objects from a persistent declarative representation. + + + + AuthConfigFactory + + + + + JASPIC:SPEC:11 + Once the runtime has obtained the appropriate (non-null) AuthConfigProvider, it must obtain + from the provider the authentication context configuration object corresponding to the messaging layer, + its role as client or server, and the application context for which it will be exchanging messages. It + does this by invoking getClientAuthConfig or getServerAuthConfig as appropriate to the role of the + runtime in the message exchange. + + + + AuthConfigProvider + + + + + JASPIC:SPEC:12 + A runtime operating at points 1 and 4 in the messaging model must invoke getClientAuthConfig + to acquire its configuration object. + + + getClientAuthConfig + + + + + JASPIC:SPEC:13 + A runtime operating at points 2 and 3 in the messaging model must invoke getServerAuthConfig + to acquire its configuration object. + + + + getServerAuthConfig + + + + + JASPIC:SPEC:14 + The call to acquire the configuration object must specify the same values for layer and + application context identifier that were used to acquire the provider + + + + + + JASPIC:SPEC:15 + A runtime may continue to reuse an acquired authentication context configuration object for as + long as it is acting as client or server of the corresponding application. A runtime should reacquire an + authentication context configuration object when it is notified (via a RegistrationListener) that it + must reacquire the AuthConfigProvider from which the configuration object was acquired (and after having + reacquired the provider). + + + + authentication + + + + + JASPIC:SPEC:16 + The provider implementation must satisfy the requirements defined by the AuthConfigProvider + interface. In particular, it must return non-null authentication configuration objects. + + + + AuthConfigProvider + + + + + JASPIC:SPEC:17 + When the provider is a dynamic configuration provider, any change to the internal state of the + provider occurring as the result of a call to its refresh method must be recognized by every + authentication context configuration object obtained from the provider. + + + + AuthConfigProvider + + + + + JASPIC:SPEC:18 + The provider implementation must provide a configuration facility that may be used to + configure the information required to initialize authentication contexts for the (one or more) + authentication context configuration scopes (defined by layer and application context) for which the + provider is registered (at the factory). + + + + provider + + + + + JASPIC:SPEC:19 + At points (1) and (2) in the messaging model, the message processing runtime must obtain the + authentication context identifier corresponding to the request message processing being performed by the + runtime. + + + + Identifier + + + + + JASPIC:SPEC:20 + The identifier may be acquired by calling the getOperation method of the authentication + context configuration object (obtained in the preceding step). If the messaging runtime chooses to + obtain the operation identifier by this means, it must provide a MessageInfo object as argument to the + getOperation call, and the MessageInfo must have been initialized such that its getRequestMessage method + will return the request message being processed by the runtime. The type of the returned request message + must be as defined by the profile of this specification being followed by the messaging runtime. + + + + getOperation + + + + + JASPIC:SPEC:21 + Alternatively and depending on the requirements relating to operation identifier inherent in + the profile being followed by the messaging runtime, the runtime may obtain the operation identifier by + other means. Where a profile defines or facilitates other means by which a messaging runtime may acquire + the operation identifier, the identifier acquired by any such means must be equivalent to the identifier + that would be acquired by calling getOperation as described above. + + + + identifier + + + + + JASPIC:SPEC:22 + The configuration implementation must satisfy the requirements defined by the AuthConfig + interface with respect to the getOperation method. + + + + AuthConfig + + + + + JASPIC:SPEC:23 + At points (1) and (2) in the messaging model, the message processing runtime must invoke the + getAuthContext method of the authentication context configuration object (obtained in step 2) to obtain + the authentication context object corresponding to the message that is to be processed. This is + accomplished by invoking getAuthContext with the operation/message identifier corresponding to the + request message and obtained as described above. + + + + getAuthContext + + + + + JASPIC:SPEC:24 + If required by the profile of this specification being followed by the runtime, the call to + getAuthContext must pass a Map containing the required property elements. The value of the Subject + argument provided by the runtime in its call to getAuthContext must correpond to the requirements of the + profile of this specification being followed by the runtime. + + + + profile + + + + + JASPIC:SPEC:25 + Once an authentication context is acquired, it may be reused to process subsequent requests of + the application for which an equivalent authentication context identifier, Subject, and properties Map + (as used in the getAuthContext) applies. + + + + getAuthContext + + + + + JASPIC:SPEC:26 + Runtimes that wish to be dynamic with respect to changes in context configuration, should call + getAuthContext for every request. An authentication context configuration object may return the same + authentication context object for different authentication context identifiers for which the same module + configuration and message protection policy applies. + + + + policy + + + + + JASPIC:SPEC:27 + At points (3) and (4) in the messaging model, the runtime may repeat the context acquisition + performed at point (2) and (1) respectively, or it may reuse the previously acquired context. + + + + context + + + + + JASPIC:SPEC:28 + The configuration implementation must satisfy the requirements defined by the corresponding + ClientAuthConfig or ServerAuthConfig interface with respect to the getAuthContext method. In this + regard, the configuration implementation must determine the authentication modules that are to comprise + the acquired context, and it must provide the context implementation with sufficient information to + initialize the modules of the context. + + + + getAuthContext + + + + + JASPIC:SPEC:29 + The getAuthContext method must return null when no authentication modules are to be invoked + for an identified authentication context at the layer and application context represented by the + configuration object + + + getAuthContext + + + + + JASPIC:SPEC:30 + The AuthConfigProvider from which the authentication context configuration object was acquired + must provide a configuration facility by which the information required to initialize authentication + contexts may be configured and associated with one or more authentication context identifiers within the + (one or more) layer and application context scopes for which the provider is registered (at the + factory). + + + + AuthConfigProvider + + + + + JASPIC:SPEC:31 + Every context implementation must satisfy the requirements as defined by the corresponding + ClientAuthContext or ServerAuthContext interface. + + + + ClientAuthContext + ServerAuthContext + + + + + JASPIC:SPEC:32 + Every context must delegate calls made to the methods of its corresponding ClientAuth or + ServerAuth interface to the corresponding methods of its one or more authentication modules. + + + + ClientAuth + ServerAuth + + + + + JASPIC:SPEC:33 + When a context encapsulates multiple authentication modules, the context must embody the + control logic to determine which modules of the context are to be invoked and in what order. Contexts + which encapsulate alternative sufficient modules, must ensure that the same message values are passed to + each invoked alternative of the context. When a context invokes multiple authentication modules, the + context must combine the AuthStatus values returned by the invoked authentication modules to establish + the AuthStatus value returned by the context to the messaging runtime. The context implementation must + define the logic for combining the returned AuthStatus values. + + + + AuthStatus + + + + + JASPIC:SPEC:34 + If a non-null authentication context object is returned by getAuthContext, the corresponding + message processing runtime must invoke the methods of the acquired authentication context to process the + corresponding request and response messages as defined below. Otherwise, the message processing runtime, + must proceed with its normal processing of the corresponding messages and without invoking the methods + of an authentication context object. + + + + getAuthContext + + + + + JASPIC:SPEC:35 + At point (1) in the message processing model : the message processing runtime must call the + secureRequest method of the ClientAuthContext. + + + + secureRequest + + + + + JASPIC:SPEC:36 + (At point 1 in message processing model) The messageInfo argument to the call must have been + initialized such that its getRequestMessage method will return the request message being processed by + the runtime. The type of the returned request message must be as defined by the profile being followed. + + + + messageInfo + + + + + JASPIC:SPEC:37 + (At point 1 in message processing model) If a non-null Subject was used to acquire the + ClientAuthContext, the same Subject must be passed as the clientSubject in this call. If a non-null + clientSubject is used in this call, it must not be read-only, and the same clientSubject argument must + be passed in all calls to validateResponse made for the one or more responses processed to complete the + message exchange. + + + + Subject + + + + + JASPIC:SPEC:38 + (At point 1 in message processing model) If the call to secureRequest returns: + AuthStatus.SEND_SUCCESS - the runtime should send (without calling secureRequest) the request message + acquired by calling messageInfo.getRequestMessage. After sending the request, the runtime should proceed + to point (4) in the message processing model (to receive and validate the response). + + + + secureRequest + + + + + JASPIC:SPEC:39 + (At point 1 in message processing model) If the call to secureRequest returns: + AuthStatus.SEND_CONTINUE - the module has returned, in messageInfo, an initial request message to be + sent. Moreover, the module is informing the client runtime that it will be required to continue the + message dialog by sending the message resulting from validation of the response to the initial message. + If the runtime will be unable to continue the dialog by sending the message resulting from validation of + the response, the runtime must not send the initial request and it must convey its inability by + returning an error to the client application. Otherwise, the runtime should send (without calling + secureRequest) the request message acquired by calling messageInfo.getRequestMessage. + + + + secureRequest + + + + + JASPIC:SPEC:40 + (At point 1 in message processing model) If the call to validateRequest returns: + AuthStatus.FAILURE (Befor service Invocation) - The runtime should return an error to the client + application. The runtime should derive the returned error from the response message acquired by calling + messageInfo.getResponseMessage. + + + secureRequest + + + + + JASPIC:SPEC:41 + (At point 1 in message processing model) If the call to secureRequest throws an AuthException + - the runtime should use the exception to convey to the client runtime that the request failed. + + + + secureRequest + + + + + JASPIC:SPEC:42 + At point (4) in the message processing model: the message processing runtime must call the + validateResponse method of the ClientAuthContext. + + + validateResponse + + + + + JASPIC:SPEC:43 + In the call made to validateResponse, the runtime must pass the same MessageInfo instance that + was passed to secureRequest (at the start of the message exchange). The messageInfo argument must have + been initialized such that its getResponseMessage method will return the response message being + processed by the runtime.The type of the required return messages must be as defined by the profile + being followed. + + + + validateResponse + + + + + JASPIC:SPEC:44 + The value of the clientSubject argument to the (validateResponse) call must be the same as + that passed in the call to secureRequest for the corresponding request. + + + + clientSubject + + + + + JASPIC:SPEC:45 + The serviceSubject argument to the (validateResponse) call may be non-null, in which it may be + used by modules to store Principals and credentials determined to pertain to the source of the response. + + + + serviceSubject + + + + + JASPIC:SPEC:46 + If the call to validateResponse returns: AuthStatus.SUCCESS - The runtime should use the + response message acquired by calling messageInfo.getResponseMessage.to create the return value to be + returned to the client. + + + + validateResponse + + + + + JASPIC:SPEC:47 + If the call to validateResponse returns: AuthStatus.SEND_CONTINUE - if the runtime it is + unable to process this status value it must return an error to the client application indicating its + inability to process this status value. To process this status value, the runtime must send (without + calling secureRequest) the (continuation) request message obtained by calling + messageInfo.getRequestMessage, and it must receive and process via validateResponse (at least) the next + corresponding response or error (before returning a value to the client). + + + + validateResponse + + + + + JASPIC:SPEC:48 + If the call to validateResponse returns: AuthStatus.FAILURE- the runtime should return an + error to the client application. The runtime should derive the returned error from the response message + acquired by calling messageInfo.getResponseMessage. + + + + validateResponse + + + + + JASPIC:SPEC:49 + If the call to validateResponse throws an AuthException - runtime should use the exception to + convey to the client runtime that the request failed. + + + + validateResponse + + + + + JASPIC:SPEC:50 + At point (2) in the message processing model: the message processing runtime must call the + validateRequest method of the ServerAuthContext. + + + + validateRequest + + + + + JASPIC:SPEC:51 + (at point 2 in MPR model) The messageInfo argument to the call must have been initialized such + that its getRequestMessage method will return the request message being processed by the runtime. For + some profiles of this specification, the runtime must also initialize messageInfo such that its + getResponseMessage method will return the response message being processed by the runtime. The type of + the required return messages must be as defined by the profile being followed. + + + + messageInfo + + + + + JASPIC:SPEC:52 + (At point (2) in the message processing model) The clientSubject argument must be non-null and + it must not be read-only. + + + clientSubject + + + + + JASPIC:SPEC:53 + (At point (2) in the message processing model) If a non-null Subject was used to acquire the + ServerAuthContext, the same Subject must be passed as the serviceSubject in this call. + + + serviceSubject + + + + + JASPIC:SPEC:313 + (At point (2) in the message processing model) If a non-null serviceSubject is used in this + call, it must not be read-only. + + + serviceSubject + + + + + JASPIC:SPEC:314 + (At point (2) in the message processing model) the same serviceSubject must be passed in the + call to secureResponse for the corresponding response (if there is one). + + + serviceSubject + + + + + JASPIC:SPEC:54 + If the call to validateRequest returns: AuthStatus.SUCCESS - the runtime should proceed to + authorize the request using the clientSubject, perform the application request processing (depending on + the authorization result), and proceed to point (3) as appropriate. + + + + validateRequest + + + + + JASPIC:SPEC:55 + If the call to validateRequest returns: AuthStatus.SEND_SUCCESS - The runtime must NOT proceed + to authorize the request or perform the application request processing. + + + validateRequest + + + + + JASPIC:SPEC:56 + If the call to validateRequest returns: AuthStatus.SEND_CONTINUE - The runtime must NOT + proceed to authorize the request or perform the application request processing. + + + validateRequest + + + + + JASPIC:SPEC:57 + If the call to validateRequest returns: AuthStatus.SEND_FAILURE - (If the failure occurred + after the service invocation), the runtime must perform whatever processing it requires to complete the + processing of a request that failed after a successful service invocation, and prior to communicating + the invocation result to the client runtime. + + + validateRequest + + + + + JASPIC:SPEC:315 + If the call to validateRequest returns: AuthStatus.SEND_FAILURE - (If the failure occurred + befor the service invocation), the runtime must NOT proceed to authorize the request or perform the + application request processing. + + + validateRequest + + + + + JASPIC:SPEC:58 + If the call to validateRequest throws an AuthException (Befor Service Invocation) - the + runtime must NOT proceed to authorize the request or perform the application request processing. + + + validateRequest + + + + + JASPIC:SPEC:316 + If the call to validateRequest throws an AuthException - (If the failure occurred after the + service invocation) the runtime must perform whatever processing it requires to complete the processing + of a request that failed after a successful service invocation, and prior to communicating the + invocation result to the client runtime. + + + validateRequest + + + + + JASPIC:SPEC:59 + At point (3) in the message processing model: the message processing runtime must call the + secureResponse method of the ServerAuthContext. + + + secureResponse + + + + + JASPIC:SPEC:60 + In the call made to secureResponse, the runtime must pass the same MessageInfo instance that + was passed to validateRequest (for the corresponding request message). The messageInfo argument must + have been initialized such that its getResponseMessage method will return the response message being + processed by the runtime. The type of the required return messages must be as defined by the profile + being followed. + + + + secureResponse + + + + + JASPIC:SPEC:61 + The value of the serviceSubject argument to the (secureResponse) call must be the same as that + passed in the call to validateRequest for the corresponding request. + + + + serviceSubject + + + + + JASPIC:SPEC:62 + If the call to secureResponse returns: AuthStatus.SEND_SUCCESS - the runtime should send + (without calling secureResponse) the response message acquired by calling messageInfo.getResponseMessage + at which time, the processing of the application request and its corresponding response will be + complete. + + + + secureResponse + + + + + JASPIC:SPEC:63 + If the call to secureResponse returns: AuthStatus.SEND_CONTINUE - the runtime should send + (without calling secureResponse) the response message acquired by calling + messageInfo.getResponseMessage. The processing of the response is not finished, and as such, its outcome + is not yet known. + + + + secureResponse + + + + + JASPIC:SPEC:64 + If the call to secureResponse returns: AuthStatus.SEND_FAILURE - the runtime must perform + whatever processing it requires to complete the processing of a request that failed after (or during) + service invocation, and prior to communicating the invocation result to the client runtime. This may + include sending (without calling secureResponse) the response message acquired by calling + messageInfo.getResponseMessage. + + + + secureResponse + + + + + JASPIC:SPEC:65 + If the call to secureResponse throws an AuthException - the runtime must perform whatever + processing it requires to complete the processing of a request that failed after (or during) service + invocation, and prior to communicating the invocation result to the client runtime. the runtime may send + (without calling secureResponse) an appropriate response message of its choice. if a failure message is + returned, it should indicate that the failure in request processing occurred after the successful + invocation of the service. + + + + secureResponse + + + + + JASPIC:SPEC:66 + The authentication module implementations within the context must satisfy the requirements as + defined by the corresponding ClientAuthModule or ServerAuthModule interface. + + + + ClientAuthModule + ServerAuthModule + + + + + JASPIC:SPEC:67 + The message layer value used to select the AuthConfigProvider and ServerAuthConfig objects for + this (servlet) profile must be HttpServlet + + + + Identifier + + + + + JASPIC:SPEC:68 + The application context identifier (that is, the appContext parameter value) used to select + the AuthConfigProvider and ServerAuthConfig objects for a specific application shall be the String value + constructed by concatenating the host name, a blank separator character, and the decoded context path + corresponding to the web module. + + + + identifier + + + + + JASPIC:SPEC:69 + The MessageInfo argument used in any call made by the message processing runtime to + validateRequest or secureResponse must have been initialized such that the non-null objects returned by + the getRequestMessage and getResponseMessage methods of the MessageInfo are an instanceof + HttpServletRequest and HttpServletResponse, respectively. + + + + MessageInfo + + + + + JASPIC:SPEC:70 + The getSupportedMessageTypes method of all authentication modules integrated for use with this + profile, must include jakarta.servlet.http.HttpServletRequest.class and + jakarta.servlet.http.HttpServeletResponse.class in its return value. + + + + getSupportedMessageTypes + + + + + JASPIC:SPEC:71 + The CallbackHandler passed to ServerAuthModule.initialize is determined by the handler + argument passed in the AuthConfigProvider.getServerAuthConfig call that acquired the corresponding + authentication context configuration object. The handler argument must not be null. + + + getServerAuthConfig + + + + + JASPIC:SPEC:72 + The CallbackHandler passed to ServerAuthModule.initialize must support the following + callbacks: CallerPrincipalCallback, GroupPrincipalCallback, PasswordValidationCallback. + + + + CallbackHandler + + + + + JASPIC:SPEC:73 + The argument handler and the CallbackHandler passed through to the authentication modules must + be initialized with any application context required to process its supported callbacks on behalf of the + corresponding application. + + + + CallbackHandler + + + + + JASPIC:SPEC:318 + The factory implementation returned by calling the getFactory method of the abstract + AuthConfigFactory class must have been configured such that it returns a non-null AuthConfigProvider for + those application contexts for which pluggable authentication modules have been configured at the + ?HttpServlet? layer. + + + + CallbackHandler + + + + + JASPIC:SPEC:74 + For each application context for which it is servicing requests, the runtime must call + getConfigProvider to acquire the provider object corresponding to the layer and application context. The + layer and appContext arguments to getConfigProvider must be as defined in Section 3.1, Message Layer + Identifier and Section 3.2, Application Context Identifier respectively + + + + getConfigProvider + + + + + JASPIC:SPEC:75 + If a non-null AuthConfigProvider is returned, the messaging runtime must call + getServerAuthConfig on the provider to obtain the authentication context configuration object pertaining + to the application context at the layer. The layer and appContext arguments of the call to + getServerAuthConfig must be the same as those used to acquire the provider, and the handler argument + must be as defined in Section 3.5, CallbackHandler Requirements. + + + + getServerAuthConfig + + + + + JASPIC:SPEC:76 + A null return value from getConfigProvider indicates that pluggable authentication modules + have not been configured at the layer for the application context and that the messaging runtime must + proceed to perform its servlet security constraint processing without reliance on this profile. + + + + getConfigProvider + + + + + JASPIC:SPEC:77 + When a non-null AuthConfigProvider is returned by the factory, the provider must have been + configured with the information required to initialize the authentication contexts for the (one or more) + authentication context configuration scopes (defined by layer and application context) for which the + provider is registered (at the factory). + + + + AuthConfigProvider + + + + + JASPIC:SPEC:78 + When a non-null AuthConfigProvider is returned by the factory, the messaging runtime must call + getAuthContext on the authentication context configuration object (obtained from the provider). + + + + AuthConfigProvider + + + + + JASPIC:SPEC:79 + For all values of the authContextID argument that satisfy the requirements of Section 3.7.1, + the call to getAuthContext must return a non-null authentication context. + + + + getAuthContext + + + + + JASPIC:SPEC:80 + the authentication context identifier used in the call to getAuthContext must be equivalent to + the value that would be acquired by calling getAuthContextID with the MessageInfo that will be used in + the call to validateRequest. + + + + identifier + + + + + JASPIC:SPEC:81 + A null value may be passed as the Subject argument in the getAuthContext call. + + + getAuthContext + + + + + JASPIC:SPEC:300 + If the runtime is a JSR 115 compatible Servlet container, the properties argument passed in + all calls to getAuthContext must contain the following key-value pair: + (key) jakarta.security.jacc.PolicyContext + (value) The PolicyContext identifier value that the container must set. + + + getAuthContext + + + + + JASPIC:SPEC:83 + When the runtime is not a JSR 115 compatible Servlet container, the properties argument used + in all calls to getAuthContext must not include a jakarta.security.jacc.PolicyContext key-value pair, + and a null value may be passed for the properties argument. + + + getAuthContext + + + + + JASPIC:SPEC:84 + Each ServerAuthContext obtained via getAuthContext must initialize its encapsulated + ServerAuthModule objects with a non-null value for requestPolicy. The encapsulated authentication + modules may be initialized with a null value for responsePolicy. + + + + getAuthContext + + + + + JASPIC:SPEC:85 + The requestPolicy used to initialize the authentication modules of the ServerAuthContext must + be constructed such that the value obtained by calling isMandatory on the requestPolicy accurately + reflects whether (i.e., true return value) or not (i.e, false return value) authentication is required + to access the web resource corresponding to the HttpServletRequest to which the ServerAuthContext will + be applied. + + + + requestPolicy + + + + + JASPIC:SPEC:86 + The message processing runtime is responsible for determining if authentication is required + and must convey the results of its determination as described in Section 3.8.1, 'MessageInfo + Requirements,' on page 29. + + + auth-constraint + + + + + JASPIC:SPEC:87 + Calling getTargetPolicies on the request MessagePolicy must return an array containing at + least one TargetPolicy whose ProtectionPolicy will be interpreted by the modules of the context to mean + that the source of the corresponding targets within the message is to be authenticated. To that end, + calling the getID method on the ProtectionPolicy must return one of the following values: + ProtectionPolicy.AUTHENTICATE_SENDER, ProtectionPolicy.AUTHENTICATE_CONTENT + + + + getTargetPolicies + + + + + JASPIC:SPEC:88 + At point (2) in the message processing model, the runtime must call validateRequest on the + ServerAuthContext. + + + validateRequest + + + + + JASPIC:SPEC:89 + If the request has satisfied the connection requirements, the message processing runtime must + call validateRequest independent of whether or not access to the resource would be authorized prior to + the call to validateRequest. validateRequest must be called for all requests, including requests to a + form-based login form. + + + + validateRequest + + + + + JASPIC:SPEC:90 + If the call to validateRequest returns AuthStatus.SUCCESS, the runtime must establish return + values for getUserPrincipal, getRemoteUser, and getAuthType as defined in Section 3.8.4. + + + + validateRequest + + + + + JASPIC:SPEC:301 + If the applicable requestPolicy indicates that authentication is NOT required, the runtime may + choose to continue the invocation of the resource under the runtime?s representation of the + unauthenticated caller identity. A runtime must not choose to continue the invocation if the + HttpServletResponse.isCommitted() returns true. + + + validateRequest + + + + + JASPIC:SPEC:91 + In a JSR 115 compatible runtime, the identity must be comprised of exactly the Principal + objects of the clientSubject. + + + + clientSubject + + + + + JASPIC:SPEC:92 + In a non-JSR 115 compatible Servlet runtime, the identity must include the caller Principal + (established during the validateRequest processing using the corresponding CallerPrincipalCallback). + (and may include any of the Principal objects of the clientSubject.) + + + Principal + + + + + JASPIC:SPEC:93 + If the request is not authorized, the runtime must return the HTTP status code required by the + Servlet spec. + + + secureResponse + + + + + JASPIC:SPEC:317 + The request must be dispatched to the resource if the request was determined to be authorized; + otherwise it must NOT be dispatched and the runtime must proceed to point (3) in the message processing + model. + + + secureResponse + + + + + JASPIC:SPEC:302 + If the request is dispatched to the resource and the resource invocation throws an exception + to the runtime, the runtime must set, within the response, an HTTP status code which satisfies any + applicable requirements defined within the servlet specification. + + + secureResponse + + + + + JASPIC:SPEC:303 + If the request is dispatched to the resource, and the resource was configured to run-as its + caller, then for invocations originating from the resource where caller propagation is required, the + identity established using the CallerPrincipalCallback must be used as the propagated identity + + + secureResponse + + + + + JASPIC:SPEC:94 + The call to secureResponse must not be made if the resource throws an exception to the calling + runtime. + + + + secureResponse + + + + + JASPIC:SPEC:304 + If invocation of the resource completes without throwing an exception, the runtime must + proceed to point (3) in the message processing model. + + + secureResponse + + + + + JASPIC:SPEC:305 + At point (3) in the message processing model, the runtime must call secureResponse on the same + ServerAuthContext used in the corresponding call to validateRequest and with the same MessageInfo + object. + + + secureResponse + + + + + JASPIC:SPEC:95 + The messageInfo argument used in the call to validateRequest must have been initialized by the + runtime such that its getRequestMessage and getResponseMessage methods will return the + HttpServletRequest and HttpServletResponse objects corresponding to the messages (respectively) being + processed by the runtime. This must be the case even when the target of the request is a static page + (that is, not a servlet). + + + + validateRequest + + + + + JASPIC:SPEC:306 + This profile requires that the message processing runtime conditionally establish the + following key-value pair within the Map of the MessageInfo object passed in the calls to + getAuthContextID, validateRequest, and secureResponse. + (key) jakarta.security.auth.message.MessagePolicy.isMandatory + (val) Any non-null String value, s, for which + Boolean.valueOf(s).booleanValue() == true. + + The MessageInfo map must contain this key and its associated value, if and only if authentication is required to + perform the resource access corresponding to the HttpServletRequest to which the ServerAuthContext will + be applied. + + + validateRequest + + + + + JASPIC:SPEC:307 + Authentication is required if use of the HTTP method of the HttpServletRequest at the resource + identified by the HttpServletRequest is covered by a Servlet auth-constraint, or in a JSR 115 compatible + runtime, if the corresponding WebResourcePermission is NOT granted2 to an unauthenticated caller + + + validateRequest + + + + + JASPIC:SPEC:319 + In a JSR 115 compatible runtime, the corresponding WebResourcePermission may be constructed + directly from the HttpServletRequest as follows: public WebResourcePermission(HttpServletRequest + request); The authentication context configuration system must use the value of this property to + establish the corresponding value within the requestPolicy passed to the authentication modules of the + ServerAuthContext acquired to process the MessageInfo.t + + + validateRequest + + + + + JASPIC:SPEC:96 + A new clientSubject must be instantiated and passed in the call to validateRequest. + + + + clientSubject + + + + + JASPIC:SPEC:97 + validateRequest may be called either before the service invocation (to establish the caller + identity) or after the service invocation (when a multi-message dialog is required to secure the + response). The module implementation is responsible for recording any state and performing any + processing required to differentiate these two different types of calls to validateRequest. + + + + validateRequest + + + + + JASPIC:SPEC:98 + When validateRequest is called before the service invocation on a module initialized with a + mandatory requestPolicy (as defined by the return value from requestPolicy.isMandatory()), the module + must only return AuthStatus.SUCCESS if it was able to completely satisfy the request authentication + policy. In this case, the module (or its context) must also have used the CallbackHandler passed to it + by the runtime to handle a CallerPrincipalCallback using the clientSubject as argument to the callback. + If more than one module of a context uses the CallbackHandler to handle this callback, the context is + responsible for coordinating the calls such that the appropriate caller principal value is established. + + + + validateRequest + + + + + JASPIC:SPEC:99 + If the module was not able to completely satisfy the request authentication policy, it must: + return AuthStatus.SEND_CONTINUE - if it has established a response (available to the runtime by calling + messageInfo.getResponseMessage) that must be sent by the runtime for the request validation to be + effectively continued by the client. The module must have set the HTTP status code of the response to a + value (e.g., HTTP 401 unauthorized, HTTP 303 see other, or HTTP 307 temporary redirect) that will + indicate to the client that it should retry the request. + + + + AuthStatus + + + + + JASPIC:SPEC:100 + If the module was not able to completely satisfy the request authentication policy, it must: + return AuthStatus.SEND_FAILURE - if the request validation failed, and when the client should not retry + the request. The module must have established a response message (available to the runtime by calling + messageInfo.getResponseMessage) that may be sent by the runtime to inform the client that the request + failed. The module must have set the HTTP status code of the response to a value (e.g., HTTP 403 + forbidden or HTTP 404 not found) that will indicate to the client that it should NOT retry the request. + The runtime may choose not to send a response message, or to send a different response message (given + that it also contains an analogous HTTP status code). + + + + AuthStatus + + + + + JASPIC:SPEC:101 + If the module was not able to completely satisfy the request authentication policy, it must: + throw an AuthException - if the request validation failed, and when the client should not retry the + request, and when the module has not defined a response, to be sent by the runtime. If the runtime + chooses to send a response, it must define the HTTP status code and descriptive content (of the + response). The HTTP status code of the response must indicate to the client (e.g., HTTP 403 forbidden, + HTTP 404 not found, or HTTP 500 internal server error) that the request failed and that it should NOT be + retried. The decriptive content set in the response may be obtained from the AuthException. + + + + AuthException + + + + + JASPIC:SPEC:102 + When validateRequest is called before the service invocation on a module that was initialized + with an optional requestPolicy (i.e., requestPolicy.isMandatory() returns false), the module should + attempt to satisfy the request authentication policy, but it must do so without requiring additional + messages or interactions involving the client. + + + + requestPolicy + + + + + JASPIC:SPEC:103 + If the module returns AuthStatus.SUCCESS (and the authentication policy was satisfied), the + module (or its context) must employ a CallerPrincipalCallback. If the authentication policy was not + satisfied, and yet the module chooses to return AuthStatus.SUCCESS, the module (or its context) must use + a CallerPrincipalCallback to establish the containers representation of the unauthenticated caller + within the clientSubject. + + + + AuthStatus + + + + + JASPIC:SPEC:320 + If the module throws an AuthException, or returns any value other that AuthStatus.SUCCESS, the + runtime must NOT proceed to the service invocation. The runtime must process an AuthException as + described above for a request with a mandatory requestPolicy. + + + AuthStatus + + + + + JASPIC:SPEC:104 + When validateRequest is called after the service invocation, the module must return + AuthStatus.SEND_SUCCESS when the module has successfully secured the application response message and + made it available through messageInfo.getResponseMessage. The module must have set the HTTP status code + within the response to HTTP 200 (OK). For the request to be successfully completed, the runtime must + send the response message returned by the module. + + + + validateRequest + + + + + JASPIC:SPEC:105 + If the module returns AuthStatus.SEND_FAILURE, it must have established a response message in + messageInfo, and it must have set the HTTP status code within the response to HTTP 500 (internal server + error). The runtime may choose not to send a response message, or to send a different response message + (given that it also contains an HTTP 500 status code). + + + + AuthStatus + + + + + JASPIC:SPEC:106 + When the module throws an AuthException, the runtime may chose not to send a response. If the + runtime sends a response, the runtime must set the HTTP status code to HTTP 500 (internal server error), + and the runtime must define the decriptive content of the response (perhaps by obtaining it from the + AuthException). + + + + AuthException + + + + + JASPIC:SPEC:107 + The module must return AuthStatus.SEND_CONTINUE if the response dialog is to continue. This + status value is used to inform the calling runtime that, to successfully complete the response + processing, it will need to be capable of continuing the message dialog by processing at least one + additional request/response exchange (after having sent the response message returned in messageInfo). + The module must have established (in messageInfo) a response message that will cause the client to + continue the response processing (i.e., retry the request). For the response processing to be + successfully completed, the runtime must send the response message returned by the module. + + + + AuthStatus + + + + + JASPIC:SPEC:108 + + The return value and AuthException semantics of secureResponse are as defined in Section 3.8.3.2, “validateRequest + After Service Invocation.†This profile places no requirements on authentication modules with respect to + interpreting responsePolicy values. + + + secureResponse + + + + Note 1: This chapter definition seems to have been changed since + original assertion was created so we are updating this + particular assertions description since no test currently tests this. + Note 2: This assertion directly implies that the secureResponse MUST be + called AFTER service invocation except for the case where service + invocation throws an exception. + Note 3: see https://java.net/jira/browse/JASPIC_SPEC-9 for more details + + + + JASPIC:SPEC:308 + A ServerAuthModule must only call MessageInfo.setResponseMessage() to wrap or unwrap the + existing response within MessageInfo. + + + secureResponse + + + + + JASPIC:SPEC:309 + During secureResponse processing, a ServerAuthModule must unwrap the messages in MessageInfo + that it wrapped during its validateRequest processing. The unwrapped values must be established in + MessageInfo when secureResponse returns. + + + secureResponse + + + + + JASPIC:SPEC:310 + During validateRequest processing, a ServerAuthModule must NOT unwrap a message in + MessageInfo, and must NOT establish a wrapped message in MessageInfo unless the ServerAuthModule returns + AuthStatus.SUCCESS. + + + secureResponse + + + + + JASPIC:SPEC:311 + When a ServerAuthModule returns a wrapped message in MessageInfo, or unwraps a message in + MessageInfo, the message processing runtime must ensure that the HttpServletRequest and + HttpServletResponse objects established by the ServerAuthModule are used in downstream processing. + + + secureResponse + + + + + JASPIC:SPEC:321 + The message processing runtime must fulfill the requirements defined in this section when, at + point (2) in the messaging model, validateRequest returns AuthStatus.SUCCESS. In this case, the runtime + must modify the HttpServletRequest as necessary to ensure that the Principal returned by + getUserPrincipal and the String returned by getRemoteUser correspond, respectively, to the Principal + established by validateRequest (via the CallerPrincipalCallback) and to the String obtained by calling + getName on the established Principal. (Except when getUserPrincipal returns null; in which case the + value returned by getRemoteUser must be null) + + + validateRequest + + + + + JASPIC:SPEC:322 + The runtime must also ensure that the value returned by calling getAuthType on the + HttpServletRequest is consistent in terms of being null or non-null with the value returned by + getUserPrincipal. + + + validateRequest + + + + + JASPIC:SPEC:323 + When getAuthType is to return a non-null value, the runtime must consult the Map of the + MessageInfo object used in the call to validateRequest to determine if it contains an entry for the key + identified in the following table. If the Map contains an entry for the key, the runtime must obtain + (from the Map) the value corresponding to the key and establish it as the getAuthType return value. + (from Table 2-2, the key=jakarta.servlet.http.authType and the value=a non-null String value) + + + validateRequest + + + + + JASPIC:SPEC:324 + (When getAuthType is to return a non-null value, the runtime must consult the Map of the + MessageInfo object used in the call to validateRequest to determine if it contains an entry for the key + identified in the following table.) If the Map does not contain an entry for the key, and an auth-method + is defined in the login-config element of the deployment descriptor for the web application, the runtime + must establish the value from the auth-method as the value returned by getAuthType. + + + validateRequest + + + + + JASPIC:SPEC:325 + (When getAuthType is to return a non-null value, the runtime must consult the Map of the + MessageInfo object used in the call to validateRequest to determine if it contains an entry for the key + identified in the following table.) If the Map does not contain an entry for the key, and the deployment + descriptor does not define an auth-method, the runtime must establish a non-null value of its choice as + the value returned by getAuthType. + + + validateRequest + + + + + JASPIC:SPEC:109 + This profile is composed of two internal profiles that partition the requirements of the + profile into those that must be satisfied by client runtimes and those that must be satisfied by server + runtimes. This profile is equally applicable to SOAP versions 1.1 and 1.2. + + + + SOAP + + + + + JASPIC:SPEC:110 + The message layer value used to select the AuthConfigProvider and ServerAuthConfig objects for + this profile must be SOAP + + + + AuthConfigProvider + ServerAuthConfig + + + + + JASPIC:SPEC:111 + The application context identifier (i.e., the appContext parameter value) used by a client + runtime to select the AuthConfigProvider, ClientAuthConfig objects pertaining to a client-side + application context configuration scope must be as defined in Section 4.8.1. Similarly the application + context identifier used by a server runtime to select the AuthConfigProvider and ClientAuthConfig + objects pertaining to an server-side application context configuration scope must be defined in Section + 4.9.1 + + + + appContext + + + + + JASPIC:SPEC:112 + The MessageInfo argument used in any call made by the message processing runtime to + secureRequest, validateResponse, validateRequest, or secureResponse must have been initialized such that + the non-null objects returned by the getRequestMessage and getResponseMessage methods of the MessageInfo + are an instance of jakarta.xml.soap.SOAPMessage. + + + + MessageInfo + + + + + JASPIC:SPEC:113 + The getSupportedMessageTypes method of all authentication modules integrated for use with this + profile, must include jakarta.xml.soap.SOAPMessage class in its return value. + + + + getSupportedMessageTypes + + + + + JASPIC:SPEC:114 + The CallbackHandler passed to an authentication module's initialize method is determined by + the handler argument passed in the call to AuthConfigProvider.getClientAuthConfig or getServerAuthConfig + that acquired the corresponding authentication context configuration object. The handler argument must + not be null, and the argument handler and the CallbackHandler passed to the initialize method of an + authentication modules should support the following callbacks, and it must be possible to configure the + runtime such that the CallbackHandler passed at module initialization supports the following callbacks + (in addition to any others required to be supported by the applicable internal profile): + CertStoreCallback, PrivateKeyCallback, SecretKeyCallback, TrustStoreCallback + + + + CallbackHandler + + + + + JASPIC:SPEC:115 + The CallbackHandler must be initialized with any application context required to process the + supported callbacks on behalf of the corresponding application. + + + + CallbackHandler + + + + + JASPIC:SPEC:116 + The factory implementation returned by calling the getFactory method of the abstract + AuthConfigFactory class must have been configured such that it returns a non-null AuthConfigProvider for + those application contexts for which pluggable authentication modules have been configured at the SOAP + layer. + + + + factory + + + + + JASPIC:SPEC:117 + For each application context for which it is servicing requests, the runtime must call + getConfigProvider to acquire the provider object corresponding to the layer and application context. The + layer and appContext arguments to getConfigProvider must be as defined in Section 4.1, Message Layer + Identifier and Section 4.2, Application Context Identifier respectively. + + + + getConfigProvider + + + + + JASPIC:SPEC:118 + A null return value from getConfigProvider indicates that pluggable authentication modules + have not been configured at the layer for the application context and that the messaging runtime must + proceed to perform its SOAP message processing without reliance on this profile. + + + + getConfigProvider + + + + + JASPIC:SPEC:119 + In cases where a runtime chooses to delegate authentication session management to + authentication contexts and their contained authentication modules, the AuthConfigPrivider must have + been configured, as described in Section 2.1.2.2, What the Provider Must Do, to return non-null + authentication contexts for all operation identifiers, independent of whether or not the corresponding + operation is protected. + + + + AuthConfigPrivider + + + + + JASPIC:SPEC:120 + If getOperation returns a non-null operation identifier, then the operation identifier must be + the String value corresponding to the operation name appearing in the service description (i.e., WSDL). + + + + getOperation + + + + + JASPIC:SPEC:121 + As + defined in Section 2.1.3, “Acquire AuthContext Identifier,†on page 17, the authentication context + identifier used in the call to getAuthContext must be equivalent to the value that would be acquired by + calling getAuthContextID with the MessageInfo that will be used in the corresponding call to + secureRequest (by a client runtime) or validateRequest (by a server runtime). + + + + + Authentication Context Identifiers + + + + + JASPIC:SPEC:122 + Each authentication context object obtained via getAuthContext must initialize its + encapsulated authentication modules with a non-null requestPolicy and/or a non-null responsePolicy; such + that at least one of requestPolicy or responsePolicy is not null. + + + + getAuthContext + + + + + JASPIC:SPEC:123 + Unless the client runtime is embedded in a server runtime (e.g.; an invocation of a web + service by a servlet running in a Servlet container), The CallbackHandler passed to + ClientAuthModule.initialize must support the following callbacks: NameCallback, PasswordCallback + + + + ClientAuthModule + + + + + JASPIC:SPEC:124 + If a non-null AuthConfigProvider is returned (by the call to getConfigProvider), the messaging + runtime must call getClientAuthConfig on the provider to obtain the authentication context configuration + object pertaining to the application context at the layer. The layer and appContext arguments of the + call to getClientAuthConfig must be the same as those used to acquire the provider, and the handler + argument must be as defined in Section 4.8.1, ?CallbackHandler Requirements? for a client runtime. + + + + getClientAuthConfig + + + + + JASPIC:SPEC:125 + + If a non-null AuthConfigProvider is returned (by the call to getConfigProvider), the messaging runtime + must call getClientAuthConfig on the provider to obtain the authentication context configuration object + pertaining to the application context at the layer. The layer and appContext arguments of the call to + getClientAuthConfig must be the same as those used to acquire the provider, and the handler argument + must be as defined in Section 4.8.2, CallbackHandler Requirements, for a client runtime. + + + + getAuthContext + + + + + JASPIC:SPEC:126 + A null return value from getAuthContext indicates that pluggable authentication modules have + not been configured for the operation within the authentication context configuration scope, and that + the client runtime must proceed to perform its SOAP message processing without reliance on this profile. + + + + getAuthContext + + + + + JASPIC:SPEC:127 + A non-null Subject corresponding to the client must be passed as the clientSubject in the + getAuthContext call. + + + + getAuthContext + + + + + JASPIC:SPEC:128 + A null value may be passed for the properties argument in all calls made to getAuthContext + + + + getAuthContext + + + + + JASPIC:SPEC:129 + Each ClientAuthContext obtained via getAuthContext must initialize its encapsulated + ClientAuthModule objects with requestPolicy and responsePolicy objects (or null values) that are + compatible with the requirements and capabilities of the service invocation at the service. + + + + getAuthContext + + + + + JASPIC:SPEC:130 + If the client runtime obtained a non-null ClientAuthContext by using the operation identifier + corresponding to the request message, then at point (1) in the message processing model, the runtime + must call secureRequest on the ClientAuthContext, and at point (4) the runtime must call + validateResponse on the ClientAuthContext. + + + + secureRequest + + + + + JASPIC:SPEC:131 + The messageInfo argument used in a call to secureRequest must have been initialized by the + runtime such that its getRequestMessage will return the SOAP request message being processed by the + runtime. + + + + secureRequest + + + + + JASPIC:SPEC:132 + When a corresponding call is made to validateResponse, it must be made with the same + messageInfo and clientSubject arguments used in the corresponding call to secureRequest, and it must + have been initialized by the runtime such that its getResponseMessage method will return the SOAP + response message being processed by the runtime. + + + + validateResponse + + + + + JASPIC:SPEC:133 + This profile requires that the message processing runtime establish the following key-value + pairs within the Map of the MessageInfo passed in the calls to secureRequest and validateResponse Key= + jakarta.xml.ws.wsdl.service + Value= qualified service name, represented as a javax.xml.namespace.QName. + + + + MessageInfo + + + + + JASPIC:SPEC:134 + The clientSubject used in the call to getAuthContext must be used in the call to secureRequest + and for any corresponding calls to validateResponse. + + + + clientSubject + + + + + JASPIC:SPEC:135 + When secureRequest is called on a module that was initialized with a mandatory request policy + (as defined by the return value from requestPolicy.isMandatory()), the module must only return + AuthStatus.SEND_SUCCESS if it was able to completely satisfy the request policy. + + + + secureRequest + + + + + JASPIC:SPEC:136 + If the module was not able to completely satisfy the response policy, it must: return + AuthStatus.SEND_CONTINUE - if it has established a request (available to the runtime by calling + messageInfo.getRequestMessage) that must be sent by the runtime for the response validation to be + effectively continued by the client. + + + + AuthStatus + + + + + JASPIC:SPEC:137 + If the module was not able to completely satisfy the response policy, it must: return + AuthStatus.FAILURE - if the response validation failed. The module must have established a response + message containing a SOAP fault element (available to the runtime by calling + messageInfo.getResponseMessage) that may be returned to the application to indicate that the request + failed. + + + + AuthStatus + + + + + JASPIC:SPEC:138 + If the module was not able to completely satisfy the response policy, it must: throw an + AuthException - if the response validation failed. The runtime may choose to return a response message + containing a SOAP fault element, in which case, the runtime must define the content of the message and + of the fault, and may do so based on the content of the AuthException. + + + + AuthException + + + + + JASPIC:SPEC:139 + When secureRequest is called on a module that was initialized with an optional requestPolicy + (i.e., requestPolicy.isMandatory() returns false), the module should attempt to satisfy the request + policy but it must do so without requiring additional messages or interactions involving the service. + Independent of whether the request policy is satisfied, the module may return AuthStatus.SUCCESS. + + + + secureRequest + + + + + JASPIC:SPEC:140 + When validateResponse is called after the service invocation on a module that was initialized + with an undefined response policy (i.e., responsePolicy == null), the module must return + AuthStatus.SUCCESS. + + + + validateResponse + + + + + JASPIC:SPEC:141 + When validateResponse is called after the service invocation on a module that was initialized + with a mandatory response policy (as defined by the return value from responsePolicy.isMandatory()), the + module must only return AuthStatus.SUCCESS if it was able to completely satisfy the response policy. + + + + validateResponse + + + + + JASPIC:SPEC:142 + If the module was not able to completely satisfy the response policy, it must: return + AuthStatus.SEND_CONTINUE - if it has established a request (available to the runtime by calling + messageInfo.getRequestMessage) that must be sent by the runtime for the response validation to be + effectively continued by the client. + + + + getRequestMessage + + + + + JASPIC:SPEC:143 + If the module was not able to completely satisfy the response policy, it must: return + AuthStatus.FAILURE - if the response validation failed. The module must have established a response + message containing a SOAP fault element (available to the runtime by calling + messageInfo.getResponseMessage) that may be returned to the application to indicate that the request + failed. + + + + getResponseMessage + + + + + JASPIC:SPEC:144 + If the module was not able to completely satisfy the response policy, it must: throw an + AuthException - if the response validation failed. The runtime may choose to return a response message + containing a SOAP fault element, in which case, the runtime must define the content of the message and + of the fault, and may do so based on the content of the AuthException. + + + + AuthException + + + + + JASPIC:SPEC:145 + When validateResponse is called after the service invocation on a module that was initialized + with an optional responsePolicy (i.e., responsePolicy.isMandatory() returns false), the module should + attempt to satisfy the response policy but it must do so without requiring additional messages or + interactions involving the service. + + + + validateResponse + + + + + JASPIC:SPEC:146 + Independent of whether the response policy is satisfied, the module may return + AuthStatus.SUCCESS. if the module determines that an invalid security context was used to secure the + response, then the module may return AuthStatus.FAILURE + + + + AuthStatus + + + + + JASPIC:SPEC:147 + When validateResponse is called before the service invocation, the module must return + AuthStatus.SEND_CONTINUE if the request dialog is to continue. + + + + validateResponse + + + + + JASPIC:SPEC:148 + If the module returns AuthStatus.FAILURE, it must have established a SOAP message containing a + SOAP fault element as the response in messageInfo and that may be returned to the application to + indicate that the request failed. If the module throws an AuthException, the runtime may choose to + return a response message containing a SOAP fault element, in which case, the runtime must define the + content of the message and of the fault, and may do so based on the content of the AuthException. + + + + messageInfo + + + + + JASPIC:SPEC:149 + The CallbackHandler passed to ServerAuthModule.initialize must support the following + callbacks: CallerPrincipalCallback, GroupPrincipalCallback , PasswordValidationCallback . + + + + CallbackHandler + + + + + JASPIC:SPEC:150 + If a non-null AuthConfigProvider is returned (by the call to getConfigProvider), the messaging + runtime must call getServerAuthConfig on the provider to obtain the authentication context configuration + object pertaining to the application context at the layer. + + + + AuthConfigProvider + + + + + JASPIC:SPEC:151 + A null return value from getAuthContext indicates that pluggable authentication modules have + not been configured for the operation at the layer and for the application context and that the server + runtime must proceed to perform its SOAP message processing without reliance on this profile. + + + + getAuthContext + + + + + JASPIC:SPEC:152 + A null value may be passed for the properties argument in all calls made to getAuthContext + + + + getAuthContext + + + + + JASPIC:SPEC:153 + When a non-null requestPolicy is used to initialize the authentication modules of the + ServerAuthContext must be constructed such that the value obtained by calling isMandatory on the + requestPolicy accurately reflects whether (i.e., true return value) or not (i.e, false return value) + message protection is required to access the web service invocation corresponding to the MessageInfo + used to acquire the ServerAuthContext. Similarly, the responsePolicy used to initialize the + authentication modules must be constructed such that the value obtained by calling isMandatory on the + responsePolicy accurately reflects whether (i.e., true return value) or not (i.e, false return value) + message protection is required (within the SOAP messaging layer) on the response(if there is one) + resulting from the corresponding webservice invocation. + + + requestPolicy + + + + + JASPIC:SPEC:154 + + Calling getTargetPolicies on the requestPolicy corresponding to a web service invocation for which a + SOAP layer client identity is to be established as the caller identity must return an array containing at least + one TargetPolicy for which calling getProtectionPolicy.getID() returns one of the following values: + ProtectionPolicy.AUTHENTICATE_SENDER, ProtectionPolicy.AUTHENTICATE_CONTENT + + + + + getTargetPolicies + + + + + JASPIC:SPEC:155 + If the server runtime obtained a non-null ServerAuthContext by using the authentication + context identifier corresponding to the request message, then at point (2) in the message processing + model, the runtime must call validateRequest on the ServerAuthContext, and at point (3) the runtime must + call secureResponse on the ServerAuthContext. + + + + validateRequest + secureResponse + + + + + JASPIC:SPEC:156 + If the call to validateRequest returns AuthStatus.SUCCESS, the runtime must perform any web + service authorization processing2 required by the runtime as a prerequisite to accessing the target + resource. If authentication is required for the request to be authorized, the runtime must determine + whether the authentication identity + established in the clientSubject is authorized to access the resource. + + + + validateRequest + + + + + JASPIC:SPEC:157 + + In a JSR 115 compatible runtime, the + identity tested for authorization must be comprised of exactly the Principal objects of the clientSubject. If + the request is NOT authorized, and the message-exchange pattern is not one-way, the runtime must set + within the response (within messageInfo) a SOAP fault element as defined by the runtime. If the request + was determined to be authorized, it must be dispatched to the resource. Otherwise the request must NOT be + dispatched and the runtime must proceed to point (3) in the message processing model (as appropriate to + the message exchange pattern). + + + + clientSubject + + + + + JASPIC:SPEC:158 + + If the invocation of the resource results in an exception being thrown by the resource to the runtime + and the message exchange pattern is not one-way, the runtime must set within the response (within + messageInfo) a SOAP fault element as defined by the runtime. Following the resource invocation, and if + the message exchange pattern is not one-way, the runtime must proceed to point (3) in the message + processing model. At point (3) in the message processing model, the runtime must call secureResponse on + the same ServerAuthContext used in the corresponding call to validateRequest and with the same + MessageInfo object. + + + secureResponse + + + + + JASPIC:SPEC:159 + The call to secureResponse must not be made if the resource throws an exception to the calling + runtime. + + + + secureResponse + + + + + JASPIC:SPEC:160 + This profile requires that the message processing runtime establish the following key-value + pairs within the Map of the MessageInfo object passed in the calls to validateRequest and + secureResponse. Key= jakarta.xml.ws.wsdl.service value= the application context identifier as defined in + Sec 4.2 Application Context Identifier. + + + MessageInfo + + + + + JASPIC:SPEC:161 + A new clientSubject must be instantiated and passed in any calls made to validateRequest. + + + + validateRequest + + + + + JASPIC:SPEC:162 + When validateRequest is called before the service invocation on a module that was initialized + with an undefined request policy (i.e., requestPolicy == null), the module must return + AuthStatus.SUCCESS + + + + validateRequest + + + + + JASPIC:SPEC:163 + When validateRequest is called before the service invocation on a module initialized with a + mandatory request policy (as defined by the return value from requestPolicy.isMandatory()), the module + must only return AuthStatus.SUCCESS if it was able to completely satisfy the request policy. + + + + validateRequest + + + + + JASPIC:SPEC:164 + + If the module returns AuthStatus.SUCCESS, and the request policy was satisfied + (and included a TargetPolicy element as described above), then the module (or its context) must employ + the CallerPrincipalCallback as described above. If the request policy was not satisfied (and included a + TargetPolicy element as described above), and yet the module chooses to return AuthStatus.SUCCESS, + the module (or its context) must use a CallerPrincipalCallback to establish the container’s representation + of the unauthenticated caller within the clientSubject + + + + TargetPolicy + + + + + JASPIC:SPEC:165 + If the module determines that an invalid or + incomplete security context was used to secure the request, then the module may return + AuthStatus.SEND_FAILURE, AuthStatus.SEND_CONTINUE, or throw an AuthException.If the module + throws an AuthException, or returns any value other that AuthStatus.SUCCESS, the runtime must NOT + proceed to the service invocation. The runtime must process an AuthException as described above for a + request with a mandatory requestPolicy. The runtime must process any return value other than + AuthStatus.SUCCESS as it would be processed if it were returned for a request with a mandatory + requestPolicy. + + + + getResponseMessage + + + + + JASPIC:SPEC:166 + If the module was not able to completely satisfy the request policy, it must: return + AuthStatus.SEND_FAILURE - if the request validation failed, and when the module has established a SOAP + message containing a fault element (available to the runtime by calling messageInfo.getResponseMessage) + that may be sent by the runtime to inform the client that the request failed. + + + + getResponseMessage + + + + + JASPIC:SPEC:167 + If the module was not able to completely satisfy the request policy, it must: throw an + AuthException - if the request validation failed, and when the module has NOT defined a response, to be + sent by the runtime. If the runtime chooses to send a response, it must define a SOAP message containing + a SOAP fault element, and may use the content of the AuthException to do so. + + + + + + JASPIC:SPEC:168 + When validateRequest is called before the service invocation on a module that was initialized + with an optional request policy (i.e., requestPolicy.isMandatory() returns false), the module should + attempt to satisfy the request policy but it must do so without requiring additional messages or + interactions involving the client. If the request policy is satisfied, and it included a TargetPolicy + element with a PotectionPolicy of AUTHENTICATE_SOURCE or AUTHENTICATE_CONTENT, then the module must + employ the CallerPrincipalCallback as described above. + + + + validateRequest + + + + + JASPIC:SPEC:169 + Independent of whether the authentication policy is satisfied, the module may return + AuthStatus.SUCCESS. if the module determines that an invalid security context was used to secure the + request, or that the request requires additional processing (e.g. decryption) to be suitable for + processing by the runtime, then the module may return AuthStatus.FAILURE or throw an AuthException. In + which case, the runtime must determine whether to terminate the request or to (attempt to) process it. + + + + AuthStatus + + + + + JASPIC:SPEC:170 + When validateRequest is called after the service invocation, the module must return + AuthStatus.SEND_SUCCESS when the module has successfully secured the application response message and + made it available via messageInfo.getResponseMessage. For the request to be successfully completed, the + runtime must send the response message returned by the module. + + + + validateRequest + + + + + JASPIC:SPEC:171 + When securing of the application response message has failed, and the response dialog is to be + terminated, the module must return AuthStatus.SEND_FAILURE or throw an AuthException. + + + + + + JASPIC:SPEC:172 + If the module returns AuthStatus.SEND_FAILURE, it must have established a SOAP message + containing a SOAP fault element as the response in messageInfo. The runtime may choose not to send a + response message, or to send a different response message. + + + + messageInfo + + + + + JASPIC:SPEC:173 + When the module throws an AuthException, the runtime may chose not to send a response. If the + runtime sends a response, the runtime must define the content of the response. + + + + AuthException + + + + + JASPIC:SPEC:174 + The module must return AuthStatus.SEND_CONTINUE if the response dialog is to continue. This + status value is used to inform the calling runtime that (in order to successfully complete the response + processing) it will need to be capable of continuing the message dialog by processing at least one + additional request/response exchange (after having sent the response message returned in messageInfo). + + + + messageInfo + + + + + JASPIC:SPEC:175 + When secureResponse is called on a module that was initialized with an undefined + responsePolicy (i.e., responsePolicy == null), the module must return AuthStatus.SUCCESS. Otherwise, the + AuthStatus return value and AuthException semantics of secureResponse are as defined in validateRequest + After Service Invocation. + + + + secureResponse + + + + + JASPIC:SPEC:176 + The ServerAuthModule must create an instance of a javax.security.auth.login.LoginContext. If + the ServerAuthModule passes a custom javax.security.auth.login.Configuration object to the constructor, + then it also passes a custom value as the name input. + + + + ServerAuthModule + + + + + JASPIC:SPEC:177 + If the ServerAuthModule does not pass a custom Configuration object to the constructor, then + it must pass its own fully qualified class name as the name input. In this case, the configuration + administrator must configure the relevant LoginModule objects in an entry for that class name, or must + configure the LoginModule objects into the standard default entry called other. + + + + LoginModule + + + + + JASPIC:SPEC:178 + If the ServerAuthModule passes a Subject to the LoginContext constructor, it must pass its + client Subject. + + + + LoginContext + + + + + JASPIC:SPEC:179 + The ServerAuthModule must pass a CallbackHandler to the constructor and the passed + CallbackHandler must conform to the requirements of Section 5.3, Standard Callbacks. + + + + CallbackHandler + + + + + JASPIC:SPEC:180 + A new LoginContext instance should be created for each new request, and a LoginContext + instance should not be shared across different requests. + + + + LoginContext + + + + + JASPIC:SPEC:181 + Once a LoginContext object has been created, the LoginContext.login method may be invoked from + within the ServerAuthModule.validateRequest method to delegate security processing to the LoginModule + objects configured in the LoginContext. + + + + LoginContext + + + + + JASPIC:SPEC:182 + A LoginModule must only perform protocolindependent security processing (for example, + verifying a username/password that was transmitted in the request). + + + + LoginModule + + + + + JASPIC:SPEC:183 + A LoginModule requests information from the ServerAuthModule using the ServerAuthModule + provided CallbackHandler. Since the LoginModule must only perform protocol-independent operations, it + follows that any callback it requests from the handler must also be protocol-independent. + + + + LoginModule + + + + + JASPIC:SPEC:184 + This profile requires that the CallbackHandler provided by the ServerAuthModule to the + LoginContext constructor support the javax.security.auth.callback.NameCallback and the + javax.security.auth.callback.PasswordCallback. + + + + NameCallback + PasswordCallback + + + + + + JASPIC:SPEC:326 + If the ServerAuthModule passes its client Subject to the LoginContext constructor, the + CallbackHandler provided to the LoginContext constructor must also support the GroupPrincipalCallback. + + + CallbackHandler + + + + + JASPIC:SPEC:185 + If authentication succeeds, a LoginModule may update its Subject instance with authenticated + Principal and credential objects. + + + + LoginModule + + + + + JASPIC:SPEC:186 + If the ServerAuthModule did not pass its client Subject to the LoginContext constructor, then + it must transfer the Principals and credentials from the LoginContext Subject to the client Subject. + + + + LoginContext + + + + + JASPIC:SPEC:327 + If the ServerAuthModule is implementing a profile of this specification that requires the + module to employ the CallerPrincipalCallback, then the ServerAuthModule must satisfy this requirement + using the CallbackHandler provided to the ServerAuthModule, and the CallerPrincipalCallback must be + constructed using the name value that would be obtained by the LoginModule if it uses its + CallbackHandler to handle a NameCallback. + (note 1: The CallerPrincipalCallback may be constucted with a String argument containing the name value, or with a + Principal argument whose getName method returns the name value.) + + + + LoginContext + + + + + JASPIC:SPEC:187 + When ServerAuthModule.cleanSubject is called on the client Subject, the cleanSubject method + must invoke the LoginContext.logout method. + + + + cleanSubject + + + + + JASPIC:SPEC:188 + If the LoginContext instance throws a LoginException, the ServerAuthModule must throw a + corresponding AuthException. The LoginException may be established as the cause of the AuthException. + + + + LoginContext + + + + + JASPIC:SPEC:189 + The message layer value used to select the AuthConfigProvider and ServerAuthConfig objects for + this profile must be JMS + + + + AuthConfigProvider + ServerAuthConfig + + + + + JASPIC:SPEC:190 + The application context identifier (i.e., the appContext parameter value) used to select the + AuthConfigProvider, ClientAuthConfig, and ServerAuthConfig objects for a specific application shall be + the name of the Destination. + + + + appContext + + + + + JASPIC:SPEC:191 + The MessageInfo argument used in any call made by the message processing runtime to + validateRequest or secureResponse must have been initialized such that the non-null objects returned by + the getRequestMessage and getResponseMessage methods of the AuthParam are an instance of + jakarta.jms.Message. + + + + AuthParam + + + + + JASPIC:SPEC:192 + The getSupportedMessageTypes method of all authentication modules integrated for use with this + profile, must include jakarta.jms.Message in its return value. + + + + getSupportedMessageTypes + + + + + JASPIC:SPEC:193 + The factory implementation returned by calling the getFactory method of the abstract + AuthConfigFactory class must have been configured such that it returns a non-null AuthConfigProvider for + those application contexts for which pluggable authentication modules have been configured at the JMS + layer. + + + AuthConfigFactory + + + + + JASPIC:SPEC:194 + For each JMS Destination for which it is servicing requests, the runtime must call + getConfigProvider to acquire the corresponding provider object. + + + getConfigProvider + + + + + JASPIC:SPEC:195 + For each JMS Destination for which it is servicing requests, the runtime must call + getConfigProvider to acquire the corresponding provider object. The layer and appContext arguments to + getConfigProvider must be as defined in Section 6.1, 'Message Layer Identifier' and Section 6.2, + 'Application Context Identifier' respectively. + + + getConfigProvider + + + + + JASPIC:SPEC:196 + A null return value from getConfigProvider indicates that pluggable authentication modules + have not been configured at the layer for the application context and that the messaging runtime must + proceed to perform its JMS message processing without reliance on this profile. + + + getConfigProvider + + + + + JASPIC:SPEC:197 + When a non-null AuthConfigProvider is returned by the factory, the provider must have been + configured with the information required to initialize the authentication contexts for the (one or more) + JMS Destinations for which the provider is registered (at the factory). + + + AuthConfigPrivider + + + + + JASPIC:SPEC:198 + If getOperation returns a non-null operation identifier, then the operation identifier must be + the String value defined as follows: + - When the message is a request for a QueueConnection or a TopicConnection, then the operation + identifier is the String value representing the JNDI name of the Connection Factory. + - When the message is a request to create a publisher or subscriber, or a sender or receiver, + then the operation identifier must be the String value corresponding to the Destination name. + + + getOperation + + + + + JASPIC:SPEC:199 + The following must be satisfied by a runtime operating in the client role: A runtime may + operate in both the client and server roles. + + + + + JASPIC:SPEC:200 + The messageInfo argument used in a call to secureRequest must have been initialized by the + runtime such that its getRequestMessage will return the JMS request message being processed by the + runtime. + + + secureRequest + + + + + JASPIC:SPEC:201 + When a corresponding call is made to validateResponse, it must be made with the same + messageInfo and clientSubject arguments used in the corresponding call to secureRequest, and it must + have been initialized by the runtime such that its getResponseMessage method will return the JMS + response message being processed by the runtime. + + + validateResponse + + + + + JASPIC:SPEC:202 + When secureRequest is called on a module that was initialized with a mandatory request policy + (as defined by the return value from requestPolicy.isMandatory()), the module must only return + AuthStatus.SEND_SUCCESS if it was able to completely satisfy the request policy. + + + secureRequest + + + + + JASPIC:SPEC:203 + When secureRequest is called on a module that was initialized with a mandatory request policy + (as defined by the return value from requestPolicy.isMandatory()), If the module was not able to + completely satisfy the response policy, it must: + - return AuthStatus.SEND_CONTINUE - if it has established a request + - return AuthStatus.FAILURE - if the response validation failed. + - throw an AuthException - if the response validation failed. + + + secureRequest + + + + + JASPIC:SPEC:204 + When secureRequest is called on a module that was initialized with an optional requestPolicy + (i.e.,requestPolicy.isMandatory() returns false), if the module attempts to satisfy the request policy, + it must do so without requiring additional messages or interactions involving the service. + + + secureRequest + + + + + JASPIC:SPEC:205 + The requirements of this profile that must be satisfied by a runtime operating in the server + role are: + - Receives a message from a Sender before reaching the Queue + - Receives a message from a Publisher on the way to a Topic + - Receives a request for creation of a TopicPublisher or QueueSender + - Receives a message from the a JMS Provider + + + + + JASPIC:SPEC:206 + The messageInfo argument used in a call to validateRequest must have been initialized by the + runtime such that its getRequestMessage will return the JMS request message being processed by the + runtime. + + + getRequestMessage + + + + + JASPIC:SPEC:207 + When a corresponding call is made to secureResponse, it must be made with the same messageInfo + and serviceSubject arguments used in the corresponding call to validateRequest, and it must have been + initialized by the runtime such that its getResponseMessage method will return the JMS response message + being processed by the runtime. + + + secureResponse + getResponseMessage + + + + + + JASPIC:SPEC:208 + The application context identifier used by a client-runtime to acquire the AuthConfigProvider + and + ClientAuthConfig objects pertaining to the client side processing of a web service invocation shall begin + with a client scope identifier that identifies the client. If the client-runtime may host multiple client + applications, then the client scope identifier must differentiate among the client applications deployed + within the runtime. In runtimes where applications are differentiated by unambiguous application + identifiers, an application identifier may be used as the client scope identifier. Where application + identifiers are not defined or suitable, the location (for example, its file path) of the client archive from + which the invocation will originate may be used as the client scope identifier + In addition to its client scope identifier, the application context identifier must include a client + reference to the service. If a service reference is defined for the invocation (for example, by using a + WebServiceRef annotation as defined in the JAXWS 2.0 or JAXWS 2.1 Specifications), the client + reference to the service must be the name value of the service reference. If a service reference was not + defined for the invocation, the client reference to the service must be the web service URL. + A client application context identifier must be the String value composed by concatenating the client + scope identifier, a blank separator character, and the client reference to the service. + AppContextID ::= client-scope-identfier blank client-reference + + + Client-Side Application Context Identifier + + + + + + JASPIC:SPEC:209 + The application context identifier used by a server-runtime to acquire the AuthConfigProvider + and + ServerAuthConfig objects pertaining to the endpoint side processing of an invocation shall be the String + value constructed by concatenating a host name, a blank separator character, and the path3 component of + the service endpoint URI corresponding to the webservice. + AppContextID ::= hostname blank service-endpoint-uri + In the definition of server-side application context identifiers, this profile uses the term host name to + refer to the logical host that performs the service corresponding to a service invocation. Web service + invocations may be directed to a logical host using various physical or virtual host names or addresses, and + a message processing runtime may be composed of multiple logical hosts. Systems or administrators that + register AuthConfigProvider objects with specific server-side application context identifiers must have an + ability to determine the hostname for which they wish to perform the registration. + + + + Server-Side Application Context Identifier + + + + + + JASPIC:SPEC:328 + + getConfigProvider(): + All factories shall employ the following precedence rules to select the registered AuthConfigProvider that matches the + layer and appContext arguments: + 1. The provider that is specifically registered for both the + corresponding message layer and appContext shall be selected. + 2. If no provider is selected according to + the preceding rule, the provider specifically registered for the corresponding appContext and for all + message layers shall be selected. + 3. If no provider is selected according to the preceding rules, the + provider specifically registered for the corresponding message layer and for all appContexts shall be + selected. + 4. If no provider is selected according to the preceding rules, the provider registered for all + message layers and for all appContexts shall be selected. + 5. If no provider is selected according to the + preceding rules, the factory shall terminate its search for a registered provider. + + The above precedence + rules apply equivalently to registrations created with a null or non-null className argument. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:329 + + getFactory(): + If a non-null system-wide factory instance is defined at the time of the call, for example, with + setFactory, it will be returned. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:330 + + getFactory(): + The fully qualified class name of the default factory implementation class is obtained from the value of the + authconfigprovider.factory security property. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:331 + + registerConfigProvider(className, properties, layer, appContext, description): + At most one registration may exist within the factory for a given combination of message layer and appContext. Any + pre-existing registration with identical values for layer and appContext is replaced by a subsequent + registration. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:332 + + registerConfigProvider(className, properties, layer, appContext, description): + [At most one registration may exist within the factory for a given combination of message layer and appContext. Any + pre-existing registration with identical values for layer and appContext is replaced by a subsequent + registration.] + When replacement occurs, the registration identifier, layer, and appContext identifier remain unchanged, and the + AuthConfigProvider (with initialization properties) and description are replaced. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:333 + + registerConfigProvider(className, properties, layer, appContext, description): + Within the lifetime of its Java process, a factory must assign unique registration identifiers to registrations, and must + never assign a previously used registration identifier to a registration whose message layer and or + appContext identifier differ from the previous use. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:334 + + registerConfigProvider(provider, layer, appContext, description): + Registers within the (in-memory) factory, a provider of ServerAuthConfig and/or + ClientAuthConfig objects for a message layer and application context identifier. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:335 + + setFactory() + Set the system-wide AuthConfigFactory implementation. + If an implementation was set previously, it will be replaced. + Listeners are not notified of a change to the registered factory. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:336 + + isPersistent() + Returns: A boolean indicating whether the registration is the result of a className based registration, or an + instance-based (for example, self-) registration. Only registrations performed using the five argument + registerConfigProvider method are persistent. + + + AuthConfigFactory.RegistrationContext + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:337 + + When a listener argument is included in the call to acquire a provider, the factory will invoke the notify method of the + listener when the correspondence between the provider and the layer and application context for which is + had been acquired is no longer in effect. When the notify method is invoked by the factory, the runtime + should reacquire an AuthConfigProvider for the layer and application context. + + + AuthConfigFactory.RegistrationContext + + + + This was originally in this doc as part of assertion 9. but after relooking at that assertion, it + was determined that this is a completely different assertion and so should be pulled out. + + + + + JASPIC:SPEC:338 + + notify() + The AuthConfigFactory will invoke the notify method of the RegistrationListener if the corresponding provider + registration is unregistered or replaced at the factory. + + + AuthConfigFactory.RegistrationContext + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:339 + + detachListener() + The AuthConfigFactory will invoke the notify method of the RegistrationListener if the corresponding provider + registration is unregistered or replaced at the factory. + + Returns: An array of String values where each value identifies a provider registration from which the listener was removed. + This method never returns null; it returns an empty array if the listener was not removed from any + registrations. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:340 + + registerConfigProvider(className, properties, layer, appContext, description) + When replacement occurs, the registration identifier, layer, and + appContext identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and + description are replaced. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + Note that this refers to the persistent registration and NOT the in-memory registration. + + + + + JASPIC:SPEC:341 + + registerConfigProvider(className, properties, layer, appContext, description) + Programmatic registrations performed by using this method must update + (according to the replacement rules described above) the persistent declarative representation of + provider registrations employed by the factory constructor. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + Note that this refers to the persistent registration and NOT the in-memory registration. + + + + + JASPIC:SPEC:342 + + registerConfigProvider(acp, layer, appContext, description) + At most one registration may exist within the factory for a given combination of + message layer and appContext. Any pre-existing registration with identical values for layer and + appContext is replaced by a subsequent registration. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + Note that this refers to the in-memory registration and NOT the persistent registration. + + + + + JASPIC:SPEC:343 + + registerConfigProvider(acp, layer, appContext, description) + When replacement occurs, the registration identifier, layer, and appContext + identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and description + are replaced. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + Note that this refers to the in-memory registration and NOT the persistent registration. + + + + + JASPIC:SPEC:344 + + removeRegistration() + Remove the identified provider registration from the factory (and from the persistent declarative representation of + provider registrations, if appropriate) and invoke any listeners associated with the removed + registration. + Verify this returns True when there is a registration with the specified identifier and it + was removed. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + JASPIC:SPEC:345 + + removeRegistration() + Remove the identified provider registration from the factory (and from the persistent declarative representation of + provider registrations, if appropriate) and invoke any listeners associated with the removed + registration. + Verify this returns false when the registrationID is invalid. + + + AuthConfigFactory + + + + This reference is in the JASPIC spec but is in the API section and includes some of the javadoc + refs. It seemed better suited for this spec than the javadoc spec - even though it may technically be + javadoc. + + + + + diff --git a/tck/old-tck/source/internal/docs/jaspic/TCD.txt b/tck/old-tck/source/internal/docs/jaspic/TCD.txt new file mode 100644 index 0000000..61579da --- /dev/null +++ b/tck/old-tck/source/internal/docs/jaspic/TCD.txt @@ -0,0 +1,84 @@ +TCK Coverage Document for Jakarta Authentication: +(version 2.0) + + +TCK Components: +--------------- +- User's Guide +- Compatibility Rules +- Configuration Instructions +- Test Suite +- API Tests +- Signature Test +- End-to-End Tests +- Ant Task Tests +- Framework Code +- JavaTest TM Harness + + +Terminology of Metrics +---------------------- +- Assertion: A specific statement of functionality or behavior derived from a specification. + A testable assertion is one that can be validated in an implementation by testing. +- Test: A binary application (or script) comprised of one or more Test Cases. +- Test Case: A single set of test inputs, execution conditions, and expected results + developed to verify an implementation's conformance with a specific assertion. +- Specification Assertion Coverage: Ratio of all assertions tested by at least one test + case to the total number of testable assertions defined by the specification. +- API Coverage: Ratio of methods directly exercised by test cases to the total number + of methods defined by the specification. + + +Coverage +-------- +- Total testable assertions derived from Jakarta Authentication Specifications and Javadoc: + 157 specification assertions + + 107 API assertions + ------------------------------ + 264 testable assertions + + +- Total testable assertions tested + 90 specification assertions tested + + 47 API assertions tested (only include servlet profile not soap) + -------------------------------------- + 137 testable assertions tested + + + - 57.32% of testable specification assertions tested + - 43.92% of testable API assertions tested + - 51.89% of all (specification and API) assertions tested + +- Assertions were identified through the use of CTS Tools and hand markup + (hand markup was required for the Jakarta Authentication specifications) + +- API Signature Coverage: 100% for all defined public and protected members and validated + by the signature test included with the Jakarta Authentication TCK. + +- See the following HTML reports in this bundle for Jakarta Authentication specification and API coverage metrics: + * coverage/jaspic/api/summary.html + * coverage/jaspic/spec/summary.html + + +Quality Assurance +----------------- +- TCK was run using representative configurations of the Reference Implementation on + the following platforms: + * CentOS Linux 7 / Java SE 8 + * Alpine Linux v3.12 / Java SE 8 +- Code quality was demonstrated through use of code reviews and inspections +- User's Guide was constructed from the standard CTS User's Guide template +- Documentation instructions were verified and tested + + +Justification of Adequacy +------------------------- +The Jakarta Authentication CTS provides a set of tests to ensure all implementations of +the Jakarta Authentication specifications are compatible. As with all TCKs it is +impossible to provide tests for 100% assertion coverage. Note, while +the CTS may not have tests for all assertions in Jakarta Authentication, all +implementations of Jakarta Authentication must be compatible with the specifications. + +Untested assertions are due to the effects of availability and cost of +test development resources. + diff --git a/tck/old-tck/source/internal/docs/jaspic/index.html b/tck/old-tck/source/internal/docs/jaspic/index.html new file mode 100755 index 0000000..ef3e99c --- /dev/null +++ b/tck/old-tck/source/internal/docs/jaspic/index.html @@ -0,0 +1,128 @@ + + + + + +Welcome to the Authentication TCK, Version 2.0 + + + +
+

+ Welcome to the Jakarta Authentication TCK, Version 2.0
Your Starting Point +

+
+ +
+

Jakarta Authentication TCK 2.0 Documentation

+

The Jakarta Authentication Technology Compatibility Kit (TCK) 2.0 documentation + includes the following:

+
    +
  • + The Jakarta Authentication TCK 2.0 Release Notes provide late-breaking information about the Jakarta Authentication TCK, + Version 2.0. +

  • +
  • + The Jakarta Authentication 2.0 Technology Compatibility Kit User's Guide provides the information you need to + install, configure, and run the Jakarta Authentication TCK. +

  • +
  • + The API documentation for the porting interfaces provides information about + the porting packages you need to implement for this TCK. +

  • +
  • + The Javadoc Assertion List lists all the javadoc assertions + from the Jakarta Authentication 2.0 Specification. +

  • +
  • + The Specification Assertion List lists all the + specification assertions from the Jakarta Authentication 2.0 Specification. +

  • +
+ +

JavaTest Harness Documentation

+ +

Additional documentation includes the JavaTest README file, Release Notes file, and a set of User's Guides:

+ +

JT Harness Documentation

+

+ The online version of the JT Harness version 5.0 documentation is available here. +

+ +
+

+

Copyright (c) 2007, 2028 Oracle and/or its affiliates. All rights + reserved.
+

+ + diff --git a/tck/old-tck/source/internal/docs/jaspic/tck_properties.txt b/tck/old-tck/source/internal/docs/jaspic/tck_properties.txt new file mode 100755 index 0000000..5321a22 --- /dev/null +++ b/tck/old-tck/source/internal/docs/jaspic/tck_properties.txt @@ -0,0 +1,152 @@ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// TCK project properties to be used in TCK User's Guides for Java TCK +// technologies. The property_name=value pairs represent specific TCK +// project details, such as version number, release date, required +// Java SE version, JavaTest version, package name, etc. +// +// Properties will be parsed into SGML entities files, which will in +// turn be used to generate TCK User's Guide. +// +// Note that the default values here refer to the Common Annotations +// for Java 1.0 TCK, and are provided for example purposes only. +// Change the values as appropriate for your technology. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// General syntax: property_name=value +// Please alter value names only! +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Section 1. Common names, version numbers, and date. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// 1a. TCK full name. +TCKFullName=Jakarta Authentication TCK + +// 1b. TCK short name. +TCKShortName=Jakarta Authentication TCK + +// 1c. Technology full name. +TechnologyFullName=Jakarta Authentication 2.0 + +// 1d. Technology short name. +TechnologyShortName=??? + +// 1e. Technology/TCK version. +TechnologyVersion=2.0 + +// 1f. TCK release date. +ReleaseDate= + +// 1g. Version of JavaTest included with/used by the TCK. +JavaTestVersion=3.2.1 + +// 1h. Version of Java SE required to run the TCK. +J2SEVersion=Java SE 8 or newer + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Section 2. Paths, package names, and URLs. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// 2a. Name of the package ZIP file. +TCKPackageName=??? + +// 2b. Directory base name created when TCK bundle is unzipped; do +// not enter path prefix. +TCKInstallDir=jaspic + +// 2c. Path name to package after it has been unzipped. +TCKPackagePath=??? + +// 2d. URL to technology specification. +SpecURL=http://www.jcp.org/en/jsr/detail?id=196 + +// 2e. URL to documentation for technology RI. +RIdocURL=??? + +// 2f. URL to project area on Java Community Process site. +JCPURL=http://www.jcp.org/en/jsr/detail?id=196 + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Section 3. Platform, component, and API lists. +// This is the only section that does not use a simple property=value +// syntax. Most properties here use a delimited list syntax, described +// below as appropriate for each property. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +// 3a. List of platforms supported by TCK. Specify one platform per +// line, separated by a hard return. Enter platform list between +// %%PLAT%% delimters, as shown in example below. + + + + +// Begin platform list +%%PLAT%% +Solaris 9 Operating System on Sparc and x86 +Solaris 10 Operating System on Sparc and Opteron +Windows 2003 Server Professional Edition +Windows XP Professional Edition +Windows 2000 Professional Edition +RedHat Linux 9.0 +RedHat Linux AS 3.0 (including Update 4) +%%PLAT%% +// End platform list + +// 3b. List of Java platforms with which the TCK has been tested. +// Specify one platform per line, separated by a hard return. +// Enter Java platform list between %%JAVA%% delimeters, as shown +// in example below. + +// Begin Java platform list +%%JAVA%% +Java 2 Platform, Standard Edition, Version 1.5 +%%JAVA%% +// End Java platform list + + +// 3c. List of components included in TCK bundle; specify true if +// component is included, false if not included. + // 3c1. Signature tests + TCKComponentsSigTest=true + + // 3c2. End-to-end tests + TCKComponentsEndtoEnd=true + + // 3c3. Agent tests + TCKComponentsAgent=true ??? + + // 3c4. API tests + TCKComponentsAPITest=false ??? + + +// 3d. If API tests are included (3c4. TCKComponentsAPITest=true), +// and if relevant, please specify list of public APIs being tested. +// Enter one API per line, separated by a hard return. Enter API +// list between %%API%% delimeters, as shown in example below. + +// Begin API list +%%API%% +jakarta.security.auth.message +jakarta.security.auth.message.callback +jakarta.security.auth.message.config +jakarta.security.auth.message.module +%%API%% +// End API list + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Section 4. Some properties that should not need to be changed. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// 4a. Package path to JavaTest documentation. +JavaTestDocPath=TS_HOME/docs + +// 4b. URL to JavaPartner site. +JavaPartnerURL=https://javapartner.sun.com + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// End of TCK project properties. +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + diff --git a/tck/old-tck/source/internal/docs/javadoc_assertions.dtd b/tck/old-tck/source/internal/docs/javadoc_assertions.dtd new file mode 100755 index 0000000..e36379f --- /dev/null +++ b/tck/old-tck/source/internal/docs/javadoc_assertions.dtd @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/internal/docs/spec_assertions.dtd b/tck/old-tck/source/internal/docs/spec_assertions.dtd new file mode 100755 index 0000000..666abba --- /dev/null +++ b/tck/old-tck/source/internal/docs/spec_assertions.dtd @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/lib/ant-contrib-1.0b3.jar b/tck/old-tck/source/lib/ant-contrib-1.0b3.jar new file mode 100644 index 0000000..0415209 Binary files /dev/null and b/tck/old-tck/source/lib/ant-contrib-1.0b3.jar differ diff --git a/tck/old-tck/source/lib/ant_sun.jar b/tck/old-tck/source/lib/ant_sun.jar new file mode 100644 index 0000000..13f16f1 Binary files /dev/null and b/tck/old-tck/source/lib/ant_sun.jar differ diff --git a/tck/old-tck/source/lib/apiCheck.jar b/tck/old-tck/source/lib/apiCheck.jar new file mode 100644 index 0000000..3b6c2ae Binary files /dev/null and b/tck/old-tck/source/lib/apiCheck.jar differ diff --git a/tck/old-tck/source/lib/dtds/web-app_2_2.dtd b/tck/old-tck/source/lib/dtds/web-app_2_2.dtd new file mode 100644 index 0000000..83ffc29 --- /dev/null +++ b/tck/old-tck/source/lib/dtds/web-app_2_2.dtd @@ -0,0 +1,602 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/lib/dtds/web-app_2_3.dtd b/tck/old-tck/source/lib/dtds/web-app_2_3.dtd new file mode 100644 index 0000000..a5dceeb --- /dev/null +++ b/tck/old-tck/source/lib/dtds/web-app_2_3.dtd @@ -0,0 +1,1004 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/lib/gf-196-hookv3.jar b/tck/old-tck/source/lib/gf-196-hookv3.jar new file mode 100644 index 0000000..0454463 Binary files /dev/null and b/tck/old-tck/source/lib/gf-196-hookv3.jar differ diff --git a/tck/old-tck/source/lib/httpclient-4.5.5.jar b/tck/old-tck/source/lib/httpclient-4.5.5.jar new file mode 100644 index 0000000..5010e23 Binary files /dev/null and b/tck/old-tck/source/lib/httpclient-4.5.5.jar differ diff --git a/tck/old-tck/source/lib/javatest.jar b/tck/old-tck/source/lib/javatest.jar new file mode 100644 index 0000000..58e222d Binary files /dev/null and b/tck/old-tck/source/lib/javatest.jar differ diff --git a/tck/old-tck/source/lib/schemas/j2ee_1_4.xsd b/tck/old-tck/source/lib/schemas/j2ee_1_4.xsd new file mode 100644 index 0000000..884dfeb --- /dev/null +++ b/tck/old-tck/source/lib/schemas/j2ee_1_4.xsd @@ -0,0 +1,1616 @@ + + + + + @(#)j2ee_1_4.xsds 1.43 03/09/16 + + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + +The following definitions that appear in the common +shareable schema(s) of J2EE deployment descriptors should be +interpreted with respect to the context they are included: + +Deployment Component may indicate one of the following: + j2ee application; + application client; + web application; + enterprise bean; + resource adapter; + +Deployment File may indicate one of the following: + ear file; + war file; + jar file; + rar file; + + + + + + + + + + + + + + + + This group keeps the usage of the contained description related + elements consistent across J2EE deployment descriptors. + + All elements may occur multiple times with different languages, + to support localization of the content. + + + + + + + + + + + + + + + + + The description type is used by a description element to + provide text describing the parent element. The elements + that use this type should include any information that the + Deployment Component's Deployment File file producer wants + to provide to the consumer of the Deployment Component's + Deployment File (i.e., to the Deployer). Typically, the + tools used by such a Deployment File consumer will display + the description when processing the parent element that + contains the description. + + The lang attribute defines the language that the + description is provided in. The default value is "en" (English). + + + + + + + + + + + + + + + + + This type defines a dewey decimal which is used + to describe versions of documents. + + + + + + + + + + + + + + + + Employee Self Service + + The value of the xml:lang attribute is "en" (English) by default. + + ]]> + + + + + + + + + + + + + + + EmployeeRecord + + ../products/product.jar#ProductEJB + + ]]> + + + + + + + + + + + + + + The ejb-local-refType is used by ejb-local-ref elements for + the declaration of a reference to an enterprise bean's local + home. The declaration consists of: + + - an optional description + - the EJB reference name used in the code of the Deployment + Component that's referencing the enterprise bean + - the expected type of the referenced enterprise bean + - the expected local home and local interfaces of the + referenced enterprise bean + - optional ejb-link information, used to specify the + referenced enterprise bean + + + + + + + + + + + + + + + + + + + + + ejb/Payroll + + ]]> + + + + + + + + + + + + + + The ejb-ref-typeType contains the expected type of the + referenced enterprise bean. + + The ejb-ref-type designates a value + that must be one of the following: + + Entity + Session + + + + + + + + + + + + + + + + + + The ejb-refType is used by ejb-ref elements for the + declaration of a reference to an enterprise bean's home. The + declaration consists of: + + - an optional description + - the EJB reference name used in the code of + the Deployment Component that's referencing the enterprise + bean + - the expected type of the referenced enterprise bean + - the expected home and remote interfaces of the referenced + enterprise bean + - optional ejb-link information, used to specify the + referenced enterprise bean + + + + + + + + + + + + + + + + + + + + + + + This type is used to designate an empty + element when used. + + + + + + + + + + + + java.lang.Boolean + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + The env-entryType is used to declare an application's + environment entry. The declaration consists of an optional + description, the name of the environment entry, and an + optional value. If a value is not specified, one must be + supplied during deployment. + + It is used by env-entry elements. + + + + + + + + + + minAmount + + ]]> + + + + + + + + + + 100.00 + + ]]> + + + + + + + + + + + + + + + The elements that use this type designate the name of a + Java class or interface. The name is in the form of a + "binary name", as defined in the JLS. This is the form + of name used in Class.forName(). Tools that need the + canonical name (the name used in source code) will need + to convert this binary name to the canonical name. + + + + + + + + + + + + + + + This type defines four different values which can designate + boolean values. This includes values yes and no which are + not designated by xsd:boolean + + + + + + + + + + + + + + + + + + + com.aardvark.payroll.PayrollHome + + ]]> + + + + + + + + + + + + + + The icon type contains small-icon and large-icon elements + that specify the file names for small and large GIF or + JPEG icon images used to represent the parent element in a + GUI tool. + + The xml:lang attribute defines the language that the + icon file names are provided in. Its value is "en" (English) + by default. + + + + + + + + + employee-service-icon16x16.jpg + + ]]> + + + + + + + employee-service-icon32x32.jpg + + ]]> + + + + + + + + + + + + + + + + + + The java-identifierType defines a Java identifier. + The users of this type should further verify that + the content does not contain Java reserved keywords. + + + + + + + + + + + + + + + + + This is a generic type that designates a Java primitive + type or a fully qualified name of a Java interface/type, + or an array of such types. + + + + + + + + + + + + + + + + + The jndi-nameType type designates a JNDI name in the + Deployment Component's environment and is relative to the + java:comp/env context. A JNDI name must be unique within the + Deployment Component. + + + + + + + + + + + + + + + This group keeps the usage of the contained JNDI environment + reference elements consistent across J2EE deployment descriptors. + + + + + + + + + + + + + + + + + + + + + The listenerType indicates the deployment properties for a web + application listener bean. + + + + + + + + + + + The listener-class element declares a class in the + application must be registered as a web + application listener bean. The value is the fully + qualified classname of the listener class. + + + + + + + + + + + + + + + The local-homeType defines the fully-qualified + name of an enterprise bean's local home interface. + + + + + + + + + + + + + + + The localType defines the fully-qualified name of an + enterprise bean's local interface. + + + + + + + + + + + + + + + The message-destination-linkType is used to link a message + destination reference or message-driven bean to a message + destination. + + The Assembler sets the value to reflect the flow of messages + between producers and consumers in the application. + + The value must be the message-destination-name of a message + destination in the same Deployment File or in another + Deployment File in the same J2EE application unit. + + Alternatively, the value may be composed of a path name + specifying a Deployment File containing the referenced + message destination with the message-destination-name of the + destination appended and separated from the path name by + "#". The path name is relative to the Deployment File + containing Deployment Component that is referencing the + message destination. This allows multiple message + destinations with the same name to be uniquely identified. + + + + + + + + + + + + + + + jms/StockQueue + + jakarta.jms.Queue + + Consumes + + CorporateStocks + + + + ]]> + + + + + + + + + The message-destination-ref-name element specifies + the name of a message destination reference; its + value is the environment entry name used in + Deployment Component code. The name is a JNDI name + relative to the java:comp/env context and must be + unique within an ejb-jar (for enterprise beans) or a + Deployment File (for others). + + + + + + + + + + + + + + + + + + jakarta.jms.Queue + + + ]]> + + + + + + + + + + + + + + The message-destination-usageType specifies the use of the + message destination indicated by the reference. The value + indicates whether messages are consumed from the message + destination, produced for the destination, or both. The + Assembler makes use of this information in linking producers + of a destination with its consumers. + + The value of the message-destination-usage element must be + one of the following: + Consumes + Produces + ConsumesProduces + + + + + + + + + + + + + + + + + + + CorporateStocks + + + + ]]> + + + + + + + + + The message-destination-name element specifies a + name for a message destination. This name must be + unique among the names of message destinations + within the Deployment File. + + + + + + + + + + + + + + + This type is a general type that can be used to declare + parameter/value lists. + + + + + + + + + + + The param-name element contains the name of a + parameter. + + + + + + + + + + The param-value element contains the value of a + parameter. + + + + + + + + + + + + + + + The elements that use this type designate either a relative + path or an absolute path starting with a "/". + + In elements that specify a pathname to a file within the + same Deployment File, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the Deployment File's namespace. Absolute filenames (i.e., + those starting with "/") also specify names in the root of + the Deployment File's namespace. In general, relative names + are preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + com.wombat.empl.EmployeeService + + ]]> + + + + + + + + + + + + + + The res-authType specifies whether the Deployment Component + code signs on programmatically to the resource manager, or + whether the Container will sign on to the resource manager + on behalf of the Deployment Component. In the latter case, + the Container uses information that is supplied by the + Deployer. + + The value must be one of the two following: + + Application + Container + + + + + + + + + + + + + + + + + + The res-sharing-scope type specifies whether connections + obtained through the given resource manager connection + factory reference can be shared. The value, if specified, + must be one of the two following: + + Shareable + Unshareable + + The default value is Shareable. + + + + + + + + + + + + + + + + + + jms/StockQueue + + jakarta.jms.Queue + + + + ]]> + + + + + + + + + + The resource-env-ref-name element specifies the name + of a resource environment reference; its value is + the environment entry name used in + the Deployment Component code. The name is a JNDI + name relative to the java:comp/env context and must + be unique within a Deployment Component. + + + + + + + + + + The resource-env-ref-type element specifies the type + of a resource environment reference. It is the + fully qualified name of a Java language class or + interface. + + + + + + + + + + + + + + + + jdbc/EmployeeAppDB + javax.sql.DataSource + Container + Shareable + + + ]]> + + + + + + + + + + The res-ref-name element specifies the name of a + resource manager connection factory reference. + The name is a JNDI name relative to the + java:comp/env context. + The name must be unique within a Deployment File. + + + + + + + + + + The res-type element specifies the type of the data + source. The type is specified by the fully qualified + Java language class or interface + expected to be implemented by the data source. + + + + + + + + + + + + + + + + + + + The role-nameType designates the name of a security role. + + The name must conform to the lexical rules for a token. + + + + + + + + + + + + + + + + The run-asType specifies the run-as identity to be + used for the execution of a component. It contains an + optional description, and the name of a security role. + + + + + + + + + + + + + + + + + + The security-role-refType contains the declaration of a + security role reference in a component's or a + Deployment Component's code. The declaration consists of an + optional description, the security role name used in the + code, and an optional link to a security role. If the + security role is not specified, the Deployer must choose an + appropriate security role. + + + + + + + + + + + The value of the role-name element must be the String used + as the parameter to the + EJBContext.isCallerInRole(String roleName) method or the + HttpServletRequest.isUserInRole(String role) method. + + + + + + + + + + The role-link element is a reference to a defined + security role. The role-link element must contain + the name of one of the security roles defined in the + security-role elements. + + + + + + + + + + + + + + + + This role includes all employees who are authorized + to access the employee service application. + + employee + + + ]]> + + + + + + + + + + + + + + + + + This is a special string datatype that is defined by J2EE as + a base type for defining collapsed strings. When schemas + require trailing/leading space elimination as well as + collapsing the existing whitespace, this base type may be + used. + + + + + + + + + + + + + + + + + This simple type designates a boolean with only two + permissible values + + - true + - false + + + + + + + + + + + + + + + + + The url-patternType contains the url pattern of the mapping. + It must follow the rules specified in Section 11.2 of the + Servlet API Specification. This pattern is assumed to be in + URL-decoded form and must not contain CR(#xD) or LF(#xA). + If it contains those characters, the container must inform + the developer with a descriptive error message. + The container must preserve all characters including whitespaces. + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:anyURI. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:boolean. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:integer. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:NMTOKEN. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:nonNegativeInteger. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:positiveInteger. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:QName. + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:string. + + + + + + + + + + + + diff --git a/tck/old-tck/source/lib/schemas/j2ee_web_services_client_1_1.xsd b/tck/old-tck/source/lib/schemas/j2ee_web_services_client_1_1.xsd new file mode 100644 index 0000000..8c198cc --- /dev/null +++ b/tck/old-tck/source/lib/schemas/j2ee_web_services_client_1_1.xsd @@ -0,0 +1,353 @@ + + + + + @(#)j2ee_web_services_client_1_1.xsds 1.10 02/11/03 + + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + (C) Copyright International Business Machines Corporation 2002 + + + + + + + + + + + + The port-component-ref element declares a client dependency + on the container for resolving a Service Endpoint Interface + to a WSDL port. It optionally associates the Service Endpoint + Interface with a particular port-component. This is only used + by the container for a Service.getPort(Class) method call. + + + + + + + + + + The service-endpoint-interface element defines a fully qualified + Java class that represents the Service Endpoint Interface of a + WSDL port. + + + + + + + + + + The port-component-link element links a port-component-ref + to a specific port-component required to be made available + by a service reference. + + The value of a port-component-link must be the + port-component-name of a port-component in the same module + or another module in the same application unit. The syntax + for specification follows the syntax defined for ejb-link + in the EJB 2.0 specification. + + + + + + + + + + + + + + + + + + Defines the name of the handler. The name must be unique + within the module. + + + + + + + + + + + + + + + + + The service-ref element declares a reference to a Web + service. It contains optional description, display name and + icons, a declaration of the required Service interface, + an optional WSDL document location, an optional set + of JAX-RPC mappings, an optional QName for the service element, + an optional set of Service Endpoint Interfaces to be resolved + by the container to a WSDL port, and an optional set of handlers. + + + + + + + + + + + The service-ref-name element declares logical name that the + components in the module use to look up the Web service. It + is recommended that all service reference names start with + "service/". + + + + + + + + + + The service-interface element declares the fully qualified class + name of the JAX-RPC Service interface the client depends on. + In most cases the value will be javax.xml.rpc.Service. A JAX-RPC + generated Service Interface class may also be specified. + + + + + + + + + + The wsdl-file element contains the URI location of a WSDL + file. The location is relative to the root of the module. + + + + + + + + + + The jaxrpc-mapping-file element contains the name of a file that + describes the JAX-RPC mapping between the Java interaces used by + the application and the WSDL description in the wsdl-file. The + file name is a relative path within the module file. + + + + + + + + + + The service-qname element declares the specific WSDL service + element that is being refered to. It is not specified if no + wsdl-file is declared. + + + + + + + + + + The port-component-ref element declares a client dependency + on the container for resolving a Service Endpoint Interface + to a WSDL port. It optionally associates the Service Endpoint + Interface with a particular port-component. This is only used + by the container for a Service.getPort(Class) method call. + + + + + + + + + + Declares the handler for a port-component. Handlers can + access the init-param name/value pairs using the + HandlerInfo interface. If port-name is not specified, the + handler is assumed to be associated with all ports of the + service. + + + + + + + + + + + + + + + Declares the handler for a port-component. Handlers can access the + init-param name/value pairs using the HandlerInfo interface. If + port-name is not specified, the handler is assumed to be associated + with all ports of the service. + + Used in: service-ref + + + + + + + + + + Defines the name of the handler. The name must be unique + within the module. + + + + + + + + + Defines a fully qualified class name for the handler + implementation. + + + + + + + + + + + Defines the QName of a SOAP header that will be processed + by the handler. + + + + + + + + + + The soap-role element contains a SOAP actor definition that + the Handler will play as a role. + + + + + + + + + + The port-name element defines the WSDL port-name that a + handler should be associated with. + + + + + + + + + + diff --git a/tck/old-tck/source/pom.xml b/tck/old-tck/source/pom.xml new file mode 100755 index 0000000..459edf8 --- /dev/null +++ b/tck/old-tck/source/pom.xml @@ -0,0 +1,507 @@ + + + + + 4.0.0 + + org.glassfish.main.tests.tck + 4.0.0 + glassfish-tck-authentication + pom + + TCK: Authentication + + + 1.10.2 + ${project.build.directory}/apache-ant-${ant.version} + https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip + false + ${maven.multiModuleProjectDirectory}/release/JASPIC_BUILD/latest/authentication-tck + ${tck.home}/src/com/sun/ts/tests/jaspic + standalone + glassfish + ${project.build.directory}/glassfish7 + 7.0.0-M5 + ${glassfish.home}/glassfish/bin/asadmin + + org/glassfish/**\:com/sun/enterprise/** + + 14848 + 11527 + 18080 + 18181 + 17676 + 18686 + 13700 + 13920 + 13820 + 12000 + + + + + org.glassfish.main.distributions + ${glassfish.profile} + ${glassfish.version} + zip + test + + + + + + jakarta-staging + + https://jakarta.oss.sonatype.org/content/repositories/staging + + + + + + + maven-clean-plugin + 2.4.1 + + + + release/JASPIC_BUILD + + ** + + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.6.7 + + + download-ant + generate-sources + + wget + + + ${skipITs} + ${ant.zip.url} + true + ${project.build.directory} + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + build-old-tck + generate-sources + + exec + + + docker/build_oldtck.sh + + ${maven.multiModuleProjectDirectory} + ${ant.home} + + + 0 + 1 + + + + + + + + maven-dependency-plugin + + ${skipITs} + + + + unpack-glassfish + pre-integration-test + + unpack-dependencies + + + glassfish + ${project.build.directory} + + + + + copy-lib-jars + pre-integration-test + + copy + + + + + commons-codec + commons-codec + 1.9 + + + commons-collections + commons-collections + 3.2.1 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-lang3 + 3.3.2 + + + commons-logging + commons-logging + 1.1.3 + + + net.sourceforge.cssparser + cssparser + 0.9.25 + + + net.sourceforge.htmlunit + htmlunit + 2.15 + + + net.sourceforge.htmlunit + htmlunit-core-js + 2.15 + + + + org.apache.httpcomponents + httpcore + 4.4.9 + + + org.apache.httpcomponents + httpmime + 4.5.5 + + + jaxen + jaxen + 1.1.6 + + + org.jdom + jdom + 1.1.3 + + + net.sourceforge.nekohtml + nekohtml + 1.9.21 + + + org.w3c.css + sac + 1.3 + + + xalan + serializer + 2.7.2 + + + xalan + xalan + 2.7.2 + + + xerces + xercesImpl + 2.11.0 + + + xml-apis + xml-apis + 1.4.01 + + + ${tck.home}/lib + + + + + + + maven-antrun-plugin + 1.8 + + + org.apache.ant + ant + ${ant.version} + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + + + ${skipITs} + + + + prepare-tck-and-glassfish + pre-integration-test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + ]]> + + + + + + run + + + + + configure-tck-tests + pre-integration-test + + run + + + + + + + + + + + + + + + + Deploying from ${test.dir} + + + + + + + + + Deploying all archives + + + + + + + + + + + + run-tck-tests + integration-test + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/release/tools/build-utils.xml b/tck/old-tck/source/release/tools/build-utils.xml new file mode 100644 index 0000000..b083349 --- /dev/null +++ b/tck/old-tck/source/release/tools/build-utils.xml @@ -0,0 +1,566 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Proprietary APIs have been detected. Users are strongly discouraged from using +proprietary APIs. If you can remove them, please do so. + + The following proprietary APIs were found in the build log: + =========================================================== + ${proprietary.errors} + + + + + + + + + +The CTS-Build job which ran previous to this job had failures. + +Please see the CTS-Build log output for compilation errors. + - The logs are located under the hudson job's /job/Trunk.Build/ dir + +FAILED DIRECTORIES BELOW +======================== +${failed.dirs} + + + + + + + + + + + + + + + + + + + + +The runclient target that runs the smoke tests, failed to run properly. Please see log for details. + + +SmokeLog: +========= +${smoke.log.contents} + + + + + + + + + + + + + + + + +List of failed smoke tests (See smoke log, included below, for more details): + +${failed.tests} + +Server logs are located here: ${javaee.home.ri}/domains/domain1/logs + + +SmokeLog: +========= +${smoke.log.contents} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + deleteing ${release.tools.current.dir}/.. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Checking availability of URL "${url.to.check}" ... + + + + Success, "${url.to.check}" is available. + + + Failure, "${url.to.check}" is NOT available. + + + + + + + + + + + + Ping SUCCESS, ${ping.host} is reachable. + + + Ping FAILED, ${ping.host} is NOT reachable. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/release/tools/build.xml b/tck/old-tck/source/release/tools/build.xml new file mode 100644 index 0000000..0de7b9a --- /dev/null +++ b/tck/old-tck/source/release/tools/build.xml @@ -0,0 +1,887 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/release/tools/common.xml b/tck/old-tck/source/release/tools/common.xml new file mode 100644 index 0000000..2cd0a77 --- /dev/null +++ b/tck/old-tck/source/release/tools/common.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/release/tools/jaspic.xml b/tck/old-tck/source/release/tools/jaspic.xml new file mode 100644 index 0000000..9252298 --- /dev/null +++ b/tck/old-tck/source/release/tools/jaspic.xml @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/build.xml b/tck/old-tck/source/src/com/sun/ts/lib/build.xml new file mode 100644 index 0000000..4f8ad63 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/build.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractDeliverable.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractDeliverable.java new file mode 100644 index 0000000..3f85e66 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractDeliverable.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.lib.porting.DeploymentInfo; +import java.util.Map; +import java.util.Hashtable; + +/** + * This class serves as an abstract implementation of the DeliverableInterface. + * It can be extended to customize values for a particular deliverable. + * + * @author Kyle Grucci + */ +public abstract class AbstractDeliverable implements DeliverableInterface { + protected Map htTSValidVehicles; + + protected Map htValidApps; + + protected Map htValidRunDirections; + + public boolean supportsAutoDeployment() { + return true; + } + + public boolean supportsAutoJMSAdmin() { + return true; + } + + public Map getValidVehicles() { + if (htTSValidVehicles == null) { + // TS hash table + htTSValidVehicles = new Hashtable(); + // add default values + htTSValidVehicles.put("tests.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp" }); + } + return htTSValidVehicles; + } + + public Map getInteropDirections() { + if (htValidRunDirections == null) { + htValidRunDirections = new Hashtable(); + // default for all tests + htValidRunDirections.put("tests.interop", "forward"); + } + return htValidRunDirections; + } + + public boolean supportsInterop() { + return true; + } + + public String getAdditionalClasspath(String distDir) { + return null; + } + + public DeploymentInfo getDeploymentInfo(String earFile, + String[] sValidRuntimeInfoFilesArray) { + return null; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractPropertyManager.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractPropertyManager.java new file mode 100644 index 0000000..b25a46f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/AbstractPropertyManager.java @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +import java.io.*; +import java.util.*; + +import com.sun.javatest.*; +import com.sun.ts.lib.util.*; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + * + * @created August 22, 2002 + * @author Kyle Grucci + */ +public class AbstractPropertyManager implements PropertyManagerInterface { + private TestEnvironment env; + + private Properties jteProperties; + + private String tmp = File.separator + "tmp"; + + protected static boolean bReversed; + + protected AbstractPropertyManager() { + } + + /** + * @exception PropertyNotSetException + */ + private void checkHarnessTempDir() throws PropertyNotSetException { + String tmpDir = getProperty("harness.temp.directory", null); + if (tmpDir == null) { + tmpDir = getProperty("TS_HOME", null) + this.tmp; + setProperty("harness.temp.directory", tmpDir); + } else { + if (!(tmpDir.endsWith(this.tmp) + || tmpDir.endsWith(this.tmp + File.separator) + || tmpDir.endsWith("/tmp") || tmpDir.endsWith("/tmp/"))) { + tmpDir += this.tmp; + setProperty("harness.temp.directory", tmpDir); + } + } + } + + /** + * copies all entries from TestEnvironment and jteProperties to a new + * Properties, which is used for remote invocation of porting server. + * jteProperties has precedence over TestEnvironment. We set forward/reverse + * related properties in jteProperties and the same key in TestEnvironment may + * have old value. + * + * @return a new properties + */ + private Properties copyEntries() { + Properties props = new Properties(); + if (this.env != null) { + String key = null; + String val = null; + for (Iterator it = env.keys().iterator(); it.hasNext();) { + key = (String) it.next(); + val = getFromEnv(key); + if (key != null && val != null) { + props.setProperty(key, val); + } else { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "AbstractPropertyManager.copyEntries():" + key + " is null."); + } + } + } + } + if (this.jteProperties != null) { + props.putAll(this.jteProperties); + } + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "AbstractPropertyManager copied all entries to a properties."); + } + + props.put("bin.dir", System.getProperty("bin.dir", "")); + return props; + } + + /** + * Sets a property in property manager. If the key already exists in the + * property manager, the old value is overriden by new value. + * + * @param key + * key of the property. + * @param val + * value of the property. + */ + public void setProperty(String sKey, String sVal) { + if (jteProperties == null) { + jteProperties = new Properties(); + } + if (sKey != null && sVal != null) { + jteProperties.setProperty(sKey, sVal); + } + } + + /** + * This method swaps all of the following interop values in + * TSPropertyManager... + * + * @param sDirection + */ + public void swapInteropPropertyValues(String sDirection) { + if (sDirection.equals("reverse")) { + if (bReversed) { + return; + } else { + reverseValues(); + } + } else { + if (!bReversed) { + return; + } else { + forwardValues(); + } + } + } + + protected void forwardValues() { + bReversed = false; + } + + protected void reverseValues() { + bReversed = true; + } + + /** + * gets a new properties containing all entries in the property manager. Any + * operation on the returned properties will have no effect on property + * manager + * + * @return The jteProperties value + */ + public Properties getJteProperties() { + return copyEntries(); + } + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys + * - Properties to retrieve + * @return Properties - property/value pairs + * @exception PropertyNotSetException + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException { + Properties pTestProps = new Properties(); + String tmpKey = null; + + for (int ii = 0; ii < sPropKeys.length; ii++) { + tmpKey = sPropKeys[ii]; + if (tmpKey.equalsIgnoreCase("generateSQL")) { + pTestProps.put("generateSQL", "true"); + } else if (tmpKey.equalsIgnoreCase("all.props")) { + pTestProps = getJteProperties(); + pTestProps.put("generateSQL", "true"); + pTestProps.put("all.props", "true"); + return pTestProps; + } else { + pTestProps.put(tmpKey, getProperty(tmpKey)); + } + } + // set all props that all tests need + pTestProps.put("harness.log.port", getProperty("harness.log.port")); + pTestProps.put("harness.log.traceflag", + getProperty("harness.log.traceflag")); + pTestProps.put("harness.log.delayseconds", + getProperty("harness.log.delayseconds")); + pTestProps.put("harness.temp.directory", + getProperty("harness.temp.directory")); + pTestProps.put("harness.socket.retry.count", + getProperty("harness.socket.retry.count")); + pTestProps.put("bin.dir", System.getProperty("bin.dir", "")); + + pTestProps.put("all.props", "false"); + return pTestProps; + } + + /** + * This method is called to get a property value + * + * @param sKey + * - Property to retrieve + * @return String - property value + * @exception PropertyNotSetException + */ + public String getProperty(String sKey) throws PropertyNotSetException { + String sVal = getProperty0(sKey); + if (sVal == null) { + throw new PropertyNotSetException("No value found for " + sKey + + ". Please check your jte file for an appropiate value"); + } + return sVal; + } + + /** + * gets property value with default + * + * @param sKey + * - Property to retrieve + * @param def + * @return String - property value + */ + public String getProperty(String sKey, String def) { + String result = getProperty0(sKey); + if (result == null) { + result = def; + } + return result; + } + + /** + * Gets the defaultValue attribute of the AbstractPropertyManager object + * + * @param sKey + * @return The defaultValue value + */ + private String getDefaultValue(String sKey) { + String result = null; + if (sKey.startsWith("deployment_host.")) { + result = "local"; + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "WARNING: No value found for " + sKey + ", use default local"); + } + } else if (sKey.equals("undeploy_redeploy_apps")) { + result = "true"; + } + return result; + } + + /** + * retrieves property value from TestEnvironment, and converts it to a single + * string. If lookup returns null or empty string array, returns null. + * + * @param key + * @return The fromEnv value + */ + private String getFromEnv(String key) { + String result = null; + String[] values = null; + try { + values = env.lookup(key); + } catch (TestEnvironment.Fault f) { + f.printStackTrace(); + } + if (values != null) { + switch (values.length) { + case 0: + if (key.equals("s1as.admin.passwd") || key.equals("ri.admin.passwd") + || key.equals("deployManagerpasswd.1") + || key.equals("deployManagerpasswd.2")) { + result = ""; + } + break; + case 1: + result = values[0].trim(); + break; + default: + result = ""; + for (int i = 0; i < values.length; i++) { + result += values[i] + " "; + } + result = result.trim(); + } + } + return result; + } + + /** + * first tries properties, then env, and finally default values + * + * @param key + * @return The property0 value + */ + private String getProperty0(String key) { + String result = null; + if (jteProperties != null) { + result = jteProperties.getProperty(key); + } + if (result == null && env != null) { + result = getFromEnv(key); + } + if (result == null) { + result = getDefaultValue(key); + } + return result; + } + + /** + * Sets the jteProperties attribute of the AbstractPropertyManager object + * + * @param p + * The new jteProperties value + * @exception PropertyNotSetException + */ + protected final void setJteProperties(Properties p) + throws PropertyNotSetException { + jteProperties = p; + jteProperties.put("bin.dir", System.getProperty("bin.dir", "")); + env = null; + checkHarnessTempDir(); + } + + /** + * Sets the testEnvironment attribute of the AbstractPropertyManager object + * + * @param env + * The new testEnvironment value + * @exception PropertyNotSetException + */ + protected final void setTestEnvironment(TestEnvironment env) + throws PropertyNotSetException { + this.env = env; + jteProperties = null; + checkHarnessTempDir(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableFactory.java new file mode 100644 index 0000000..04fb1a0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +/** + * This is a factory class for creating instances of TSDeploymentInterface. The + * implementation classes used are determined by the values of the porting + * package properties in TS_HOME/bin/ts.jte. + * + * @author Kyle Grucci + */ + +public class DeliverableFactory { + private static DeliverableInterface di; + + public static DeliverableInterface getDeliverableInstance() throws Exception { + if (di == null) + di = createInstance(); + return di; + } + + public static DeliverableInterface getDeliverableInstance( + ClassLoader classLoader) throws Exception { + if (di == null) + di = createInstance(classLoader); + return di; + } + + private static DeliverableInterface createInstance() throws Exception { + return createInstance(null); + } + + private static DeliverableInterface createInstance(ClassLoader classLoader) + throws Exception { + try { + // get property value from within the ts specific properties file + String sClassName = System.getProperty("deliverable.class"); + // create and initialize a new instance of the Deployment class + Class c = null; + if (classLoader == null) { + c = Class.forName(sClassName); + } else { + c = Class.forName(sClassName, true, classLoader); + } + return (DeliverableInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableInterface.java new file mode 100644 index 0000000..bf80d98 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/DeliverableInterface.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +import java.util.Map; +import java.util.Properties; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.javatest.TestEnvironment; + +/** + * This interface serves as a place to retrieve deliverable specific + * information. Some example deliverables would be standalone TCKs, the CTS, the + * JDBC test suite, etc. + * + * @author Kyle Grucci + */ +public interface DeliverableInterface { + + /** + * This method is called to retrieve a reference to this Deliverable's + * PropertyManager. If the PropertyManager instance does not yet exist, one + * will be created from the TestEnvironment object. + * + * @param te - TestEnvironment specific to the currently running test + * @return PropertyManagerInterface impl. + */ + public PropertyManagerInterface createPropertyManager(TestEnvironment te) + throws Exception; + + /** + * This method is called to retrieve a reference to this Deliverable's + * PropertyManager. If the PropertyManager instance does not yet exist, one + * will be created from the Properties object. + * + * @param p - Properties specific to the currently running test + * @return PropertyManagerInterface impl. + */ + public PropertyManagerInterface createPropertyManager(Properties p) + throws Exception; + + /** + * This method is called to retrieve a reference to this Deliverable's + * PropertyManager. + * + * @return PropertyManagerInterface impl. + */ + public PropertyManagerInterface getPropertyManager() throws Exception; + + /** + * This method is called to determine the vehicles to use for given test + * directories. + * + * @return A mapping between test directories and vehicles. + */ + public Map getValidVehicles(); + + /** + * This method is called to determine the direction to run any interop tests + * The default for any tests if forward. + * + * @return A mapping between test directories and directions. + */ + public Map getInteropDirections(); + + /** + * This method is called by the SuiteSynchronizer class to determine whether + * autodeployment is supported by this deliverable. + * + * @return True if supported, else false. + */ + public boolean supportsAutoDeployment(); + + /** + * This method is called by the SuiteSynchronizer class to determine whether + * interop tests are supported by this deliverable. + * + * @return True if supported, else false. + */ + public boolean supportsInterop(); + + /** + * This method is called by the SuiteSynchronizer class to determine whether + * JMS topic/queue/factory admin is supported by this deliverable. + * + * @return True if supported, else false. + */ + public boolean supportsAutoJMSAdmin(); + + /** + * This method is called by the TSScript class, which appends the returned + * string to the classpath specified in the testExecute commandline. + * + * @param distDir + * The dist directory for the currently running test. + * + * @return Returns a String which will be appended to the classpath specified + * in the testExecute commandline. + */ + public String getAdditionalClasspath(String distDir); + + /** + * This method is called by the SuiteSynchronizer class to get a + * DeploymentInfo Object. Other deliverables may use this method to subclass + * the standard DeploymentInfo class. + * + * @param earFile + * The archive being deployed + * @param sValidRuntimeInfoFilesArray + * An array of Sun RI runtime xml + * + * @return This method should return a DeploymentInfo object + */ + public DeploymentInfo getDeploymentInfo(String earFile, + String[] sValidRuntimeInfoFilesArray); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyManagerInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyManagerInterface.java new file mode 100644 index 0000000..2c9fd66 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyManagerInterface.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +import java.util.Properties; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + * + * @author Kyle Grucci + */ +public interface PropertyManagerInterface { + + /** + * This method swaps all of the following interop values in + * TSPropertyManager... + * + */ + public void swapInteropPropertyValues(String sDirection); + + /** + * gets a new properties containing all entries in the property manager. Any + * operation on the returned properties will have no effect on property + * manager + */ + public Properties getJteProperties(); + + /** + * gets property value with default + * + * @param sKey - Property to retrieve + * @param default - default value to use + * @return String - property value + */ + public String getProperty(String sKey, String def); + + /** + * This method is called to get a property value + * + * @param sKey + * - Property to retrieve + * @return String - property value + */ + public String getProperty(String sKey) throws PropertyNotSetException; + + /** + * This method is called to set a property on the property manager + * + * @param skey - key to be used + * @param sVal - value to use + */ + public void setProperty(String sKey, String sVal); + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys - Properties to retrieve + * @return Properties - property/value pairs + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyNotSetException.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyNotSetException.java new file mode 100644 index 0000000..47a861c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/PropertyNotSetException.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable; + +public class PropertyNotSetException extends java.lang.Exception { + public PropertyNotSetException(String s) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSDeliverable.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSDeliverable.java new file mode 100644 index 0000000..fb03737 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSDeliverable.java @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable.cts; + +import com.sun.ts.lib.deliverable.*; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.ts.lib.implementation.sun.javaee.runtime.SunRIDeploymentInfo; +import com.sun.javatest.*; +import java.util.*; +import java.io.*; + +/** + * This class serves as a place for CTS Deliverable specific info. + * + * @author Kyle Grucci + */ +public class CTSDeliverable extends AbstractDeliverable { + + public PropertyManagerInterface createPropertyManager(TestEnvironment te) + throws Exception { + CTSPropertyManager propMgr = CTSPropertyManager.getCTSPropertyManager(te); + + // create CTS specific working directories + createDir(propMgr.getProperty("wsdlRepository1")); + createDir(propMgr.getProperty("wsdlRepository2")); + return propMgr; + } + + public PropertyManagerInterface createPropertyManager(Properties p) + throws Exception { + return CTSPropertyManager.getCTSPropertyManager(p); + } + + public PropertyManagerInterface getPropertyManager() throws Exception { + return CTSPropertyManager.getCTSPropertyManager(); + } + + public DeploymentInfo getDeploymentInfo(String earFile, + String[] sValidRuntimeInfoFilesArray) { + DeploymentInfo info = null; + try { + info = new SunRIDeploymentInfo(earFile, sValidRuntimeInfoFilesArray); + } catch (Exception e) { + e.printStackTrace(); + } + return info; + } + + public Map getValidVehicles() { + super.getValidVehicles(); + + // sample jdbc tests + htTSValidVehicles.put("tests_samples_jdbc.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // signature tests + htTSValidVehicles.put("tests_signaturetest.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // jaxp tests + htTSValidVehicles.put("tests_jaxp.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // jaxp com directory tests (until we figure out notserializable exc.) + htTSValidVehicles.put("tests_jaxp_extension_com.service_eetest.vehicles", + new String[] { "appclient" }); + + // interop/naming/cosnamingNoSSL + htTSValidVehicles.put( + "tests_interop_naming_cosnamingNoSSL.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // jaxm tests + htTSValidVehicles.put("tests_jaxm.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // saaj/ee/Standalone tests + htTSValidVehicles.put("tests_saaj_ee_Standalone.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // interop/webservices + htTSValidVehicles.put("tests_interop_webservices.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // interop/saaj/Standalone + htTSValidVehicles.put( + "tests_interop_saaj_Standalone.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // jdbc tests + htTSValidVehicles.put("tests_jdbc_ee.service_eetest.vehicles", + new String[] { "ejb", "servlet", "jsp", "appclient" }); + + // jms tests + htTSValidVehicles.put("tests_jms_ee_appclient.service_eetest.vehicles", + new String[] { "appclient" }); + htTSValidVehicles.put("tests_jms_ee_web.service_eetest.vehicles", + new String[] { "servlet", "jsp" }); + htTSValidVehicles.put("tests_jms_ee_ejb.service_eetest.vehicles", + new String[] { "ejb" }); + htTSValidVehicles.put("tests_jms_ee_all.service_eetest.vehicles", + new String[] { "appclient", "ejb", "servlet", "jsp" }); + + // j2ee Management tests + htTSValidVehicles.put("tests_j2eetools_mgmt.service_eetest.vehicles", + new String[] { "ejb" }); + + // jmx tests + // htTSValidVehicles.put("tests_jmx.service_eetest.vehicles", new + // String[]{"standalone"}); + + return htTSValidVehicles; + } + + public Map getInteropDirections() { + super.getInteropDirections(); + + htValidRunDirections.put("tests_interop.interop", "both"); + + htValidRunDirections.put("tests_interop_csiv2_rionly.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_ssln_upr_noid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_ssln_upr_noid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_ssln_upr_noid_a_forward.interop", + "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_ssln_upr_noid_a_reverse.interop", + "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_sslr_upn_noid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ac_ssl_sslr_upn_noid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_anonid_forward.interop", + "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_anonid_reverse.interop", + "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_anonid_forward.interop", + "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_anonid_reverse.interop", + "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_upid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_upid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_anonid_forward.interop", + "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_anonid_reverse.interop", + "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_ccid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_ccid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_ccid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_sslr_upn_ccid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_ccid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_ccid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_upid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_upid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_upid_forward.interop", "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssl_ssln_upn_upid_reverse.interop", "reverse"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_upid_a_forward.interop", + "forward"); + htValidRunDirections.put( + "tests_interop_csiv2_ew_ssln_ssln_upn_upid_a_reverse.interop", + "reverse"); + + return htValidRunDirections; + } + + public boolean supportsInterop() { + return true; + } + + private void createDir(String sDir) throws Exception { + File fDir = new File(sDir); + + if (!fDir.exists()) { + if (!fDir.mkdirs()) { + throw new Exception("Failed to create directory: " + sDir); + } + TestUtil.logHarnessDebug("Successfully created directory: " + sDir); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSPropertyManager.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSPropertyManager.java new file mode 100644 index 0000000..50453e7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/cts/CTSPropertyManager.java @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable.cts; + +import com.sun.javatest.TestEnvironment; +import com.sun.ts.lib.deliverable.AbstractPropertyManager; +import com.sun.ts.lib.deliverable.PropertyNotSetException; + +import java.util.Properties; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + * + * @author Kyle Grucci + */ +public class CTSPropertyManager extends AbstractPropertyManager { + // uninitialized singleton instance + private static CTSPropertyManager jteMgr = new CTSPropertyManager(); + + private String sDeployClass1; + + private String sDeployClass2; + + private String sLoginClass1; + + private String sLoginClass2; + + private String sURLClass1; + + private String sURLClass2; + + private String sJMSClass1; + + private String sJMSClass2; + + private String sNamingServiceHost2; + + private String sNamingServicePort2; + + private String sNamingServiceHost1; + + private String sNamingServicePort1; + + private String sDeployHost1; + + private String sDeployHost2; + + private String sDeployPort1; + + private String sDeployPort2; + + private String sDeployPropsNumber1; + + private String sDeployPropsNumber2; + + private String sWebServerHost; + + private String sWebServerPort; + + private String sWebServerHost2; + + private String sWebServerPort2; + + private String httpSupportsEndpointPublish; + + private String httpSupportsEndpointPublish2; + + private String sSecuredWebServicePort; + + private String sSecuredWebServicePort2; + + private String sEJBServer1TxInteropEnabled; + + private String sEJBServer2TxInteropEnabled; + + private String sHttpsURLConnectionClass1; + + private String sHttpsURLConnectionClass2; + + private String sWSDLRepository1; + + private String sWSDLRepository2; + + private String user1; + + private String password1; + + private String user2; + + private String password2; + + private CTSPropertyManager() { + } + + /** + * This method returns the singleton instance of TSPropertyManager which + * provides access to all ts.jte properties. This is only called once by the + * test harness. + * + * @param env + * - TestEnvironment object from JavaTest + * @return TSPropertyManager - singleton property manager object + */ + public final static CTSPropertyManager getCTSPropertyManager( + TestEnvironment env) throws PropertyNotSetException { + jteMgr.setTestEnvironment(env); + jteMgr.initInteropProperties(); + return jteMgr; + } + + /** + * This method returns the singleton instance of CTSPropertyManager which + * provides access to all ts.jte properties. This is only called by the init() + * method in ManualDeployment.java + * + * @param p + * - Properties object from JavaTest + * @return CTSPropertyManager - singleton property manager object + */ + public final static CTSPropertyManager getCTSPropertyManager(Properties p) + throws PropertyNotSetException { + jteMgr.setJteProperties(p); + return jteMgr; + } + + public final static CTSPropertyManager getCTSPropertyManager() + throws PropertyNotSetException { + return jteMgr; + } + + private void initInteropProperties() { + user1 = getProperty("user1", null); + password1 = getProperty("password1", null); + user2 = getProperty("user2", null); + password2 = getProperty("password2", null); + sDeployClass1 = getProperty("porting.ts.deploy.class.1", null); + sDeployClass2 = getProperty("porting.ts.deploy.class.2", null); + sLoginClass1 = getProperty("porting.ts.login.class.1", null); + sLoginClass2 = getProperty("porting.ts.login.class.2", null); + sURLClass1 = getProperty("porting.ts.url.class.1", null); + sURLClass2 = getProperty("porting.ts.url.class.2", null); + sJMSClass1 = getProperty("porting.ts.jms.class.1", null); + sJMSClass2 = getProperty("porting.ts.jms.class.2", null); + sNamingServiceHost2 = getProperty("namingServiceHost2", null); + sNamingServicePort2 = getProperty("namingServicePort2", null); + sNamingServiceHost1 = getProperty("namingServiceHost1", null); + sNamingServicePort1 = getProperty("namingServicePort1", null); + sDeployHost1 = getProperty("deployment_host.1", null); + sDeployHost2 = getProperty("deployment_host.2", null); + sDeployPort1 = getProperty("deployment_port.1", null); + sDeployPort2 = getProperty("deployment_port.2", null); + sDeployPropsNumber1 = "1"; + sDeployPropsNumber2 = "2"; + setProperty("deployment_propnumber.1", sDeployPropsNumber1); + setProperty("deployment_propnumber.2", sDeployPropsNumber2); + sWebServerHost = getProperty("webServerHost", null); + sWebServerPort = getProperty("webServerPort", null); + sWebServerHost2 = getProperty("webServerHost.2", null); + sWebServerPort2 = getProperty("webServerPort.2", null); + httpSupportsEndpointPublish = getProperty( + "http.server.supports.endpoint.publish", null); + httpSupportsEndpointPublish2 = getProperty( + "http.server.supports.endpoint.publish.2", null); + sSecuredWebServicePort = getProperty("securedWebServicePort", null); + sSecuredWebServicePort2 = getProperty("securedWebServicePort.2", null); + sEJBServer1TxInteropEnabled = getProperty("EJBServer1TxInteropEnabled", + null); + sEJBServer2TxInteropEnabled = getProperty("EJBServer2TxInteropEnabled", + null); + sHttpsURLConnectionClass1 = getProperty( + "porting.ts.HttpsURLConnection.class.1", null); + sHttpsURLConnectionClass2 = getProperty( + "porting.ts.HttpsURLConnection.class.2", null); + sWSDLRepository1 = getProperty("wsdlRepository1", null); + sWSDLRepository2 = getProperty("wsdlRepository2", null); + } + + public void forwardValues() { + // reverse all interop props + setProperty("user1", user1); + setProperty("password1", password1); + setProperty("user2", user2); + setProperty("password2", password2); + + setProperty("porting.ts.deploy.class.1", sDeployClass1); + setProperty("porting.ts.deploy.class.2", sDeployClass2); + setProperty("porting.ts.login.class.1", sLoginClass1); + setProperty("porting.ts.login.class.2", sLoginClass2); + setProperty("porting.ts.url.class.1", sURLClass1); + setProperty("porting.ts.url.class.2", sURLClass2); + setProperty("porting.ts.jms.class.1", sJMSClass1); + setProperty("porting.ts.jms.class.2", sJMSClass2); + setProperty("namingServiceHost2", sNamingServiceHost2); + setProperty("namingServicePort2", sNamingServicePort2); + setProperty("namingServiceHost1", sNamingServiceHost1); + setProperty("namingServicePort1", sNamingServicePort1); + setProperty("deployment_host.1", sDeployHost1); + setProperty("deployment_host.2", sDeployHost2); + setProperty("deployment_port.1", sDeployPort1); + setProperty("deployment_port.2", sDeployPort2); + setProperty("deployment_propnumber.1", sDeployPropsNumber1); + setProperty("deployment_propnumber.2", sDeployPropsNumber2); + setProperty("webServerHost", sWebServerHost); + setProperty("webServerHost.2", sWebServerHost2); + setProperty("webServerPort", sWebServerPort); + setProperty("webServerPort.2", sWebServerPort2); + setProperty("http.server.supports.endpoint.publish", + httpSupportsEndpointPublish); + setProperty("http.server.supports.endpoint.publish.2", + httpSupportsEndpointPublish2); + setProperty("securedWebServicePort", sSecuredWebServicePort); + setProperty("securedWebServicePort.2", sSecuredWebServicePort2); + setProperty("EJBServer1TxInteropEnabled", sEJBServer1TxInteropEnabled); + setProperty("EJBServer2TxInteropEnabled", sEJBServer2TxInteropEnabled); + setProperty("porting.ts.HttpsURLConnection.class.1", + sHttpsURLConnectionClass1); + setProperty("porting.ts.HttpsURLConnection.class.2", + sHttpsURLConnectionClass2); + setProperty("wsdlRepository1", sWSDLRepository1); + setProperty("wsdlRepository2", sWSDLRepository2); + + super.forwardValues(); + } + + public void reverseValues() { + // reverse all interop props + setProperty("user1", user2); + setProperty("password1", password2); + setProperty("user2", user1); + setProperty("password2", password1); + + setProperty("porting.ts.deploy.class.1", sDeployClass2); + setProperty("porting.ts.deploy.class.2", sDeployClass1); + setProperty("porting.ts.login.class.1", sLoginClass2); + setProperty("porting.ts.login.class.2", sLoginClass1); + setProperty("porting.ts.url.class.1", sURLClass2); + setProperty("porting.ts.url.class.2", sURLClass1); + setProperty("porting.ts.jms.class.1", sJMSClass2); + setProperty("porting.ts.jms.class.2", sJMSClass1); + setProperty("namingServiceHost2", sNamingServiceHost1); + setProperty("namingServicePort2", sNamingServicePort1); + setProperty("namingServiceHost1", sNamingServiceHost2); + setProperty("namingServicePort1", sNamingServicePort2); + setProperty("deployment_host.1", sDeployHost2); + setProperty("deployment_host.2", sDeployHost1); + setProperty("deployment_port.1", sDeployPort2); + setProperty("deployment_port.2", sDeployPort1); + setProperty("deployment_propnumber.1", sDeployPropsNumber2); + setProperty("deployment_propnumber.2", sDeployPropsNumber1); + setProperty("webServerHost", sWebServerHost2); + setProperty("webServerHost.2", sWebServerHost); + setProperty("webServerPort", sWebServerPort2); + setProperty("webServerPort.2", sWebServerPort); + setProperty("http.server.supports.endpoint.publish", + httpSupportsEndpointPublish2); + setProperty("http.server.supports.endpoint.publish.2", + httpSupportsEndpointPublish); + setProperty("securedWebServicePort", sSecuredWebServicePort2); + setProperty("securedWebServicePort.2", sSecuredWebServicePort); + setProperty("EJBServer1TxInteropEnabled", sEJBServer2TxInteropEnabled); + setProperty("EJBServer2TxInteropEnabled", sEJBServer1TxInteropEnabled); + setProperty("porting.ts.HttpsURLConnection.class.1", + sHttpsURLConnectionClass2); + setProperty("porting.ts.HttpsURLConnection.class.2", + sHttpsURLConnectionClass1); + setProperty("wsdlRepository1", sWSDLRepository2); + setProperty("wsdlRepository2", sWSDLRepository1); + + super.reverseValues(); + } + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys + * - Properties to retrieve + * @return Properties - property/value pairs + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException { + Properties pTestProps = super.getTestSpecificProperties(sPropKeys); + + // if the abstract propertymanager already loaded all props, just return + if (pTestProps.getProperty("all.props").equalsIgnoreCase("true")) { + return pTestProps; + } + + String sJtePropVal = ""; + // add all porting class props so the factories can work in the server + pTestProps.put("porting.ts.deploy.class.1", + getProperty("porting.ts.deploy.class.1")); + pTestProps.put("porting.ts.deploy.class.2", + getProperty("porting.ts.deploy.class.2")); + pTestProps.put("porting.ts.login.class.1", + getProperty("porting.ts.login.class.1")); + pTestProps.put("porting.ts.login.class.2", + getProperty("porting.ts.login.class.2")); + pTestProps.put("porting.ts.HttpsURLConnection.class.1", + getProperty("porting.ts.HttpsURLConnection.class.1")); + pTestProps.put("porting.ts.HttpsURLConnection.class.2", + getProperty("porting.ts.HttpsURLConnection.class.2")); + pTestProps.put("porting.ts.url.class.1", + getProperty("porting.ts.url.class.1")); + pTestProps.put("porting.ts.url.class.2", + getProperty("porting.ts.url.class.2")); + pTestProps.put("porting.ts.jms.class.1", + getProperty("porting.ts.jms.class.1")); + pTestProps.put("porting.ts.jms.class.2", + getProperty("porting.ts.jms.class.2")); + pTestProps.put("namingServiceHost2", getProperty("namingServiceHost2")); + pTestProps.put("namingServicePort2", getProperty("namingServicePort2")); + pTestProps.put("namingServiceHost1", getProperty("namingServiceHost1")); + pTestProps.put("namingServicePort1", getProperty("namingServicePort1")); + pTestProps.put("wsdlRepository1", getProperty("wsdlRepository1")); + pTestProps.put("wsdlRepository2", getProperty("wsdlRepository2")); + + pTestProps.put("porting.ts.deploy2.class.1", + getProperty("porting.ts.deploy2.class.1", + "com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2")); + pTestProps.put("porting.ts.deploy2.class.2", + getProperty("porting.ts.deploy2.class.2", + "com.sun.ts.lib.implementation.sun.javaee.SunRIDeployment2")); + + pTestProps.put("variable.mapper", getProperty("variable.mapper")); + pTestProps.put("javaee.level", getProperty("javaee.level", "full")); + pTestProps.put("platform.mode", getProperty("platform.mode", "jakartaEE")); + pTestProps.put("persistence.second.level.caching.supported", + getProperty("persistence.second.level.caching.supported", "true")); + + // add commonly used props by application servers that may be needed within + // porting impl classes called by tests + pTestProps.put("vi.admin.user", getProperty("vi.admin.user", "admin")); + pTestProps.put("vi.admin.passwd", + getProperty("vi.admin.passwd", "adminadmin")); + pTestProps.put("orb.host", getProperty("orb.host")); + pTestProps.put("orb.port", getProperty("orb.port")); + pTestProps.put("securedWebServicePort", + getProperty("securedWebServicePort")); + pTestProps.put("webServerPort", getProperty("webServerPort")); + + String sTlsClientProtocols = getProperty("client.cert.test.jdk.tls.client.protocols", null); + if (sTlsClientProtocols != null) { + pTestProps.put("client.cert.test.jdk.tls.client.protocols", sTlsClientProtocols); + } + + // add properties used for JPA 2.2 tests. + pTestProps.put("persistence.unit.name", + getProperty("persistence.unit.name")); + pTestProps.put("persistence.unit.name.2", + getProperty("persistence.unit.name.2")); + pTestProps.put("jakarta.persistence.provider", + getProperty("jakarta.persistence.provider")); + pTestProps.put("jakarta.persistence.jdbc.driver", + getProperty("jakarta.persistence.jdbc.driver")); + pTestProps.put("jakarta.persistence.jdbc.url", + getProperty("jakarta.persistence.jdbc.url")); + pTestProps.put("jakarta.persistence.jdbc.user", + getProperty("jakarta.persistence.jdbc.user")); + pTestProps.put("jakarta.persistence.jdbc.password", + getProperty("jakarta.persistence.jdbc.password")); + pTestProps.put("jpa.provider.implementation.specific.properties", + getProperty("jpa.provider.implementation.specific.properties")); + pTestProps.put("persistence.second.level.caching.supported", + getProperty("persistence.second.level.caching.supported", "true")); + + return pTestProps; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicDeliverable.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicDeliverable.java new file mode 100644 index 0000000..ca6f103 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicDeliverable.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/** + * + * @author Raja Perumal + */ + +package com.sun.ts.lib.deliverable.jaspic; + +import com.sun.ts.lib.deliverable.AbstractDeliverable; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.lib.implementation.sun.javaee.runtime.SunRIDeploymentInfo; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.javatest.TestEnvironment; + +import java.util.Map; +import java.util.Properties; +import java.io.File; + +/** + * This class serves as a place for Jaspic Deliverable specific info. + */ +public class JaspicDeliverable extends AbstractDeliverable { + + public PropertyManagerInterface createPropertyManager(TestEnvironment te) + throws Exception { + JaspicPropertyManager propMgr = JaspicPropertyManager + .getJaspicPropertyManager(te); + + // create Jaspic specific working directories + createDir(propMgr.getProperty("wsdlRepository1")); + createDir(propMgr.getProperty("wsdlRepository2")); + return propMgr; + } + + public PropertyManagerInterface createPropertyManager(Properties p) + throws Exception { + return JaspicPropertyManager.getJaspicPropertyManager(p); + } + + public PropertyManagerInterface getPropertyManager() throws Exception { + return JaspicPropertyManager.getJaspicPropertyManager(); + } + + public Map getValidVehicles() { + super.getValidVehicles(); + + htTSValidVehicles.put("tests.service_eetest.vehicles", + new String[] { "servlet", "jsp" }); + + return htTSValidVehicles; + } + + public Map getInteropDirections() { + super.getInteropDirections(); + + return htValidRunDirections; + } + + public boolean supportsInterop() { + return false; + } + + public boolean supportsAutoDeployment() { + return false; + } + + private void createDir(String sDir) throws Exception { + File fDir = new File(sDir); + + if (!fDir.exists()) { + if (!fDir.mkdirs()) { + throw new Exception("Failed to create directory: " + sDir); + } + TestUtil.logHarnessDebug("Successfully created directory: " + sDir); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEDeliverable.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEDeliverable.java new file mode 100644 index 0000000..db09e03 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEDeliverable.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/** + * + * @author Raja Perumal + */ + +package com.sun.ts.lib.deliverable.jaspic; + +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.ts.lib.implementation.sun.javaee.runtime.SunRIDeploymentInfo; +import com.sun.ts.lib.deliverable.AbstractDeliverable; +import com.sun.ts.lib.deliverable.PropertyNotSetException; +import com.sun.ts.lib.util.TestUtil; + +import com.sun.javatest.TestEnvironment; + +import java.util.Properties; +import java.util.Map; +import java.io.File; + +/** + * This class serves as a place for JaspicJakartaEE Deliverable specific info. + */ +public class JaspicJakartaEEDeliverable extends AbstractDeliverable { + + public PropertyManagerInterface createPropertyManager(TestEnvironment te) + throws Exception { + + JaspicJakartaEEPropertyManager propMgr = JaspicJakartaEEPropertyManager + .getJaspicJakartaEEPropertyManager(te); + + // create JaspicJakartaEE specific working directories + createDir(propMgr.getProperty("wsdlRepository1")); + createDir(propMgr.getProperty("wsdlRepository2")); + return propMgr; + } + + public PropertyManagerInterface createPropertyManager(Properties p) + throws Exception { + return JaspicJakartaEEPropertyManager.getJaspicJakartaEEPropertyManager(p); + } + + public PropertyManagerInterface getPropertyManager() throws Exception { + return JaspicJakartaEEPropertyManager.getJaspicJakartaEEPropertyManager(); + } + + public DeploymentInfo getDeploymentInfo(String earFile, + String[] sValidRuntimeInfoFilesArray) { + DeploymentInfo info = null; + try { + info = new SunRIDeploymentInfo(earFile, sValidRuntimeInfoFilesArray); + } catch (Exception e) { + e.printStackTrace(); + } + return info; + } + + public boolean supportsInterop() { + return false; + } + + private void createDir(String sDir) throws Exception { + File fDir = new File(sDir); + + if (!fDir.exists()) { + if (!fDir.mkdirs()) { + throw new Exception("Failed to create directory: " + sDir); + } + TestUtil.logHarnessDebug("Successfully created directory: " + sDir); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEPropertyManager.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEPropertyManager.java new file mode 100644 index 0000000..9aa05a2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicJakartaEEPropertyManager.java @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable.jaspic; + +import com.sun.javatest.TestEnvironment; +import com.sun.ts.lib.deliverable.AbstractPropertyManager; +import com.sun.ts.lib.deliverable.PropertyNotSetException; +import java.util.Properties; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + */ +public class JaspicJakartaEEPropertyManager extends AbstractPropertyManager { + + private static JaspicJakartaEEPropertyManager jteMgr = new JaspicJakartaEEPropertyManager(); + + private String sDeployClass1; + + private String sDeployClass2; + + private String sLoginClass1; + + private String sURLClass1; + + private String sURLClass2; + + private String sJMSClass1; + + private String sDeployHost1; + + private String sDeployHost2; + + private String sWebServerHost; + + private String sWebServerPort; + + private String sWebServerHost2; + + private String sWebServerPort2; + + private String sSecuredWebServicePort; + + private String sSecuredWebServicePort2; + + private String sHttpsURLConnectionClass1; + + private String sWSDLRepository1; + + private String sWSDLRepository2; + + private String user1; + + private String password1; + + private String user2; + + private String password2; + + private JaspicJakartaEEPropertyManager() { + } + + /** + * This method returns the singleton instance of JaspicJakartaEEPropertyManager + * which provides access to all ts.jte properties. This is only called once by + * the test harness. + * + * @param env + * - TestEnvironment object from JavaTest + * @return JaspicJakartaEEPropertyManager - singleton property manager object + */ + public final static JaspicJakartaEEPropertyManager getJaspicJakartaEEPropertyManager( + TestEnvironment env) throws PropertyNotSetException { + jteMgr.setTestEnvironment(env); + jteMgr.initInteropProperties(); // TODO: why init interop only here? + return jteMgr; + } + + /** + * This method returns the singleton instance of JaspicJakartaEEPropertyManager + * which provides access to all ts.jte properties. This is only called by the + * init() method in ManualDeployment.java + * + * @param p + * - Properties object from JavaTest + * @return JaspicJakartaEEPropertyManager - singleton property manager object + */ + public final static JaspicJakartaEEPropertyManager getJaspicJakartaEEPropertyManager( + Properties p) throws PropertyNotSetException { + jteMgr.setJteProperties(p); + return jteMgr; + } + + public final static JaspicJakartaEEPropertyManager getJaspicJakartaEEPropertyManager() + throws PropertyNotSetException { + return jteMgr; + } + + private void initInteropProperties() { + } + + public void forwardValues() { + // reverse all interop props + setProperty("user1", user1); + setProperty("password1", password1); + setProperty("user2", user2); + setProperty("password2", password2); + + setProperty("porting.ts.deploy.class.1", sDeployClass1); + setProperty("porting.ts.deploy.class.2", sDeployClass2); + setProperty("porting.ts.login.class.1", sLoginClass1); + setProperty("porting.ts.url.class.1", sURLClass1); + setProperty("porting.ts.jms.class.1", sJMSClass1); + setProperty("deployment_host.1", sDeployHost1); + setProperty("deployment_host.2", sDeployHost2); + setProperty("webServerHost", sWebServerHost); + setProperty("webServerHost.2", sWebServerHost2); + setProperty("webServerPort", sWebServerPort); + setProperty("webServerPort.2", sWebServerPort2); + setProperty("securedWebServicePort", sSecuredWebServicePort); + setProperty("securedWebServicePort.2", sSecuredWebServicePort2); + setProperty("porting.ts.HttpsURLConnection.class.1", + sHttpsURLConnectionClass1); + setProperty("wsdlRepository1", sWSDLRepository1); + setProperty("wsdlRepository2", sWSDLRepository2); + + super.forwardValues(); + } + + public void reverseValues() { + // reverse all interop props + } + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys + * - Properties to retrieve + * @return Properties - property/value pairs + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException { + Properties pTestProps = super.getTestSpecificProperties(sPropKeys); + + // if the abstract propertymanager already loaded all props, just return + if (pTestProps.getProperty("all.props").equalsIgnoreCase("true")) { + return pTestProps; + } + + String sJtePropVal = ""; + // add all porting class props so the factories can work in the server + pTestProps.put("porting.ts.deploy.class.1", + getProperty("porting.ts.deploy.class.1")); + pTestProps.put("porting.ts.deploy.class.2", + getProperty("porting.ts.deploy.class.2")); + pTestProps.put("porting.ts.login.class.1", + getProperty("porting.ts.login.class.1")); + pTestProps.put("porting.ts.HttpsURLConnection.class.1", + getProperty("porting.ts.HttpsURLConnection.class.1")); + pTestProps.put("porting.ts.url.class.1", + getProperty("porting.ts.url.class.1")); + pTestProps.put("porting.ts.jms.class.1", + getProperty("porting.ts.jms.class.1")); + pTestProps.put("wsdlRepository1", getProperty("wsdlRepository1")); + pTestProps.put("wsdlRepository2", getProperty("wsdlRepository2")); + + return pTestProps; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicPropertyManager.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicPropertyManager.java new file mode 100644 index 0000000..6865d03 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/jaspic/JaspicPropertyManager.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/** + * + * @author Raja Perumal + */ + +package com.sun.ts.lib.deliverable.jaspic; + +import com.sun.ts.lib.deliverable.AbstractPropertyManager; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.PropertyNotSetException; +import com.sun.javatest.TestEnvironment; + +import java.util.Map; +import java.util.Properties; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + */ +public class JaspicPropertyManager extends AbstractPropertyManager { + // uninitialized singleton instance + private static JaspicPropertyManager jteMgr = new JaspicPropertyManager(); + + private String sLoginClass1; + + private String sLoginClass2; + + private String sURLClass1; + + private String sURLClass2; + + private String sJMSClass1; + + private String sJMSClass2; + + private String sWebServerHost; + + private String sWebServerPort; + + private String sWebServerHost2; + + private String sWebServerPort2; + + private String sSecuredWebServicePort; + + private String sSecuredWebServicePort2; + + private String sHttpsURLConnectionClass1; + + private String sHttpsURLConnectionClass2; + + private String sWSDLRepository1; + + private String sWSDLRepository2; + + private String user1; + + private String password1; + + private String user2; + + private String password2; + + private JaspicPropertyManager() { + } + + /** + * This method returns the singleton instance of TSPropertyManager which + * provides access to all ts.jte properties. This is only called once by the + * test harness. + * + * @param env + * - TestEnvironment object from JavaTest + * @return TSPropertyManager - singleton property manager object + */ + public final static JaspicPropertyManager getJaspicPropertyManager( + TestEnvironment env) throws PropertyNotSetException { + jteMgr.setTestEnvironment(env); + return jteMgr; + } + + /** + * This method returns the singleton instance of JaspicPropertyManager which + * provides access to all ts.jte properties. This is only called by the init() + * method in ManualDeployment.java + * + * @param p + * - Properties object from JavaTest + * @return JaspicPropertyManager - singleton property manager object + */ + public final static JaspicPropertyManager getJaspicPropertyManager( + Properties p) throws PropertyNotSetException { + jteMgr.setJteProperties(p); + return jteMgr; + } + + public final static JaspicPropertyManager getJaspicPropertyManager() + throws PropertyNotSetException { + return jteMgr; + } + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys + * - Properties to retrieve + * @return Properties - property/value pairs + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException { + Properties pTestProps = super.getTestSpecificProperties(sPropKeys); + + // if the abstract propertymanager already loaded all props, just return + if (pTestProps.getProperty("all.props").equalsIgnoreCase("true")) { + return pTestProps; + } + + String sJtePropVal = ""; + // add all porting class props so the factories can work in the server + pTestProps.put("porting.ts.deploy.class.1", + getProperty("porting.ts.deploy.class.1")); + pTestProps.put("porting.ts.deploy.class.2", + getProperty("porting.ts.deploy.class.2")); + pTestProps.put("porting.ts.login.class.1", + getProperty("porting.ts.login.class.1")); + pTestProps.put("porting.ts.HttpsURLConnection.class.1", + getProperty("porting.ts.HttpsURLConnection.class.1")); + pTestProps.put("porting.ts.url.class.1", + getProperty("porting.ts.url.class.1")); + pTestProps.put("porting.ts.jms.class.1", + getProperty("porting.ts.jms.class.1")); + pTestProps.put("wsdlRepository1", getProperty("wsdlRepository1")); + pTestProps.put("wsdlRepository2", getProperty("wsdlRepository2")); + + pTestProps.put("javaee.level", getProperty("javaee.level", "component")); + + return pTestProps; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKDeliverable.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKDeliverable.java new file mode 100644 index 0000000..a9e9ec1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKDeliverable.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable.tck; + +import com.sun.ts.lib.deliverable.AbstractDeliverable; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.javatest.TestEnvironment; + +import java.util.Map; +import java.util.Properties; + +/** + * This class serves as a default implementation of the Deliverable interface + * for a generic TCK. TCKs are free to use this impl if it suits their needs. + * Otherwise, it should be extended. + * + * @author Kyle Grucci + */ +public class TCKDeliverable extends AbstractDeliverable { + public PropertyManagerInterface createPropertyManager(TestEnvironment te) + throws Exception { + return TCKPropertyManager.getTCKPropertyManager(te); + } + + public PropertyManagerInterface createPropertyManager(Properties p) + throws Exception { + return TCKPropertyManager.getTCKPropertyManager(p); + } + + public PropertyManagerInterface getPropertyManager() throws Exception { + return TCKPropertyManager.getTCKPropertyManager(); + } + + public boolean supportsAutoDeployment() { + return false; + } + + public boolean supportsAutoJMSAdmin() { + return false; + } + + public boolean supportsInterop() { + return false; + } + + public Map getValidVehicles() { + super.getValidVehicles(); + + // add default values + htTSValidVehicles.put("tests.service_eetest.vehicles", + new String[] { "standalone" }); + + return htTSValidVehicles; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKPropertyManager.java b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKPropertyManager.java new file mode 100644 index 0000000..23055f7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/deliverable/tck/TCKPropertyManager.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.deliverable.tck; + +import com.sun.ts.lib.deliverable.*; +import com.sun.ts.lib.util.*; +import com.sun.javatest.*; +import java.util.*; +import java.io.*; + +/** + * This class serves as a well known place for harness, util, and porting + * classes to retrieve property values. + * + * @author Kyle Grucci + */ +public class TCKPropertyManager extends AbstractPropertyManager { + private static TCKPropertyManager jteMgr = new TCKPropertyManager(); + + /** + * This method returns the singleton instance of TCKPropertyManager which + * provides access to all ts.jte properties. This is only called once by the + * test harness. + * + * @param env + * - TestEnvironment object from JavaTest + * @return TCKPropertyManager - singleton property manager object + */ + public final static TCKPropertyManager getTCKPropertyManager( + TestEnvironment env) throws Exception { + jteMgr.setTestEnvironment(env); + return jteMgr; + } + + /** + * This method returns the singleton instance of TCKPropertyManager which + * provides access to all ts.jte properties. This is only called by the init() + * method in ManualDeployment.java + * + * @param p + * - Properties object from JavaTest + * @return TCKPropertyManager - singleton property manager object + */ + public final static TCKPropertyManager getTCKPropertyManager(Properties p) + throws Exception { + jteMgr.setJteProperties(p); + return jteMgr; + } + + public final static TCKPropertyManager getTCKPropertyManager() + throws Exception { + return jteMgr; + } + + /** + * This method is called by the test harness to retrieve all properties needed + * by a particular test. + * + * @param sPropKeys + * - Properties to retrieve + * @return Properties - property/value pairs + */ + public Properties getTestSpecificProperties(String[] sPropKeys) + throws PropertyNotSetException { + Properties pTestProps = super.getTestSpecificProperties(sPropKeys); + String sJtePropVal = ""; + pTestProps.put("porting.ts.url.class.1", + getProperty("porting.ts.url.class.1")); + String tsHome = getProperty("TS_HOME", null); + if (tsHome == null) + tsHome = getProperty("cts_home", null); + if (tsHome != null) + pTestProps.put("cts_home", tsHome); + + return pTestProps; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/CleanupMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/CleanupMethod.java new file mode 100644 index 0000000..9d3a5ae --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/CleanupMethod.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * This Annotation is used by test methods to define a custom test setup method. + */ +package com.sun.ts.lib.harness; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface CleanupMethod { + public String name(); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/CommonAppVerifier.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/CommonAppVerifier.java new file mode 100644 index 0000000..27588f5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/CommonAppVerifier.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.util.*; +import java.util.*; +import java.io.*; +import java.util.StringTokenizer; + +/** + * This class is used by the TS harness to figure out common archives that are + * needed by test directories. + * + * A singleton class not intended for concurrent access. + * + */ +public class CommonAppVerifier { + + public final static String COMMONARCHIVES_PROP_FILE_NAME = "commonarchives.properties"; + + public final static String EXCLUDE_KEY = "exclude.dir"; + + private static Properties mapping; + + private static String[] keys; // sorted ascending + + private static String[] excludes; + + private String relativeTestDir; + + private static boolean loaded; + + private static String distDir; + + // an uninitialized singleton instance + private static CommonAppVerifier instance = new CommonAppVerifier(); + + private CommonAppVerifier() { + } + + public static CommonAppVerifier getInstance(File path) { + if (instance == null) { + instance = new CommonAppVerifier(); + } + instance.init(path); + String pathString = path.getPath(); + distDir = pathString.substring(0, + pathString.lastIndexOf("dist" + File.separator) + 5); + return instance; + } + + private void loadExcludes() { + if (mapping == null) { + excludes = TestUtil.EMPTY_STRING_ARRAY; + } else { + excludes = ConfigUtil.stringToArray((String) mapping.remove(EXCLUDE_KEY)); + } + } + + private void init(File file) { + if (!loaded) { + mapping = ConfigUtil.loadPropertiesFor(COMMONARCHIVES_PROP_FILE_NAME); + + if (File.separator.equals("\\")) { + TestUtil.logHarnessDebug( + "On Windows, so we must normalize the path returned from commonarchives.properties"); + + Enumeration e = mapping.propertyNames(); + + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + String val = mapping.getProperty(key); + mapping.setProperty(key, val.replace('/', File.separatorChar)); + } + } + + loadExcludes(); + keys = ConfigUtil.loadKeysFrom(mapping); + loaded = true; + } + if (mapping != null) { + this.relativeTestDir = TestUtil.getRelativePath(file.getPath()); + } + + } + + private boolean isExcluded() { + for (int i = 0; i < excludes.length; i++) { + if (relativeTestDir.startsWith(excludes[i])) { + TestUtil.logHarnessDebug( + "CommonAppVerifier: This test dir is excluded from those listed in commonarchives.properties."); + TestUtil.logHarnessDebug( + "CommonAppVerifier: Please check your exclude list in the commonarchives.properties file."); + return true; + } + } + return false; + } + + /** + * This method returns the common archives for a given test directory + * + * @return the common archives for a given test directory + */ + public String[] getCommonApps() { + + String[] result; + + System.err.println("getCommonApps - relativeTestDir = " + relativeTestDir); + if (mapping == null || keys == null || isExcluded()) { + result = TestUtil.EMPTY_STRING_ARRAY; + } else { + result = getMappingValue(); + } + + return result; + } + + private String[] getMappingValue() { + + String relativePath = "commonarchives." + relativeTestDir; + for (int i = keys.length - 1; i >= 0; i--) { // must traverse in reverse + // order. + if (relativePath.startsWith(keys[i])) { + + // check that that we don't have a test leaf dir thet is a subset + // of another test leaf dir - e.g. jaxrs + String relativePathLeafDir = relativePath + .substring(relativePath.lastIndexOf("/")); + String keyLeafDir = keys[i].substring(keys[i].lastIndexOf("/")); + // TestUtil.logHarnessDebug("relativePathLeafDir = " + + // relativePathLeafDir); + // TestUtil.logHarnessDebug("keyLeafDir = " + keyLeafDir); + + if (!relativePathLeafDir.startsWith(keyLeafDir) + || relativePathLeafDir.equals(keyLeafDir)) { + return stringToArray(mapping.getProperty(keys[i])); + } + } + } + return TestUtil.EMPTY_STRING_ARRAY; + } + + private String[] stringToArray(String s) { + if (s == null) { + return TestUtil.EMPTY_STRING_ARRAY; + } + + StringTokenizer st = new StringTokenizer(s, " ,;\t\r\n\f"); + int tokenCount = st.countTokens(); + if (tokenCount == 0) { + return TestUtil.EMPTY_STRING_ARRAY; + } + String[] result = new String[tokenCount]; + for (int i = 0; st.hasMoreTokens(); i++) { + result[i] = distDir + st.nextToken(); + } + return result; + } +} +/* + * public class CommonAppVerifier { private static Map htValidApps; private + * String sRelativeTestPath = ""; + * + * private CommonAppVerifier() {} + * + * //use specific classloader if the class-to-load is not in the classpath of + * the current vm. private static void getDeliverableTable (ClassLoader + * classLoader) { if (htValidApps == null) { try { htValidApps = + * DeliverableFactory.getDeliverableInstance(classLoader).getCommonApps(); } + * catch (Exception e) { TestUtil. + * logHarness("ERROR: Failed to get common apps from the Deliverable instance." + * , e); } } } + * + * public static String[] getCommonApps (String sPath) { return + * getCommonApps(sPath, null); } + * + * + * public static String[] getCommonApps (String sPath, ClassLoader classLoader) + * { //get the mappings from the active deliverable + * getDeliverableTable(classLoader); String sPathCopy = sPath; String + * sRelativeTestPath = convertSlashesToDashes(sPath); String[] sVal2 = null; + * String sRelativeTestPathCopy = sRelativeTestPath; int iTestsIndex = + * sPathCopy.lastIndexOf(File.separator + TestUtil.getDistString() + + * File.separator); String sTSHome = sPathCopy.substring(0, iTestsIndex); + * if(TestUtil.harnessDebug) TestUtil.logHarnessDebug("Try TS_HOME = " + + * sTSHome); while (!(new File(sTSHome + File.separator + "bin")).exists()) { + * iTestsIndex = sTSHome.lastIndexOf(File.separator + TestUtil.getDistString() + + * File.separator); if (iTestsIndex == -1) { TestUtil. + * logHarness("ERROR: Failed to find the tests directory while trying to get TS_HOME from the test directory: " + * + sPathCopy); break; } sTSHome = sTSHome.substring(0, iTestsIndex); } int + * iTSDirLength = sTSHome.length(); if (sPathCopy.endsWith(File.separator)) { + * sPathCopy = sPathCopy.substring(0, sPathCopy.length() - 1); } + * sRelativeTestPath = (sPathCopy.substring(iTSDirLength + + * 1)).replace(File.separatorChar, '_'); + * + * if(TestUtil.harnessDebug) TestUtil.logHarnessDebug("sRelativeTestPath = " + + * sRelativeTestPath); + * + * if (sTSHome.endsWith(File.separator)) { sTSHome = sTSHome.substring(0, + * sTSHome.length() - 1); } + * + * if(TestUtil.harnessDebug) + * TestUtil.logHarnessDebug("TS_HOME from backtracing=" + sTSHome); do { sVal2 = + * (String[])htValidApps.get(sRelativeTestPathCopy + ".common_apps"); if + * (TestUtil.harnessDebug && sVal2 != null) { + * TestUtil.logHarnessDebug("common apps for " + sRelativeTestPathCopy + " = " + + * Arrays.asList(sVal2).toString()); } } while ((sRelativeTestPathCopy = + * getNextLevelUp(sRelativeTestPathCopy)) != null && sVal2 == null); if(sVal2 != + * null && TestUtil.harnessDebug) { + * TestUtil.logHarnessDebug("common apps from lookup: " + + * Arrays.asList(sVal2).toString()); } //add ctshome to each relative common app + * path if(sVal2 == null) { return null; } String[] result = new + * String[sVal2.length]; for (int ii = 0; ii < sVal2.length; ii++) { result[ii] + * = sTSHome + convertDashesToSlashes(sVal2[ii]); } return result; } + * + * private static String getNextLevelUp (String sDottedPath) { int index = 0; + * String sNewPath = null; index = sDottedPath.lastIndexOf("-"); if (index != + * -1) sNewPath = sDottedPath.substring(0, index); return sNewPath; } + * + * private static String convertSlashesToDashes (String sTestDir) { String + * sRelativeTestPath = (sTestDir.substring(sTestDir.indexOf(File.separator + + * "ts" + File.separator + "tests" + File.separator) + + * 4)).replace(File.separatorChar, '-'); if(TestUtil.harnessDebug) + * TestUtil.logHarnessDebug("convertSlashesToDashes(): sRelativeTestPath = " + + * sRelativeTestPath); return sRelativeTestPath; } + * + * private static String convertDashesToSlashes (String sTestDir) { String + * sRelativeTestPath = sTestDir.replace('-', File.separatorChar); + * if(TestUtil.harnessDebug) + * TestUtil.logHarnessDebug("convertDashToSlashes(): sRelativeTestPath = " + + * sRelativeTestPath); return sRelativeTestPath; } } + */ diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/EETest.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/EETest.java new file mode 100644 index 0000000..1ede1e8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/EETest.java @@ -0,0 +1,967 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.util.*; +import java.util.*; +import java.io.*; +import java.net.*; +import java.lang.reflect.*; +import com.sun.javatest.Status; +import com.sun.javatest.*; +import java.lang.annotation.Annotation; + +/** + * This abstract class must be extended by all clients of all J2EE-TS tests. All + * implementations of this class must define a setup, cleanup, and + * runtest(method names of runtest methods must match the 'testname' tag. EETest + * uses reflection to invoke these methods which in turn, run the test(s) to + * completion. Tests are assumed to pass, unless a Fault is thrown. + * + * @author Kyle Grucci + */ +public abstract class EETest implements Serializable { + + /* + * Please do NOT change this class in an incompatible manner with respect to + * serialization. Please see the serialization specification to determine what + * is a compatible change versus incompatible. If you do need to change this + * class in an incompatible manner you will need to rebuild the compat tests. + * You should also increment the serialVersionUID field to denote that this + * class is incompatible with older versions. + */ + static final long serialVersionUID = -4235235600918875382L; + + transient protected PrintStream log; + + transient protected PrintStream err; + + protected String sTestCase; + + transient Status sTestStatus = Status.passed(""); + + Class testClass = this.getClass(); + + Object testClInst; + + // nCl is true if the test class is different from the client class. + boolean nCl; + + boolean bUtilAlreadyInitialized; + + Vector vLeftOverTestArgs; + + protected int iLogDelaySeconds; + + // get the props from the args + protected Properties getTestPropsFromArgs(String[] argv) { + Properties p = new Properties(); + Properties ap; + String sProp; + String sVal; + boolean bRunIndividualTest = false; + vLeftOverTestArgs = new Vector(); + // load a props object if used with -p + for (int ii = 0; ii < argv.length; ii++) { + if (argv[ii].startsWith("-p") || argv[ii].startsWith("-ap")) { + ap = initializeProperties(argv[++ii]); + // add additional props to "p" + Enumeration e = ap.propertyNames(); + String key; + while (e.hasMoreElements()) { + key = (String) e.nextElement(); + p.put(key, ap.getProperty(key)); + } + } else if (argv[ii].startsWith("-d")) { + sProp = argv[ii].substring(2, argv[ii].indexOf('=')); + sVal = argv[ii].substring(argv[ii].indexOf('=') + 1); + p.put(sProp, sVal); + } else if (argv[ii].equalsIgnoreCase("-t")) { + sTestCase = argv[++ii]; + bRunIndividualTest = true; + } else { + // there must be args that the test needs, + // so pass these on + vLeftOverTestArgs.addElement(argv[ii]); + } + } + if (bRunIndividualTest) + p.setProperty("testName", sTestCase); + return p; + } + + private Method getSetupMethod(Class testClass, Method runMethod) { + String[] s = {}; + Class[] setupParameterTypes = { s.getClass(), + (new Properties()).getClass() }; + Method setupMethod = null; + + // first check for @SetupMethod annotation on run method + Annotation annotation = runMethod.getAnnotation(SetupMethod.class); + + if (annotation != null) { + try { + TestUtil + .logTrace("getSetupMethod - getting setup method from annotation"); + SetupMethod setupAnnotation = (SetupMethod) annotation; + setupMethod = testClass.getMethod(setupAnnotation.name(), + setupParameterTypes); + TestUtil.logTrace( + "getSetupMethod - setup method name: " + setupAnnotation.name()); + } catch (NoSuchMethodException e) { + setTestStatus(Status.failed( + "Could not find annotation defined setup method for testcase: " + + sTestCase), + e); + } + } else { + TestUtil.logTrace("No setupMethod annotation present"); + try { + // get setup method + TestUtil.logTrace( + "getSetupMethod - checking for testcase specific setup method: " + + sTestCase + "_setup"); + setupMethod = testClass.getMethod(sTestCase + "_setup", + setupParameterTypes); + } catch (NoSuchMethodException e2) { + TestUtil.logTrace( + "getSetupMethod - checking for default class specific setup method"); + + // try calling the generic setup method + try { + setupMethod = testClass.getMethod("setup", setupParameterTypes); + + } catch (NoSuchMethodException e3) { + setTestStatus( + Status.failed( + "Could not find setup method for" + "testcase: " + sTestCase), + e3); + } + } catch (RuntimeException re) { + setTestStatus( + Status.failed("Could not access the test case: " + sTestCase), re); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + } + return setupMethod; + } + + private Method getRunMethod(Class testClass) { + Method runMethod = null; + try { + // get run method + TestUtil.logTrace("** IN getRunMethod: testClass=" + testClass.getName()); + TestUtil.logTrace("** IN getRunMethod: testname=" + sTestCase); + runMethod = testClass.getMethod(sTestCase, (java.lang.Class[]) null); + } catch (NoSuchMethodException e) { + setTestStatus( + Status.failed( + "Could not find the run method" + "for test case: " + sTestCase), + e); + } catch (RuntimeException e) { + setTestStatus( + Status.failed("Could not access the test case: " + sTestCase), e); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + return runMethod; + } + + private Method getCleanupMethod(Class testClass, Method runMethod) { + Method cleanupMethod = null; + + // first check for @CleanupMethod annotation on run method + Annotation annotation = runMethod.getAnnotation(CleanupMethod.class); + + if (annotation != null) { + try { + TestUtil.logTrace( + "getCleanupMethod - getting cleanup method from annotation"); + CleanupMethod cleanupAnnotation = (CleanupMethod) annotation; + cleanupMethod = testClass.getMethod(cleanupAnnotation.name(), + (java.lang.Class[]) null); + TestUtil.logTrace("getCleanupMethod - cleanup method name: " + + cleanupAnnotation.name()); + } catch (NoSuchMethodException e) { + setTestStatus(Status.failed( + "Could not find annotation defined cleanup method for testcase: " + + sTestCase), + e); + } + } else { + TestUtil.logTrace("No cleanupMethod annotation present"); + try { + // get cleanup method + TestUtil.logTrace( + "getCleanupMethod - checking for testcase specific cleanup method: " + + sTestCase + "_cleanup"); + cleanupMethod = testClass.getMethod(sTestCase + "_cleanup", + (java.lang.Class[]) null); + } catch (NoSuchMethodException e2) { + TestUtil.logTrace( + "getCleanupMethod - checking for default class specific cleanup method"); + + // try calling the generic cleanup method + try { + cleanupMethod = testClass.getMethod("cleanup", + (java.lang.Class[]) null); + + } catch (NoSuchMethodException e3) { + setTestStatus(Status.failed( + "Could not find cleanup method for" + "testcase: " + sTestCase), + e3); + } + } catch (RuntimeException re) { + setTestStatus( + Status.failed("Could not access the test case: " + sTestCase), re); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + } + return cleanupMethod; + } + + protected Properties initializeProperties(String sPropertiesFile) { + FileInputStream propertyFileInputStream = null; + Properties props = null; + try { + propertyFileInputStream = new FileInputStream(sPropertiesFile); + props = new Properties(); + props.load(propertyFileInputStream); + } catch (FileNotFoundException e) { + TestUtil.logHarness("Could not find specified props file", e); + } catch (IOException e) { + TestUtil.logHarness("IOException while reading props file", e); + } catch (Exception e) { + TestUtil.logHarness("Exception while reading props file", e); + } finally { + try { + if (propertyFileInputStream != null) + propertyFileInputStream.close(); + } catch (IOException ex) { + TestUtil.logHarness("IOException while closing props file", ex); + } + } + return props; + } + + /** + *

+ * This method is only called when test are run outside of JavaTest. If a + * testcase name is passed within argv, then that testcase is run. Otherwise, + * all testcases within this implementation of EETest are run. + *

+ * + * @param argv + * an array of arguments that a test may use + * @param log + * Stream passed to TestUtil for standard loggin + * @param err + * Writer passed to TestUtil for error logging + * @return a Javatest {@link Status} object (passed or failed) + */ + public Status run(String[] argv, PrintStream log, PrintStream err) { + return run(argv, new PrintWriter(log, true), new PrintWriter(err, true)); + } + + /** + * This method is only called when tests are run outside of JavaTest or if the + * test is being run in the same VM as the harness. If a testcase name is + * passed within argv, then that testcase is run. Otherwise, all testcases + * within this implementation of EETest are run. + * + * @param argv + * an array of arguments that a test may use + * @param log + * Writer passed to TestUtil for standard loggin + * @param err + * Writer passed to TestUtil for error logging + * @return a Javatest {@link Status} object (passed or failed) + */ + public Status run(String[] argv, PrintWriter log, PrintWriter err) { + Properties props; + Status retStatus = Status.failed("No status set yet"); + // assign log and reference output streams + // this.err = err; + // this.log = log; + props = getTestPropsFromArgs(argv); + // get the # of secs we should delay to allow reporting to finish + try { + iLogDelaySeconds = Integer + .parseInt(props.getProperty("harness.log.delayseconds", "0")) * 1000; + } catch (NumberFormatException e) { + // set the default if a number was not set + iLogDelaySeconds = 0; + } + if (props.isEmpty()) + return Status.failed( + "FAILED: An error occurred while trying to load the test properties"); + // copy leftover args to an array and pass them on + int iSize = vLeftOverTestArgs.size(); + if (iSize == 0) { + argv = null; + } else { + argv = new String[iSize]; + for (int ii = 0; ii < iSize; ii++) { + argv[ii] = (String) vLeftOverTestArgs.elementAt(ii); + } + } + props.put("line.separator", System.getProperty("line.separator")); + if (sTestCase == null) + return runAllTestCases(argv, props, log, err); + else { + // need to pass these streams to the Local Reporter + TestUtil.setCurrentTest(sTestCase, log, err); + TestUtil.initClient(props); + retStatus = getPropsReady(argv, props); + try { + Thread.sleep(iLogDelaySeconds); + } catch (InterruptedException e) { + logErr("Exception: " + e); + } + return retStatus; + } + } + + protected void setTestStatus(Status s, Throwable t) { + // only set the status for the first failure + if (sTestStatus.getType() == Status.PASSED) + sTestStatus = s; + if (t != null) { + TestUtil.logErr(s.getReason()); + TestUtil.logErr("Exception at: ", t); + } + } + + protected Status runAllTestCases(String[] argv, Properties p, PrintWriter log, + PrintWriter err) { + String[] sTestCases; + int iPassedCount = 0; + int iFailedCount = 0; + TestUtil.initClient(p); + try { + sTestCases = getAllTestCases(p); + } catch (Exception e) { + e.printStackTrace(); + return Status + .failed("An error occurred trying to get all" + "testcase methods."); + } + for (int ii = 0; ii < sTestCases.length; ii++) { + sTestCase = sTestCases[ii]; + p.setProperty("testName", sTestCase); + TestUtil.setCurrentTest(sTestCase, log, err); + bUtilAlreadyInitialized = true; + sTestStatus = Status.passed(""); + TestUtil.separator2(); + TestUtil.logMsg("Beginning Test: " + sTestCases[ii]); + TestUtil.separator2(); + sTestStatus = getPropsReady(argv, p); + try { + Thread.sleep(iLogDelaySeconds); + } catch (InterruptedException e) { + logErr("Exception: " + e); + } + if (sTestStatus.getType() == Status.PASSED) { + sTestCases[ii] += "...........PASSED"; + iPassedCount++; + } else { + TestUtil.logMsg(sTestStatus.getReason()); + sTestCases[ii] += "...........FAILED"; + iFailedCount++; + } + TestUtil.separator2(); + TestUtil.logMsg("End Test: " + sTestCases[ii]); + TestUtil.separator2(); + } + TestUtil.separator2(); + TestUtil.logMsg("Completed running " + sTestCases.length + " tests."); + TestUtil.logMsg("Number of Tests Passed = " + iPassedCount); + TestUtil.logMsg("Number of Tests Failed = " + iFailedCount); + TestUtil.separator2(); + for (int ii = 0; ii < sTestCases.length; ii++) { + TestUtil.logMsg(sTestCases[ii]); + } + if (iFailedCount > 0) + return Status.failed("FAILED"); + else + return Status.passed("PASSED"); + } + + /** + * This method is only called from JavaTest to run a single testcase. All + * properties are determined from the source code tags. + * + * @param argv + * an array of arguments that a test may use + * @param p + * properties that are used by the testcase + * @param log + * stream passed to TestUtil for standard logging + * @param err + * stream passed to TestUtil for error logging + * @return a Javatest Status object (passed or failed) + */ + public Status run(String[] argv, Properties p, PrintWriter log, + PrintWriter err) { + // need to pass these streams to the Local Reporter + sTestCase = p.getProperty("testName"); + TestUtil.setCurrentTest(sTestCase, log, err); + TestUtil.initClient(p); + return getPropsReady(argv, p); + } + + protected Status getPropsReady(String[] argv, Properties p) { + // we only do this if we're in the Harness VM. If we're on the server, + // that means that we're executing a service test within a generic + // vehicle. In that case, we just invoke the setup, run, and cleanup + // methods. + // trim any whitespace around the property values + Enumeration enum1 = p.propertyNames(); + String key; + String value; + while (enum1.hasMoreElements()) { + key = (String) enum1.nextElement(); + value = p.getProperty(key); + if (value != null) { + p.put(key, value.trim()); + } + // TestUtil.logTrace("Trimming prop: " + key + ". Value = " + value); + } + // set testname just to be sure + sTestCase = p.getProperty("testName"); + // The code below is to allow JCK service tests to be run from + // ejb vehicles that have been bundled with an appclient + // Need to get the setup(), run() and cleanup() methods in the + // individual test classes -- not from the APIClient.class. + // TestUtil.logTrace("**Got current testclass : " + + // this.getClass().getName()); + // TestUtil.logTrace("*** Got testclass property : " + + // p.getProperty("test_classname")); + String sClass_name = p.getProperty("test_classname"); + if (sClass_name != null) { + if ((p.getProperty("finder").trim()).equals("jck")) { + if (!((this.getClass().getName()).equals((sClass_name.trim())))) { + try { + testClInst = Class.forName(sClass_name).newInstance(); + testClass = testClInst.getClass(); + nCl = true; + } catch (Exception te) { + te.printStackTrace(); + } + } + } + } + // set the harness.host prop so the server can initialize the + // the TestUtil logging + try { + p.setProperty("harness.host", + InetAddress.getLocalHost().getHostAddress()); + } catch (UnknownHostException e) { + TestUtil.logErr("Could not get our hostname to send to the " + + "server for testcase: " + sTestCase); + return Status.failed("Could not get our hostname to send to the " + + "server for testcase: " + sTestCase); + } + return run(argv, p); + } + + // public RemoteStatus run(String[] argv, Properties p, int iDummy) + // { + // return new RemoteStatus(run(argv, p)); + // } + /** + * This run method is the one that actually invokes reflection to figure out + * and invoke the testcase methods. + * + * @param argv + * an array of arguments that a test may use + * @param p + * properties that are used by the testcase + * @return a Javatest Status object (passed or failed) + */ + public Status run(String[] argv, Properties p) { + sTestStatus = Status.passed(""); + // Make sure we set the testname if we're in a generic vehicle + sTestCase = p.getProperty("testName"); + // Class testClass = this.getClass(); + Method setupMethod, runMethod, cleanupMethod; + + // commented out as it's not currently used + // Class testArgTypes[] = {}; + Object testArgs[] = { argv, p }; + TestUtil.logTrace("*** in EETest.run(argv,p)"); + if (sTestCase == null || sTestCase.equals("")) { + // TestUtil.logTrace("*** in EETestrun(): testCase=null)"); + return Status.failed("Invalid test case name: " + sTestCase); + } else { + // The code below is to allow JCK service tests to be run from + // ejb vehicles that have been bundled with an appclient + // Need to get the setup(), run() and cleanup() methods in the + // individual test classes -- not from the APIClient.class. + // TestUtil.logTrace("**Got current testclass : " + + // this.getClass().getName()); + // TestUtil.logTrace("*** Got testclass property : " + + // p.getProperty("test_classname")); + // if ( p.getProperty("test_classname") != null ) + // if ( + // !((this.getClass().getName()).equals((p.getProperty("test_classname").trim())))) + // { + // try { + // testClInst=Class.forName(p.getProperty("test_classname")).newInstance(); + // testClass=testClInst.getClass(); + // nCl=true; + // }catch ( Exception te ) { + // te.printStackTrace(); + // } + // } + TestUtil.logTrace("TESTCLASS=" + testClass.getName()); + runMethod = getRunMethod(testClass); + if (runMethod == null) + TestUtil.logTrace("* RUN METHOD is null and is not found"); + else { + TestUtil.logTrace("** GOT RUN METHOD!"); + TestUtil.logTrace("**runmethod=" + runMethod.getName()); + } + TestUtil.logTrace("ABOUT TO GET SETUP METHOD!"); + setupMethod = getSetupMethod(testClass, runMethod); + if (setupMethod == null) + TestUtil.logTrace("SETUP METHOD not found"); + else + TestUtil.logTrace("GOT SETUP METHOD!"); + + cleanupMethod = getCleanupMethod(testClass, runMethod); + if (cleanupMethod == null) + TestUtil.logTrace("CLEANUP METHOD not found"); + else + TestUtil.logTrace("GOT CLEANUP METHOD!"); + // if anything went wrong while getting our methods, return + if (setupMethod == null || runMethod == null || cleanupMethod == null) + return Status.failed("One of the test methods could not be" + + "found for testcase: " + sTestCase); + try { + TestUtil.logTrace("ABOUT TO INVOKE SETUP METHOD!"); + // if new classname is true, use that class name instead of + // "this" class. + if (nCl) + setupMethod.invoke(testClInst, testArgs); + else + setupMethod.invoke(this, testArgs); + TestUtil.logTrace("INVOKED SETUP METHOD!"); + } catch (IllegalAccessException e) { + setTestStatus(Status.failed( + "Could not execute setup method" + "for test case: " + sTestCase), + e); + } catch (InvocationTargetException e) { + setTestStatus(Status.failed( + "Test case throws exception: " + e.getTargetException().toString()), + e.getTargetException()); + } catch (RuntimeException e) { + setTestStatus( + Status.failed("Could not access the test case: " + e.toString()), + e); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + if (sTestStatus.getType() == Status.PASSED) { + TestUtil.logTrace("ABOUT TO INVOKE EETEST RUN METHOD!"); + try { + // if new classname is true, use that class name instead of + // "this" class. + if (nCl) + runMethod.invoke(testClInst, (java.lang.Object[]) null); + else + runMethod.invoke(this, (java.lang.Object[]) null); + } catch (IllegalAccessException e) { + setTestStatus(Status.failed( + "Could not execute run method" + "for test case: " + sTestCase), + e); + } catch (InvocationTargetException e) { + setTestStatus( + Status.failed("Test case throws exception: " + + e.getTargetException().getMessage()), + e.getTargetException()); + } catch (RuntimeException e) { + setTestStatus( + Status.failed("Could not access the test case: " + e.toString()), + e); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + } + // call cleanup no matter what + try { + // if new classname is true, use that class name instead of + // "this" class. + if (nCl) + cleanupMethod.invoke(testClInst, (java.lang.Object[]) null); + else + cleanupMethod.invoke(this, (java.lang.Object[]) null); + } catch (IllegalAccessException e) { + setTestStatus( + Status.failed( + "Could not execute cleanup method for test case: " + sTestCase), + e); + } catch (InvocationTargetException e) { + setTestStatus(Status.failed("Test case throws exception: " + + e.getTargetException().getMessage()), e.getTargetException()); + // Throwable t = e.getTargetException(); + } catch (RuntimeException e) { + setTestStatus( + Status.failed("Could not access the test case: " + e.toString()), + e); + } catch (ThreadDeath t) { + throw t; + } catch (Throwable t) { + setTestStatus(Status.failed("Unexpected Throwable: " + t), t); + } + } + return sTestStatus; + } + + private String[] getAllTestCases(Properties p) throws SetupException { + Vector tests = new Vector(); + String[] testMethods; + try { + // read in exclude list once per VM + ExcludeListProcessor.readExcludeList(System.getProperty("exclude.list")); + // setup a testname in a format that will macth the exclude list + String sJavaTestName = ""; + String sVehicle; + sVehicle = p.getProperty("vehicle"); + if (sVehicle != null) { + // tack on "_from_" + sVehicle = "_from_" + sVehicle; + } + // for all tests, prepend the relative path and + // .java file + String sClientClassName = this.getClass().getName(); + String sClientJavaName = sClientClassName + .substring(sClientClassName.lastIndexOf('.') + 1) + ".java"; + String sCurrentDir = System.getProperty("current.dir"); + sCurrentDir = sCurrentDir.replace(File.separatorChar, '/'); + String sRelativeTestDir = sCurrentDir + .substring(sCurrentDir.indexOf("tests/")); + sRelativeTestDir = sRelativeTestDir + .substring(sRelativeTestDir.indexOf("/") + 1); + // make sure we have a trailing "/" + if (!sRelativeTestDir.endsWith("/")) + sRelativeTestDir += "/"; /* + * Get public methods for this class Loop + * through them to get methods that return + * void, have no parameters, and contain "Test" + * in their name. + */ + + Method[] methods = testClass.getMethods(); + for (int ii = 0; ii < methods.length; ii++) { + Class[] paramTypes = methods[ii].getParameterTypes(); + + // commented out as this is not currently used + // Class returnType = methods[ii].getReturnType(); + + // test that the parameter types match + if ((paramTypes.length == 0)) + // && + // Void.class.isAssignableFrom(returnType)) + { + String sName = methods[ii].getName(); + // test for our name requirements + if ((sName.indexOf("Test") != -1 || sName.indexOf("test") != -1) + && (sName.indexOf("Setup") == -1 && sName.indexOf("setup") == -1) + && (sName.indexOf("Cleanup") == -1 + && sName.indexOf("cleanup") == -1)) { + // check here for excluded tests when running + // outside of JavaTest + sJavaTestName = sName + sVehicle; + // construct the JavaTest recognizable testname + sJavaTestName = sRelativeTestDir + sClientJavaName + "#" + + sJavaTestName; + // for all tests, check to see if it's excluded + if (!ExcludeListProcessor.isTestExcluded(sJavaTestName)) + tests.addElement(sName); + else + System.out.println(sJavaTestName + " is excluded."); + sJavaTestName = ""; + } + } + } + } catch (SecurityException e) { + throw new SetupException("Failed while getting all test methods: ", e); + } + /* + * Check size of vector, if <= 0, no methods match signature if > 0, copy + * values into testMethods array + */ + if (tests.size() <= 0) + throw new SetupException( + "No methods match signature: " + "\"public void methodName()\""); + testMethods = new String[tests.size()]; + for (int ii = 0; ii < testMethods.length; ii++) { + testMethods[ii] = (String) tests.elementAt(ii); + } + return testMethods; + } + + /** + * prints a string to the TestUtil log stream. All tests should use this + * method for standard logging messages + * + * @param msg + * string to print to the log stream + */ + public void logMsg(String msg) { + TestUtil.logMsg(msg); + } + + /** + * prints a debug string to the TestUtil log stream. All tests should use this + * method for verbose logging messages. Whether or not the string is printed + * is determined by the last call to the TestUtil setTrace method. + * + * @param msg + * string to print to the log stream + */ + public void logTrace(String msg) { + TestUtil.logTrace(msg); + } + + /** + * prints a string to the TestUtil error stream. All tests should use this + * method for error messages + * + * @param msg + * string to print to the error stream + */ + public void logErr(String msg) { + TestUtil.logErr(msg); + } + + /** + * prints a string to the TestUtil error stream. All tests should use this + * method for error messages + * + * @param msg + * string to print to the error stream + * @param e + * a Throwable whose stacktrace gets printed + */ + public void logErr(String msg, Throwable e) { + TestUtil.logErr(msg, e); + } + + /** + * This exception must be thrown by all implentations of EETest to signify a + * test failure. Overrides 3 printStackTrace methods to preserver the original + * stack trace. Using setStackTraceElement() would be more elegant but it is + * not available prior to j2se 1.4. + * + * @author Kyle Grucci + */ + public static class Fault extends Exception { + private static final long serialVersionUID = -1574745208867827913L; + + public Throwable t; + + /** + * creates a Fault with a message + */ + public Fault(String msg) { + super(msg); + TestUtil.logErr(msg); + } + + /** + * creates a Fault with a message. + * + * @param msg + * the message + * @param t + * prints this exception's stacktrace + */ + public Fault(String msg, Throwable t) { + super(msg); + this.t = t; + // TestUtil.logErr(msg, t); + } + + /** + * creates a Fault with a Throwable. + * + * @param t + * the Throwable + */ + public Fault(Throwable t) { + super(t); + this.t = t; + } + + /** + * Prints this Throwable and its backtrace to the standard error stream. + * + */ + public void printStackTrace() { + if (this.t != null) { + this.t.printStackTrace(); + } else { + super.printStackTrace(); + } + } + + /** + * Prints this throwable and its backtrace to the specified print stream. + * + * @param s + * PrintStream to use for output + */ + public void printStackTrace(PrintStream s) { + if (this.t != null) { + this.t.printStackTrace(s); + } else { + super.printStackTrace(s); + } + } + + /** + * Prints this throwable and its backtrace to the specified print writer. + * + * @param s + * PrintWriter to use for output + */ + public void printStackTrace(PrintWriter s) { + if (this.t != null) { + this.t.printStackTrace(s); + } else { + super.printStackTrace(s); + } + } + + @Override + public Throwable getCause() { + return t; + } + + @Override + public synchronized Throwable initCause(Throwable cause) { + if (t != null) + throw new IllegalStateException("Can't overwrite cause"); + if (!Exception.class.isInstance(cause)) + throw new IllegalArgumentException("Cause not permitted"); + this.t = (Exception) cause; + return this; + } + } + + /** + * This exception is used only by EETest. Overrides 3 printStackTrace methods + * to preserver the original stack trace. Using setStackTraceElement() would + * be more elegant but it is not available prior to j2se 1.4. + * + * @author Kyle Grucci + */ + public static class SetupException extends Exception { + private static final long serialVersionUID = -7616313680616499158L; + + public Exception e; + + /** + * creates a Fault with a message + */ + public SetupException(String msg) { + super(msg); + } + + /** + * creates a SetupException with a message + * + * @param msg + * the message + * @param e + * prints this exception's stacktrace + */ + public SetupException(String msg, Exception e) { + super(msg); + this.e = e; + } + + /** + * Prints this Throwable and its backtrace to the standard error stream. + * + */ + public void printStackTrace() { + if (this.e != null) { + this.e.printStackTrace(); + } else { + super.printStackTrace(); + } + } + + /** + * Prints this throwable and its backtrace to the specified print stream. + * + * @param s + * PrintStream to use for output + */ + public void printStackTrace(PrintStream s) { + if (this.e != null) { + this.e.printStackTrace(s); + } else { + super.printStackTrace(s); + } + } + + /** + * Prints this throwable and its backtrace to the specified print writer. + * + * @param s + * PrintWriter to use for output + */ + public void printStackTrace(PrintWriter s) { + if (this.e != null) { + this.e.printStackTrace(s); + } else { + super.printStackTrace(s); + } + } + + @Override + public Throwable getCause() { + return e; + } + + @Override + public synchronized Throwable initCause(Throwable cause) { + if (e != null) + throw new IllegalStateException("Can't overwrite cause"); + if (!Exception.class.isInstance(cause)) + throw new IllegalArgumentException("Cause not permitted"); + this.e = (Exception) cause; + return this; + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ExcludeListProcessor.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExcludeListProcessor.java new file mode 100644 index 0000000..bfed620 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExcludeListProcessor.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.util.Vector; +import java.util.StringTokenizer; +import java.io.File; +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.PrintWriter; +import java.io.FileWriter; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.FileNotFoundException; + +public class ExcludeListProcessor { + + // pass in a string which has the filename#testname + public static boolean isTestExcluded(String fileName) { + // check to see if it exists in the exclude list + return fileNameList.contains(fileName); + } + + public static void readExcludeList(String fileName) { + BufferedReader d = null; + try { + d = new BufferedReader(new FileReader(fileName)); + String line; + while ((line = d.readLine()) != null) { + line = line.trim(); + if (line.length() > 0 && !line.startsWith("#")) { + String entry = new String(line); + fileNameList.addElement(entry.trim()); + } + } + d.close(); + } catch (FileNotFoundException e) { + System.out.println(e.toString()); + e.printStackTrace(); + } catch (IOException e) { + System.out.println(e.toString()); + e.printStackTrace(); + } + } + + /*----------- Private Members of this class -------------*/ + private static Vector fileNameList = new Vector(); + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecTSTestCmd.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecTSTestCmd.java new file mode 100644 index 0000000..87ca341 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecTSTestCmd.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.DataInputStream; +import java.io.ByteArrayInputStream; + +import com.sun.javatest.*; +import com.sun.javatest.lib.*; + +/** + * This is a modification of ProcessCommand suitable for executing + * JCK tests in an separate JVM. JCK tests may be "standard" tests which + * implement the Test interface and which report their exit status by calling + * status.exit(), or they may be "simple" tests which report their + * exit status by an exit code alone. + **/ +public class ExecTSTestCmd extends ProcessCommand { + + /** + * Generate a status for the command, based upon the command's exit code and a + * status that may have been passed from the command by using + * status.exit(). + * + * @param exitCode + * The exit code from the command that was executed. By convention, + * the expected values are: + * + * + * + * + * + *
95 + * passed + *
96 + * compare the output written to the reference stream against a + * reference file + *
97 + * failed (inside test) + *
other + * other failure + *
+ * @param logStatus + * If the command that was executed was a test program and exited by + * calling status.exit(), then logStatus will be set to + * `status'. Otherwise, it will be null. The value of the status is + * passed from the command by writing it as the last line to stderr + * before exiting the process. If it is not received as the last + * line, the value will be lost. + * @return If logStatus is null, the result is determined from just the + * exitCode; if the logStatus is not null, the type of the status must + * correspond to the standard exit code for that type, in which case + * the result will be logStatus; otherwise an object will be returned + * indicating an error. + * + **/ + protected Status getStatus(int exitCode, Status logStatus) { + // first, convert the exit code back into a Status type code + int typeFromExitCode = (exitCode == Status.exitCodes[Status.PASSED] + ? Status.PASSED + : exitCode == Status.exitCodes[Status.FAILED] ? Status.FAILED : -1); + + if (logStatus == null) { + if (typeFromExitCode != -1) + return defaultStatus[typeFromExitCode]; + else + return Status.failed("unexpected exit code: exit code " + exitCode); + } else { + if (typeFromExitCode == logStatus.getType()) + return logStatus; + else + return Status.failed("unexpected exit code (" + exitCode + + ") for reported status (" + logStatus.toString() + ")"); + } + } + + private static final Status defaultStatus[] = { Status.passed("OK"), + Status.failed("test failed"), + // checkFile() is not available in javatest 3 + // Status.checkFile("check output against reference file") + }; + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecuteTSTestSameJVMCmd.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecuteTSTestSameJVMCmd.java new file mode 100644 index 0000000..3431858 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecuteTSTestSameJVMCmd.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.javatest.Command; +import com.sun.javatest.Status; + +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + *

+ * Allows the execution of CTS/TCK tests within the same JVM. This should only + * be used for tests that can guarantee that running in such a configuration + * will have no impact on the test results. + */ +public class ExecuteTSTestSameJVMCmd extends Command { + + public ExecuteTSTestSameJVMCmd() { + } + + public Status run(String[] args, PrintWriter log, PrintWriter ref) { + int repeat = 1; + String className; + String[] executeArgs = {}; + ClassLoader loader = getClassLoader(); + + int i = 0; + + for (; i < args.length && args[i].startsWith("-"); i++) { + if ("-loadDir".equals(args[i]) && i + 1 < args.length) { + ; // ignore + } else if ("-repeat".equals(args[i]) && i + 1 < args.length) { + ; // ignore + } + } + + // Next must come the executeClass + if (i < args.length) { + className = args[i]; + i++; + } else { + return Status.failed("No executeClass specified"); + } + + // Finally, any optional args + if (i < args.length) { + executeArgs = new String[args.length - i]; + System.arraycopy(args, i, executeArgs, 0, executeArgs.length); + } + + Status status = null; + System.out.println("CLASSNAME: " + className); + try { + Class c; + if (loader == null) { + c = Class.forName(className); + } else { + c = loader.loadClass(className); + } + + Status prevStatus = null; + for (int j = 0; j < repeat; j++) { + if (repeat > 1) { + log.println("iteration: " + (j + 1)); + } + + Object t = c.newInstance(); + Class[] mainArgs = { Class.forName("[Ljava.lang.String;"), + PrintWriter.class, PrintWriter.class }; + + Method runMethod = c.getMethod("run", mainArgs); + Object[] execArgs = new Object[3]; + execArgs[0] = executeArgs; + execArgs[1] = log; + execArgs[2] = ref; + + status = (Status) runMethod.invoke(t, execArgs); + + if (repeat > 1) { + log.println(" " + status); + } + + if ((prevStatus != null) && status.getType() != prevStatus.getType()) { + status = Status + .error("Return status type changed at repetition: " + (j + 1)); + } + + if (status.isError()) { + return status; + } else { + prevStatus = status; + } + } + } catch (ClassCastException e) { + status = Status.failed("Can't load test: required interface not found"); + } catch (ClassNotFoundException e) { + status = Status.failed("Can't load test: " + e); + } catch (InstantiationException e) { + status = Status.failed("Can't instantiate test: " + e); + } catch (IllegalAccessException e) { + status = Status.failed("Illegal access to test: " + e); + } catch (VerifyError e) { + return Status + .failed("Class verification error while trying to load test class `" + + className + "': " + e); + } catch (LinkageError e) { + return Status + .failed("Class linking error while trying to load test class `" + + className + "': " + e); + } catch (NoSuchMethodException nsme) { + return Status.failed("Unable to find 'main' method in test class '" + + className + "': " + nsme); + } catch (InvocationTargetException tie) { + return Status.failed("Test Failed: " + tie); + } + return status; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecutionMode.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecutionMode.java new file mode 100644 index 0000000..bf163de --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ExecutionMode.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.util.TestUtil; +import java.util.*; +import java.io.*; + +public class ExecutionMode { + public final static int DEPLOY_RUN_UNDEPLOY = 0; + + public final static int DEPLOY = 1; + + public final static int RUN = 2; + + public final static int UNDEPLOY = 3; + + public final static int DEPLOY_RUN = 4; + + public final static int LIST = 5; + + public final static int DEFAULT = DEPLOY_RUN_UNDEPLOY; + + private ExecutionMode() { + } + + /** + * gets the current execution mode from PropertyManagerInterface or from a + * system property if overridden on the commandline. Note that current + * execution mode is not cached since harness.executeMode property may change + * between test executions. + * + * @param propMgr + * an implementation of PropertyManagerInterface. + * @return an int representing one of the 5 modes + */ + public static int getExecutionMode(PropertyManagerInterface propMgr) { + int mode = (Integer.getInteger("harness.executeMode", -1)).intValue(); + + if (mode == -1) { + if (propMgr != null) { + String modeS = propMgr.getProperty("harness.executeMode", ""); + try { + mode = Integer.parseInt(modeS); + } catch (Exception e) { + mode = DEFAULT; + } + } else { + throw new Error( + "PropertyManager is null. Please pass in a valid PropertyManager"); + } + + } + + if (mode < DEPLOY_RUN_UNDEPLOY || mode > LIST) { + TestUtil.logHarness("harness.executeMode in ts.jte: " + mode + + " is not valid. Will use default " + DEFAULT + "."); + mode = DEFAULT; + } + + TestUtil.logHarness("harness.executeMode is set to \"" + mode + "\""); + return mode; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/JCKServiceEETest.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/JCKServiceEETest.java new file mode 100644 index 0000000..97e6439 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/JCKServiceEETest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.*; + +/** + * This abstract class must be extended by all API clients of tests of J2EE + * service apis; for example, JDBC, RMI-IIOP, JavaMail, JMS, etc. This allows us + * to bundle a number of API tests into a single J2EE component and reduces the + * number of such components that have to be deployed. + * + * @author Vella Raman + */ +public abstract class JCKServiceEETest extends ServiceEETest + implements Serializable { +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ProfileHelper.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ProfileHelper.java new file mode 100644 index 0000000..6e0e92c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ProfileHelper.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import com.sun.ts.lib.deliverable.DeliverableFactory; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.util.TestUtil; + +public final class ProfileHelper { + + private static PropertyManagerInterface jteMgr; + + public static String[] getArchives(String sDir, String sInteropDirections) { + try { + jteMgr = DeliverableFactory.getDeliverableInstance().getPropertyManager(); + } catch (Exception e) { + e.printStackTrace(); + } + + String javaeeLevel = jteMgr.getProperty("javaee.level", "full"); + ArrayList sFilteredAppJarsArray = new ArrayList(); + boolean bEarPresent = false; + + File fTestDir = new File(sDir); + String[] sAppJarsArray = fTestDir.list(ArchiveFilter.getInstance()); + + if (sInteropDirections.equals("forward") && !isInteropDir(sDir)) { + // if forward and not an interop dir, then only deploy the non vibuilt + // apps + sAppJarsArray = fTestDir.list(NonVIBuiltArchiveFilter.getInstance()); + } else if (sInteropDirections.equals("reverse") && !isInteropDir(sDir)) { + // if reverse and not an interop dir, then only deploy the vibuilt apps + sAppJarsArray = fTestDir.list(VIBuiltArchiveFilter.getInstance()); + } + + if (sAppJarsArray != null) { + // first, see if we have any ears + bEarPresent = isEarPresent(sAppJarsArray); + + if (javaeeLevel.contains("full")) { + if (bEarPresent) { + for (int ii = 0; ii < sAppJarsArray.length; ii++) { + String name = sAppJarsArray[ii]; + if ((name.endsWith(".ear") || (name.indexOf("_component") != -1 + && (name.endsWith(".jar") || name.endsWith(".war") + || name.endsWith(".rar") || name.endsWith(".car"))))) { + // if any ears exist, return only ears and _component + sFilteredAppJarsArray.add(name); + } + } + sAppJarsArray = sFilteredAppJarsArray.toArray(new String[0]); + } + } else { + // Must be in a subset of EE so strip out ears ro basicaslly + // anything that is not a war + for (int ii = 0; ii < sAppJarsArray.length; ii++) { + String name = sAppJarsArray[ii]; + if (name.endsWith(".war")) { + // if any ears exist, return all non-ears + sFilteredAppJarsArray.add(name); + } + } + sAppJarsArray = sFilteredAppJarsArray.toArray(new String[0]); + } + } + return sAppJarsArray; + } + + private static boolean isEarPresent(String[] archives) { + + boolean bFoundEar = false; + + for (int ii = 0; ii < archives.length; ii++) { + if (archives[ii].endsWith(".ear")) { + bFoundEar = true; + break; + } + } + return bFoundEar; + } + + private static boolean isInteropDir(String sDir) { + return (sDir.indexOf("interop") != -1); + } + + public static class VIBuiltArchiveFilter extends ArchiveFilter { + private static VIBuiltArchiveFilter instance = new VIBuiltArchiveFilter(); + + private VIBuiltArchiveFilter() { + } + + public static VIBuiltArchiveFilter getInstance() { + return instance; + } + + public boolean accept(File dir, String name) { + return (name.endsWith(".ear") || name.endsWith(".war") + || name.endsWith(".rar") || name.endsWith(".jar")) + && name.startsWith("vi_built_") && deployThisVehicleApp(dir, name); + } + } + + public static class NonVIBuiltArchiveFilter extends ArchiveFilter { + private static NonVIBuiltArchiveFilter instance = new NonVIBuiltArchiveFilter(); + + private NonVIBuiltArchiveFilter() { + } + + public static NonVIBuiltArchiveFilter getInstance() { + return instance; + } + + public boolean accept(File dir, String name) { + return (name.endsWith(".ear") || name.endsWith(".war") + || name.endsWith(".rar") || name.endsWith(".jar")) + && !name.startsWith("vi_built_") && deployThisVehicleApp(dir, name); + } + } + + public static class ArchiveFilter implements FilenameFilter { + private static ArchiveFilter instance = new ArchiveFilter(); + + private ArchiveFilter() { + } + + public static ArchiveFilter getInstance() { + return instance; + } + + public boolean accept(File dir, String name) { + return (name.endsWith(".ear") || name.endsWith(".war") + || name.endsWith(".rar") || name.endsWith(".jar")) + && deployThisVehicleApp(dir, name) && appIsNotExcluded(dir, name); + } + + /* + * This method is used to exclude certain apps containg rars from being + * deployed given that we deploy them ahead of time as part of the TCK + * configuration. + */ + protected boolean appIsNotExcluded(File file, String sName) { + boolean bVal = true; + + // Return true if we don't have one of these specific apps that + // we don't want deployed + if (sName.indexOf("ejb_Tsr.ear") != -1 + || sName.indexOf("ejb_Deployment.ear") != -1) { + // never deploy any ejbembed vehicle jars + bVal = false; + } + + return bVal; + + } + + protected boolean deployThisVehicleApp(File file, String sName) { + boolean bVal = false; + // test whether we should deploy this vehicle ear file + if (sName.indexOf("ejbembed") != -1) { + // never deploy any ejbembed vehicle jars + bVal = false; + } else if (sName.indexOf("_vehicle") == -1 + || sName.indexOf("_vehicles") != -1) { + bVal = true; + } else { + // check that this vehicle archive should be deployed + VehicleVerifier vehicleVerifier = VehicleVerifier.getInstance(file); + String[] sVal = vehicleVerifier.getVehicleSet(); + if (sVal != null) { + + // check keywords to see if the user has subsetted... + String keywords = jteMgr.getProperty("current.keywords", "all"); + TestUtil.logHarnessDebug( + "ProfileHelper - current.keywords = " + keywords); + ArrayList filtered = new ArrayList(); + + for (int ii = 0; ii < sVal.length; ii++) { + if ((keywords.indexOf(sVal[ii] + "_vehicle") != -1 + && keywords.indexOf("!" + sVal[ii] + "_vehicle") == -1) + || keywords.indexOf("!" + sVal[ii] + "_vehicle") == -1) { + filtered.add(sVal[ii]); + + } + } + + // if keywords refer to specific veicle(s), then subset the list of + // valid vehicles + if (!filtered.isEmpty()) { + sVal = filtered.toArray(new String[0]); + } + + for (int ii = 0; ii < sVal.length; ii++) { + if (sName.indexOf(sVal[ii] + "_vehicle") != -1) + bVal = true; + } + } + } + return bVal; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/RebuildableVerifier.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/RebuildableVerifier.java new file mode 100644 index 0000000..c6c4727 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/RebuildableVerifier.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.util.*; +import java.util.*; +import java.io.*; + +/** + * This class is used by the TS harness to figure out which test directories + * contain tests which must be rebuilt using a vendor's tools and then run + * against the Reference Implementation. + * + * A singleton class not intended for concurrent access. + * + */ +public class RebuildableVerifier { + public final static String REBUILDABLE_PROP_FILE_NAME = "rebuildable.properties"; + + public final static String EXCLUDE_KEY = "exclude.dir"; + + private static Properties mapping; + + private static String[] keys; // sorted ascending + + private static String[] excludes; + + private String relativeTestDir; + + private static boolean loaded; + + // an uninitialized singleton instance + private static RebuildableVerifier instance = new RebuildableVerifier(); + + private RebuildableVerifier() { + } + + public static RebuildableVerifier getInstance(File path) { + if (instance == null) { + instance = new RebuildableVerifier(); + } + instance.init(path); + return instance; + } + + private void loadExcludes() { + if (this.mapping == null) { + excludes = TestUtil.EMPTY_STRING_ARRAY; + } else { + excludes = ConfigUtil.stringToArray((String) mapping.remove(EXCLUDE_KEY)); + } + } + + private void init(File file) { + if (!loaded) { + mapping = ConfigUtil.loadPropertiesFor(REBUILDABLE_PROP_FILE_NAME); + loadExcludes(); + keys = ConfigUtil.loadKeysFrom(mapping); + loaded = true; + } + if (mapping != null) { + this.relativeTestDir = TestUtil.getRelativePath(file.getPath()); + } + + } + + private boolean isExcluded() { + for (int i = 0; i < excludes.length; i++) { + if (relativeTestDir.startsWith(excludes[i])) { + TestUtil.logHarnessDebug( + "RebuildableVerifier: This test dir is excluded from those listed in rebuildable.properties."); + TestUtil.logHarnessDebug( + "RebuildableVerifier: Please check your exclude list in the rebuildable.properties file."); + return true; + } + } + return false; + } + + /** + * This method tells us if a given directory path is rebuildable of not + * + * @return true if the directory path contains rebuildable tests run in + */ + public boolean isRebuildable() { + boolean result = false; + + if (mapping == null || keys == null || isExcluded()) { + result = false; + } else { + for (int i = keys.length - 1; i >= 0; i--) { // must traverse in reverse + // order. + if (("rebuildable." + relativeTestDir).startsWith(keys[i])) { + result = true; + break; + } + } + } + return result; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/RemoteStatus.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/RemoteStatus.java new file mode 100644 index 0000000..117a8f5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/RemoteStatus.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.*; +import com.sun.javatest.Status; + +public class RemoteStatus implements Serializable { + int type; + + String reason; + + public RemoteStatus(Status s) { + type = s.getType(); + reason = s.getReason(); + } + + public Status toStatus() { + return new Status(type, reason); + } + + public int getType() { + return type; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/ServiceEETest.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/ServiceEETest.java new file mode 100644 index 0000000..1256dff --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/ServiceEETest.java @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.*; +import java.rmi.Remote; +import java.rmi.RemoteException; +import com.sun.ts.lib.util.*; +import java.util.*; +import com.sun.javatest.Status; +import com.sun.ts.tests.common.vehicle.*; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.*; +import com.sun.ts.lib.deliverable.*; +import java.net.*; + +/** + * This abstract class must be extended by all clients of tests of J2EE service + * apis; for example, JDBC, RMI-IIOP, JavaMail, JMS, etc. When a service test is + * encountered by the JavaTest Client, the instance is passed to a J2EE server + * component and run from that remote location. Using this model to develop + * tests allows the same test to be run from different locations within the + * scope of the J2EE Application Programming Model. + * + * @author Kyle Grucci + */ +public abstract class ServiceEETest extends EETest { + + /* + * Please do NOT change this class in an incompatible manner with respect to + * serialization. Please see the serialization specification to determine what + * is a compatible change versus incompatible. If you do need to change this + * class in an incompatible manner you will need to rebuild the compat tests. + * You should also increment the serialVersionUID field to denote that this + * class is incompatible with older versions. + */ + // static final long serialVersionUID = -1396452037848185296L; + + String[] sVehicles; + + private Object theSharedObject; + + private Object theSharedObjectArray[]; + + /** + * Returns any additional properties that may need to be set by a subclass of + * ServiceEETest for use by a specific vehicle. This method was created due to + * a need for clients of the JBIVehicle to set the name of the object to + * lookup in the rmiregistry. By rule, this value should match the id name for + * the component specified in the JBI installation descriptor. This impl + * returns an empty properties object by default. + * + * @param p + * user configured properties used by the test + * @return Properties Additional properties that may need to be set by a + * subclass of ServiceEETest for use by a specific vehicle. + */ + public Properties getVehicleSpecificClientProps(Properties p) { + return new Properties(); + } + + /** + * When called within the harness VM, this method passes an instance of itself + * to the appropriate J2EE server component. When called from within that + * server component, EETest's run method is called and the test is run. + * + * @param argv + * an array of arguments that a test may use + * @param p + * user configured properties used by this test + * @return a Javatest Status object (passed or failed) + */ + public Status run(String[] argv, Properties p) { + Status status = null; + if (TestUtil.iWhereAreWe == TestUtil.VM_HARNESS + && this instanceof com.sun.ts.tests.common.vehicle.VehicleClient) { + TestUtil.logTrace("in ServiceEETest.run() method"); + String sVehicle = p.getProperty("vehicle"); + String className = this.getClass().getName(); + // use this name for the context root or jndi name to eliminate + // naming conflicts for apps deployed at the same time + String sVehicleEarName = p.getProperty("vehicle_ear_name"); + TestUtil.logTrace("Vehicle to be used for this test is: " + sVehicle); + // call to the Deliverable to run in deliverable specific vehicles + // This should never be called on the server, so there is + // no need to pass in the deliverable.class system property + try { + VehicleRunnable runner = VehicleRunnerFactory + .getVehicleRunner(sVehicle); + p.putAll((Map) getVehicleSpecificClientProps(p)); + status = runner.run(argv, p); + } catch (Throwable e) { + e.printStackTrace(); + return Status.failed("Vehicle runner failed."); + } + + return status; + } else { + // we're on the server in a custom vehicle, so just call on EETest + TestUtil.logTrace("in custom vehicle so call on EETest."); + return super.run(argv, p); + } + } + + protected Properties getTestPropsFromArgs(String[] argv) { + Properties p = new Properties(); + Properties ap = new Properties(); + String sProp = null; + String sVal = null; + boolean bRunIndividualTest = false; + vLeftOverTestArgs = new Vector(); + + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("ServiceEETest: " + argv.length + " args: " + + Arrays.asList(argv).toString()); + // load a props object if used with -p + boolean tFound = false; + String argItem = null; + for (int ii = 0; ii < argv.length; ii++) { + argItem = argv[ii]; + if (argItem.equals("-p") || argItem.equals("-ap")) { + ap = initializeProperties(argv[++ii]); + // add additional props to "p" + Enumeration e = ap.propertyNames(); + String key = null; + while (e.hasMoreElements()) { + key = (String) e.nextElement(); + p.put(key, (String) ap.getProperty(key)); + } + } else if (argItem.startsWith("-d") && argItem.indexOf('=') != -1) { + int equalSign = argItem.indexOf('='); + sProp = argItem.substring(2, equalSign); + sVal = argItem.substring(equalSign + 1); + p.put(sProp, sVal); + } + // the first -t specifies test name and should be consumed by harness. + // Any subsequent -t is to be passed along to test. + else if (argItem.equalsIgnoreCase("-t") && !tFound) { + sTestCase = argv[++ii]; + tFound = true; + bRunIndividualTest = true; + } else if (argItem.equalsIgnoreCase("-vehicle")) { + sVehicles = new String[1]; + sVehicles[0] = argv[++ii]; + } else { + // there must be args that the test needs, + // so pass these on + vLeftOverTestArgs.addElement(argItem); + } + } + if (bRunIndividualTest) + p.setProperty("testName", sTestCase); + return p; + } + + public Status run(String[] argv, PrintWriter log, PrintWriter err) { + Status s = Status.passed("OK"); + Properties props; + props = getTestPropsFromArgs(argv); + // get the # of secs we should delay to allow reporting to finish + try { + iLogDelaySeconds = Integer + .parseInt(props.getProperty("harness.log.delayseconds", "1")) * 1000; + } catch (NumberFormatException e) { + // set the default if a number was not set + iLogDelaySeconds = 1000; + } + if (sVehicles == null) { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("ServiceEETest.run(): vehicles = null"); + sVehicles = getVehicles(props); + } + if (props.isEmpty()) + return Status.failed( + "FAILED: An error occurred while trying to load the test properties"); + // copy leftover args to an array and pass them on + int iSize = vLeftOverTestArgs.size(); + if (iSize == 0) { + argv = null; + } else { + argv = new String[iSize]; + for (int ii = 0; ii < iSize; ii++) { + argv[ii] = (String) vLeftOverTestArgs.elementAt(ii); + } + } + if (sTestCase == null) + return runAllTestCases(argv, props, log, err); + else { + for (int ii = 0; ii < sVehicles.length; ii++) { + props.put("vehicle", sVehicles[ii]); + // need to pass these streams to the Local Reporter + TestUtil.setCurrentTest(sTestCase, new PrintWriter(log, true), + new PrintWriter(err, true)); + TestUtil.initClient(props); + s = getPropsReady(argv, props); + try { + Thread.sleep(iLogDelaySeconds); + TestUtil.logTrace("SLEPT FOR: " + iLogDelaySeconds); + } catch (InterruptedException e) { + logErr("Exception: " + e); + } + } + } + return s; + } + + // overridden to allow service tests to run in standalone + // mode outside of javatest + protected Status runAllTestCases(String[] argv, Properties p, PrintStream log, + PrintStream err) { + if (sVehicles == null) { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "ServiceEETest.runAllTestCases(): vehicles = null"); + sVehicles = getVehicles(p); + } + Status s = Status.passed("OK"); + for (int ii = 0; ii < sVehicles.length; ii++) { + p.put("vehicle", sVehicles[ii]); + s = super.runAllTestCases(argv, p, new PrintWriter(log, true), + new PrintWriter(err, true)); + log.println("Completed running tests in " + sVehicles[ii] + " vehicle."); + } + return s; + } + + private String[] getVehicles(Properties p) { + String[] sReturn = null; + String sVal = null; + String sVehiclesToUse = null; + StringTokenizer st = null; + try { + // get vehicles property (DEFAULT to all) + sVal = p.getProperty("service_eetest.vehicles"); + } catch (Exception e) { + // got an exception looking up the prop, so set defaults + sVal = ""; + sVal = "ejb servlet jsp"; + } + if (sVal == null || sVal.equals("")) { + sVehiclesToUse = "ejb servlet jsp"; + if (TestUtil.harnessDebug) + TestUtil + .logHarnessDebug("getVehicles: " + "Using default - all vehicles"); + } else { + sVehiclesToUse = sVal; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "getVehicles: using vehicle(s) - " + sVehiclesToUse); + } + st = new StringTokenizer(sVehiclesToUse); + int iCount = st.countTokens(); + sReturn = new String[iCount]; + for (int ii = 0; ii < iCount; ii++) { + // create 1 desc for each vehicle to be tested + sReturn[ii] = st.nextToken().trim(); + } + return sReturn; + } + + /* + * Set shared object + */ + public void setSharedObject(Object o) { + theSharedObject = o; + } + + /* + * Get shared object + */ + public Object getSharedObject() { + return theSharedObject; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/SetupMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/SetupMethod.java new file mode 100644 index 0000000..a759f6e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/SetupMethod.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * This Annotation is used by test methods to define a custom test setup method. + */ +package com.sun.ts.lib.harness; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface SetupMethod { + public String name(); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/SuiteSynchronizer.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/SuiteSynchronizer.java new file mode 100644 index 0000000..27f84c4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/SuiteSynchronizer.java @@ -0,0 +1,1343 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Properties; +import java.util.Vector; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; + +import com.sun.ts.lib.deliverable.DeliverableFactory; +import com.sun.ts.lib.deliverable.DeliverableInterface; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.PropertyNotSetException; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.ts.lib.porting.TSDeployment; +import com.sun.ts.lib.porting.TSDeploymentException; +import com.sun.ts.lib.porting.TSDeploymentInterface; +import com.sun.ts.lib.porting.TSJMSAdmin; +import com.sun.ts.lib.porting.TSJMSAdminException; +import com.sun.ts.lib.porting.TSJMSAdminInterface; +import com.sun.ts.lib.util.TestUtil; + +public class SuiteSynchronizer { + PrintWriter logOut; + + private static String sClientClassesPath = ""; + + private static String sCommonClientClassesPath = ""; + + private static String sLastTestDirectory = "none run yet"; + + private static String sInteropDirectionWhenTablesWerePopulated = "forward"; + + private static Hashtable htTSDeployers = new Hashtable(); + + private static Hashtable htTSJMSAdmins = new Hashtable(); + + private static Hashtable htJNDIMapsFromServer1 = new Hashtable(); + + private static Hashtable htJNDIMapsFromServer2 = new Hashtable(); + + private static TSRuntimeConfiguration runtimeConfig; + + String testDir = ""; + + Properties pDeployProps; + + private boolean bSweepRebuildableReverseRuntimeFiles; + + private static SuiteSynchronizer ss; + + private PropertyManagerInterface jteMgr; + + private static Vector vCommonAppsDeployedThisJVM = new Vector(); + + private static String sDeployStatus = "passed"; + + private static String sDeployStackTrace = ""; + + private static String[] sTopicFactories1; + + private static String[] sQueueFactories1; + + private static String[] sTopicFactories2; + + private static String[] sQueueFactories2; + + private static boolean bCreateConnectionFactories1 = true; + + private static boolean bCreateConnectionFactories2 = true; + + private static boolean bReversed; + + private int executionMode; + + private static Vector vCommonDeploymentInfos = new Vector(); + + private static Vector vCurrentDeploymentInfos = new Vector(); + + private static boolean bDeployingCommonApps; + + // deliverable specific settings + // All info here is retrieved from the active deliverable + private static DeliverableInterface deliv; + + private static boolean bSupportsAutoDeploy = true; + + private static boolean bSupportsAutoJMS = true; + + private static boolean bSupportsInterop = true; + + public static final SuiteSynchronizer createSuiteSynchronizer( + PrintWriter writer) { + ss = new SuiteSynchronizer(writer); + return ss; + } + + public static final SuiteSynchronizer getSuiteSynchronizer( + PrintWriter writer) { + if (ss == null) + ss = new SuiteSynchronizer(writer); + return ss; + } + + public SuiteSynchronizer(PrintWriter w) { + setOutputWriter(w); + try { + deliv = DeliverableFactory.getDeliverableInstance(); + bSupportsAutoDeploy = deliv.supportsAutoDeployment(); + bSupportsAutoJMS = deliv.supportsAutoJMSAdmin(); + bSupportsInterop = deliv.supportsInterop(); + jteMgr = deliv.getPropertyManager(); + } catch (Exception e) { + e.printStackTrace(); + } + executionMode = ExecutionMode.getExecutionMode(jteMgr); + init(); + } + + private void init() { + if (bSupportsAutoDeploy) { + try { + // get porting class 1 impls for deployment and JMSAdmin + if ((htTSDeployers.get("cts1") == null)) { + htTSDeployers.put("cts1", TSDeployment.getDeploymentInstance(logOut, + "porting.ts.deploy.class.1")); + } + if (bSupportsAutoJMS && (htTSJMSAdmins.get("cts1") == null)) { + htTSJMSAdmins.put("cts1", TSJMSAdmin.getTSJMSAdminInstance(logOut, + "porting.ts.jms.class.1")); + } + if (bSupportsInterop) { + // get porting class 2 impls for deployment and JMSAdmin + if (htTSDeployers.get("cts2") == null) { + htTSDeployers.put("cts2", TSDeployment.getDeploymentInstance(logOut, + "porting.ts.deploy.class.2")); + } + if (bSupportsAutoJMS && (htTSJMSAdmins.get("cts2") == null)) { + htTSJMSAdmins.put("cts2", TSJMSAdmin.getTSJMSAdminInstance(logOut, + "porting.ts.jms.class.2")); + } + } + } catch (Exception e) { + e.printStackTrace(); + TestUtil.logHarness( + "Creation of TSDeployment or TSJMSAdmin implementation instances failed. Please check the values of 'porting.ts.deploy.class.1', 'porting.ts.deploy.class.2', 'porting.ts.jms.class.1' and 'porting.ts.jms.class.2'"); + } + try { + runtimeConfig = new TSRuntimeConfiguration(logOut); + TestUtil.logHarness("ss: modified runtime.xml"); + } catch (Exception e) { + e.printStackTrace(); + TestUtil.logHarness( + "Failed to modify xml files with correct settings. Please check the values of 'mailHost, mailFrom, webServerHost, and webServerPort'"); + } + } + } + + public void setOutputWriter(PrintWriter w) { + logOut = w; + } + + public TSDeploymentInterface getTSDeployer(String sDeployerToGet) + throws TSDeploymentException { + return (TSDeploymentInterface) htTSDeployers.get(sDeployerToGet); + } + + public String getDeploymentStatus() { + return sDeployStatus; + } + + public String getDeploymentExceptionTrace() { + return sDeployStackTrace; + } + + public String getClientClassPath() { + return sCommonClientClassesPath + sClientClassesPath; + } + + public void doCommonUnDeployment() throws TSDeploymentException { + String sVal = null; + pDeployProps = new Properties(); + // reset the array of DeploymentInfos from the last test run + vCommonDeploymentInfos.clear(); + if (!vCommonAppsDeployedThisJVM.isEmpty()) { + for (int ii = 0; ii < vCommonAppsDeployedThisJVM.size(); ii++) { + TestUtil.logHarness("*******************************"); + TestUtil.logHarness( + "Beginning one-time Undeployment of any TS common applications..."); + TestUtil.logHarness("*******************************"); + // undeploy apps here + testDir = (String) vCommonAppsDeployedThisJVM.elementAt(ii); + try { + undeployApps(testDir); + TestUtil.logHarness("Undeployed common apps in: " + testDir); + } catch (TSDeploymentException de) { + TestUtil.logHarness("*******************************"); + TestUtil.logHarness( + "Failed to complete TS common application deployment."); + TestUtil.logHarness("*******************************"); + throw de; + } catch (Exception e) { + TestUtil.logHarness("*******************************"); + TestUtil.logHarness( + "Failed to complete TS common application deployment."); + TestUtil.logHarness("*******************************"); + throw new TSDeploymentException( + "Exception: Failed to Undeploy common apps in " + testDir, e); + } + } + vCommonAppsDeployedThisJVM.clear(); + sCommonClientClassesPath = ""; + TestUtil.logHarness("*******************************"); + TestUtil.logHarness( + "Successfully completed TS common application Undeployment."); + TestUtil.logHarness("*******************************"); + } + } + + public void doDeployment(String testDirectory, Properties props) + throws TSDeploymentException, TSJMSAdminException { + pDeployProps = props; + String sCommonTestDir = ""; + testDir = TestUtil.srcToDist(testDirectory); + // testDir = + // TestUtil.srcToDist(TSTestFinder.getAbsolutePath(td.getParameter("test_directory"))); + // just return if we're in the same test directory + if (sLastTestDirectory.equals(testDir)) { + sDeployStatus = "passed"; + return; + } + // reset current test directory's info object to only include previously + // deployed common apps + vCurrentDeploymentInfos.clear(); + vCurrentDeploymentInfos.addAll(vCommonDeploymentInfos); + String sDeployCommon = jteMgr.getProperty("deploy_undeploy_common_apps", + "true"); + if (TestUtil.harnessDebug) + TestUtil + .logHarnessDebug("deploy_undeploy_common_apps = " + sDeployCommon); + if (sDeployCommon.equalsIgnoreCase("true")) { + // check to see if any common apps are required by this test + String[] sCommonApps = CommonAppVerifier.getInstance(new File(testDir)) + .getCommonApps(); + // set the state so we can tell later if we are deploying common apps + bDeployingCommonApps = true; + // if there are, then see if any are already deployed + for (int ii = 0; sCommonApps != null && ii < sCommonApps.length; ii++) { + sCommonTestDir = sCommonApps[ii]; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("sCommonTestDir = " + sCommonTestDir); + // if this app has not been deployed yet in this JVM, and it is + // already deployed, undeploy it and redeploy it + if (!vCommonAppsDeployedThisJVM.contains(sCommonTestDir)) { + try { + undeployApps(sCommonTestDir); + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Undeployed common apps from - " + sCommonTestDir); + } catch (TSDeploymentException de) { + sDeployStatus = "failed"; + logOut + .println("Failed to undeploy common apps in " + sCommonTestDir); + throw de; + } catch (Exception e) { + sDeployStatus = "failed"; + logOut.println( + "Unexpected Exception: Failed to undeploy common apps in " + + sCommonTestDir); + throw new TSDeploymentException( + "Exception: Failed to undeploy common apps in " + + sCommonTestDir, + e); + } + // Hack to add sql Tag to TxECMPbean by adding it to the + // pDeployProps here if the bean to be deployed is TxECMPBean. + if (sCommonTestDir.indexOf("txECMPbean") != -1 + || sCommonTestDir.indexOf("txEPMbean") != -1 || sCommonTestDir + .indexOf("ejbql" + File.separator + "schema") != -1) { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Found the TxECMPbean, TxEPMbean, or ejbql/schema common bean. We must generate SQL "); + pDeployProps.put("generateSQL", "true"); + } + try { + sCommonClientClassesPath += deployApps(sCommonTestDir) + + File.pathSeparator; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Deployed common apps from - " + sCommonTestDir); + // save off which common apps we actually deployed during this JVM + vCommonAppsDeployedThisJVM.addElement(sCommonTestDir); + } catch (TSDeploymentException de) { + sDeployStatus = "failed"; + TestUtil.logHarness("Deployment of common app(s) from: " + + sCommonTestDir + " failed!"); + de.printStackTrace(); + sDeployStackTrace = TestUtil.printStackTraceToString(de); + throw de; + } catch (TSJMSAdminException je) { + sDeployStatus = "failed"; + TestUtil.logHarness("JMS Admin topic/queue creation from: " + + sCommonTestDir + " failed!"); + je.printStackTrace(); + sDeployStackTrace = TestUtil.printStackTraceToString(je); + throw je; + } + } else { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Common apps from this dir are already deployed during this JVM- " + + sCommonTestDir); + } + } + } else { + if (TestUtil.harnessDebug) + TestUtil + .logHarnessDebug("Skipping common app deployment " + sDeployCommon); + } + // Now take care of the apps in the current test dir + if (!Boolean.getBoolean("common.apps.only") + && !sLastTestDirectory.equals(testDir)) { + // set the state so we can tell later if we are deploying common apps + bDeployingCommonApps = false; + try { + if (!sLastTestDirectory.equals("none run yet")) { + // undeploy the last one + undeployApps(sLastTestDirectory); + logOut.println("Undeployed apps from - " + sLastTestDirectory); + } + } catch (TSDeploymentException de) { + sDeployStatus = "failed"; + logOut.println("Undeployment of previous apps failed."); + sDeployStackTrace = TestUtil.printStackTraceToString(de); + throw de; + } catch (Exception e) { + sDeployStatus = "failed"; + logOut.println("Exception: undeployment of previous apps failed."); + sDeployStackTrace = TestUtil.printStackTraceToString(e); + throw new TSDeploymentException( + "Exception: Undeployment of previous apps failed", e); + } + try { + // try to undeploy the current one, just in case + if (!sLastTestDirectory.equals(testDir)) { + undeployApps(testDir); + logOut.println("Undeployed apps from - " + testDir); + } + } catch (TSDeploymentException de) { + sDeployStatus = "failed"; + logOut.println("Undeployment of current apps in " + testDir + "failed"); + sDeployStackTrace = TestUtil.printStackTraceToString(de); + throw de; + } catch (Exception e) { + sDeployStatus = "failed"; + logOut.println("Exception: Undeployment of current apps in " + testDir + + "failed"); + sDeployStackTrace = TestUtil.printStackTraceToString(e); + throw new TSDeploymentException( + "Exception: Undeployment of current apps in " + testDir + "failed", + e); + } + try { + sClientClassesPath = deployApps(testDir) + File.pathSeparator; + logOut.println("Deployed apps from - " + testDir); + sLastTestDirectory = testDir; + } catch (TSDeploymentException de) { + sDeployStatus = "failed"; + TestUtil + .logHarness("Deployment of app(s) from: " + testDir + " failed!"); + sDeployStackTrace = TestUtil.printStackTraceToString(de); + throw de; + } catch (Throwable e) { + sDeployStatus = "failed"; + TestUtil.logHarness( + "Exception: Deployment of app(s) from: " + testDir + " failed!"); + e.printStackTrace(logOut); + sDeployStackTrace = TestUtil.printStackTraceToString(e); + throw new TSDeploymentException( + "Deployment of app(s) from: " + testDir + " failed!", e); + } + } + sDeployStatus = "passed"; + } + + public void removeJmsConnectionFactories() throws TSJMSAdminException { + // remove JMS connectionFactories + try { + if (bSupportsAutoJMS) { + TSJMSAdminInterface ctsJMS1 = (TSJMSAdminInterface) htTSJMSAdmins + .get("cts1"); + TSJMSAdminInterface ctsJMS2 = (TSJMSAdminInterface) htTSJMSAdmins + .get("cts2"); + if (sTopicFactories1 != null) { + ctsJMS1.removeJmsConnectionFactories(sTopicFactories1); + sTopicFactories1 = null; + } + if (sQueueFactories1 != null) { + ctsJMS1.removeJmsConnectionFactories(sQueueFactories1); + sQueueFactories1 = null; + } + bCreateConnectionFactories1 = true; + logOut.println( + "Successfully removed JMS connection factories from server 1."); + if (sTopicFactories2 != null) { + ctsJMS2.removeJmsConnectionFactories(sTopicFactories2); + sTopicFactories2 = null; + } + if (sQueueFactories2 != null) { + ctsJMS2.removeJmsConnectionFactories(sQueueFactories2); + sQueueFactories2 = null; + } + bCreateConnectionFactories2 = true; + logOut.println( + "Successfully removed JMS connection factories from server 2."); + } + } catch (Exception e) { + logOut.println("Exception: removal of JMS connection factories failed."); + e.printStackTrace(); + throw new TSJMSAdminException( + "Exception: removal of JMS connection factories failed.", e); + } + } + + public void undeployLastApp() + throws TSDeploymentException, TSJMSAdminException { + try { + if (!sLastTestDirectory.equals("none run yet")) { + // undeploy the last app in the test run + undeployApps(sLastTestDirectory); + logOut.println("Undeployed apps from - " + sLastTestDirectory); + // reset this string in case we're running the GUI and we rerun the same + // tests + sLastTestDirectory = "none run yet"; + } + } catch (TSDeploymentException de) { + logOut.println("Undeployment of last apps failed."); + throw de; + } catch (Exception e) { + logOut.println("Exception: undeployment of last apps failed."); + throw new TSDeploymentException( + "Exception: Undeployment of last apps failed", e); + } + } + + private boolean isInteropDir(String sDir) { + return (sDir.indexOf("interop") != -1); + } + + /** + * Uses different approaches to search for runtime files for j2sdkee RI and + * for s1as. For j2sdkee RI, iterates through *.runtime.xml, and for each + * runtime.xml file, checks if it matches a jar entry. For s1as, search for a + * list of required runtime files for the current deployable component, and + * tries to find it in the collection of all runtime files in the current dist + * dir. If not found, tries to get the generic forms from + * $TS_HOME/src/com/sun/ts/tests/common/sunxml. Available generic forms of + * s1as runtime files: sun-application.xml sun-web.xml + * sun-application-client.xml + * + * @param sAppEar + * full path of a deployable component, e.g., ear, standalone war/jar + * @param sRuntimeInfoArray + * a collection of runtime files, equals or greater than the valid + * runtime files + * @param sDir + * dist dir for the current leaf dir + * @param oppositeServerJNDITable + * @param bSweep + * @return String[] array of file names of valid runtime files + * @throws TSDeploymentException + * TODO: use File/File[] to represent a file or files, instead of + * strings. With strings we don't know if they are file name or full + * path. TODO: use collection instead of arrays. TODO: remove + * sRuntimeInfoArray from param list. Since we already have sDir + * (dist dir) in param list, we can include runtime files as needed, + * instead of calling File.list() before every invocation of + * getValidRuntimeInfoFiles. + */ + private String[] getValidRuntimeInfoFiles(String sAppEar, + String[] sRuntimeInfoArray, String sDir, + Hashtable oppositeServerJNDITable, boolean bSweep) + throws TSDeploymentException { + + String[] sValidRuntimeInfo = null; + sValidRuntimeInfo = getS1ASRuntimeInfoFiles(sAppEar, sRuntimeInfoArray, + sDir); + + // sweep runtime info for both cases: using merged one single runtime, or + // multiple + // runtime per deployable component. + TestUtil.logHarnessDebug("Valid runtime files before sweep:"); + for (int k = 0; k < sValidRuntimeInfo.length; k++) { + TestUtil.logHarnessDebug(sValidRuntimeInfo[k]); + } + int i = 0; + try { + for (; i < sValidRuntimeInfo.length; i++) { + if (bSweep) { + runtimeConfig.setTable(oppositeServerJNDITable); + String sTemp = runtimeConfig + .sweepRuntimeFile(new File(sValidRuntimeInfo[i])); + if (sTemp != null) { + sValidRuntimeInfo[i] = sTemp; + } + } + } + } catch (Exception e) { + TestUtil.logHarnessDebug( + "Error while sweeping valid runtime file: " + sValidRuntimeInfo[i]); + throw new TSDeploymentException( + "Error while sweeping valid runtime files!", e); + } + TestUtil.logHarness("Valid runtime files after sweep:"); + for (int k = 0; k < sValidRuntimeInfo.length; k++) { + TestUtil.logHarness(sValidRuntimeInfo[k]); + } + + return sValidRuntimeInfo; + } + + /** + * Gets the basename from a path. For example, c:\foo\foo.ear would return + * foo.ear, c:\foo\foo.bar.ear would return foo.ear, foo.ear returns foo.ear. + * We could have used File.getName if we have a file instead of a string path. + * + * @param fullPath + * @return String + */ + private String getBaseName(String path) { + int slash = path.lastIndexOf(File.separator); + // int dot = path.indexOf(".", slash); + return path.substring(slash + 1); + } + + /** + * gets the valid s1as runtime files from the list of all available runtime + * files in the current test dir. If it uses generic forms of runtime files, + * like sun-application.xml, sun-web.xml, they will NOT appear in the result. + * + * @param sAppEar + * full path of a deployable component, e.g., ear, standalone war/jar + * @param sRuntimeInfoArray + * a collection of runtime files, equals or greater than the valid + * runtime files + * @param sDir + * dist dir for the current leaf dir + * @return String[] a collection of valid s1as runtime files that are really + * needed + */ + private String[] getS1ASRuntimeInfoFiles(String sAppEar, + String[] sRuntimeInfoArray, String sDir) { + List al = new ArrayList(7); + String[] validRuntimeFiles = null; + String baseName = getBaseName(sAppEar); + + TestUtil + .logHarness("Search for s1as runtime files match:`" + baseName + "`"); + + try { + if (sAppEar.endsWith(".ear")) { // need sun-application.xml + boolean isVIBuiltEar = sAppEar.contains("vi_built"); + addIfPresent(baseName, al, sRuntimeInfoArray, isVIBuiltEar); + + JarFile earFile = null; + try { + earFile = new JarFile(sAppEar); + for (Enumeration enum1 = earFile.entries(); enum1 + .hasMoreElements();) { + ZipEntry infile = (ZipEntry) enum1.nextElement(); + if (!infile.isDirectory()) { + String name = infile.getName(); + if (name.endsWith(".war") || name.endsWith("_ejb.jar") + || name.endsWith("_client.jar")) { + addIfPresent(name, al, sRuntimeInfoArray, isVIBuiltEar); + } + } + } // for + } catch (IOException ioe) { + TestUtil.logHarness( + "Exception in checking entries in ear file, use all available s1as runtime files."); + ioe.printStackTrace(); + } finally { + if (earFile != null) + earFile.close(); + } + } else if (sAppEar.endsWith(".jar") || sAppEar.endsWith(".war")) { + addIfPresent(baseName, al, sRuntimeInfoArray, false); + } else { + TestUtil + .logHarness("Unrecognized standalone component:`" + sAppEar + "`"); + } + } catch (IOException ex) { + TestUtil.logHarness( + "Exception in checking entries in ear file, use all available s1as runtime files."); + ex.printStackTrace(); + al = Arrays.asList(sRuntimeInfoArray); + } + validRuntimeFiles = new String[al.size()]; + for (int i = 0; i < validRuntimeFiles.length; i++) { + validRuntimeFiles[i] = sDir + File.separator + (String) al.get(i); + } + + return validRuntimeFiles; + } + + /** + * adds fileName to list if the runtimeFileNames[i] stats with moduleName + * + * @param string + * moduleName + * @param al + * @param runtimeFileNames + */ + private void addIfPresent(String moduleName, List al, + String[] runtimeFileNames, boolean isVIBuiltEar) { + for (int i = 0; i < runtimeFileNames.length; i++) { + if (runtimeFileNames[i].startsWith(moduleName) || (isVIBuiltEar + && runtimeFileNames[i].startsWith("vi_built_" + moduleName))) { + al.add(runtimeFileNames[i]); + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("valid runtime file for:" + moduleName + ": " + + runtimeFileNames[i]); + } + } + } + } + + // not sure if we should use this + public void cleanupTempDirectory() { + try { + jteMgr = deliv.getPropertyManager(); + } catch (Exception e) { + e.printStackTrace(); + } + String sHarnessTempDir = ""; + try { + sHarnessTempDir = jteMgr.getProperty("harness.temp.directory"); + } catch (PropertyNotSetException pe) { + TestUtil.logHarness(pe.getMessage()); + TestUtil.logHarness("error looking up property: harness.temp.directory"); + pe.printStackTrace(); + } + File fTestDir = new File(sHarnessTempDir); + File[] fAppJarsArray = fTestDir + .listFiles(ProfileHelper.ArchiveFilter.getInstance()); + // remove temporary ri .ear files + for (int ii = 0; ii < fAppJarsArray.length; ii++) { + fAppJarsArray[ii].delete(); + } + } + + private String deployApps(String sDir) + throws TSDeploymentException, TSJMSAdminException { + String sClientClassPaths = ""; + if (executionMode == ExecutionMode.DEPLOY_RUN_UNDEPLOY + || executionMode == ExecutionMode.DEPLOY + || executionMode == ExecutionMode.DEPLOY_RUN) { + String sInteropDirections = sInteropDirectionWhenTablesWerePopulated; + File fTestDir = new File(sDir); + + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "deployApps - InteropDirections: " + sInteropDirections); + + String[] sAppJarsArray = ProfileHelper.getArchives(sDir, + sInteropDirections); + String[] sAppJarsForward = ProfileHelper.getArchives(sDir, "forward"); + String[] sAppJarsReverse = ProfileHelper.getArchives(sDir, "reverse"); + + if (sInteropDirections.equals("forward") + || sInteropDirections.equals("both")) { + swapSettings("forward"); + + if (isInteropDir(sDir)) { + // comment the interop check so that replacement will occur + // for non-interop also. This is done in the case that we have + // web service tests which need to find out WSDL location + // if (isInteropDir(sDir)) + populatePortingReplacementTables(sDir, sAppJarsArray); + TestUtil.logHarness("Deploying apps..."); + sClientClassPaths += continueToDeployApps(sDir, sAppJarsArray); + } else { + // This is only for the case that we are a rebuildable test and the + // direction + // is forward or both. In this case, we must swap settings prior to + // runtime file substitution which happens in + // populatePortingReplacementTables + // and then swap back to forward before we actually deploy + populatePortingReplacementTables(sDir, sAppJarsForward); + TestUtil.logHarness("Deploying apps for forward rebuildable..."); + sClientClassPaths += continueToDeployApps(sDir, sAppJarsForward); + if (sInteropDirections.equals("both")) { + populatePortingReplacementTables(sDir, sAppJarsReverse); + TestUtil.logHarness("Deploying apps for reverse rebuildable..."); + bSweepRebuildableReverseRuntimeFiles = true; + sClientClassPaths += continueToDeployApps(sDir, sAppJarsReverse); + bSweepRebuildableReverseRuntimeFiles = false; + } + } + } + + if (sInteropDirections.equals("reverse") + || sInteropDirections.equals("both")) { + if (isInteropDir(sDir)) { + swapSettings("reverse"); + populatePortingReplacementTables(sDir, sAppJarsArray); + TestUtil.logHarness("Deploying apps for reverse run..."); + sClientClassPaths += continueToDeployApps(sDir, sAppJarsArray); + TestUtil.logHarness( + "Swapped settings & deployed apps to opposite servers for directory: " + + sDir); + } else { + // This is only for the case that we are a rebuildable test and the + // direction + // has been overridden to reverse. We don't swap settings and deploy + // in the + // reverse direction for rebuiuldable tests - only true interop tests + if (sInteropDirections.equals("reverse")) { + populatePortingReplacementTables(sDir, sAppJarsReverse); + TestUtil.logHarness("Deploying apps for reverse rebuildable..."); + bSweepRebuildableReverseRuntimeFiles = true; + sClientClassPaths += continueToDeployApps(sDir, sAppJarsReverse); + bSweepRebuildableReverseRuntimeFiles = false; + } + } + } + } else { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Deployment of apps disabled due to execute mode being set to:" + + String.valueOf(executionMode)); + } + return sClientClassPaths; + } + + private DeploymentInfo getDeploymentInfo(String earFile, String sAppJar, + String sFileNameMinusExtension, String[] sValidRuntimeInfoFilesArray) + throws TSDeploymentException { + String sRuntimeInfoFiles = ""; + if (sValidRuntimeInfoFilesArray != null) { + for (int j = 0; j < sValidRuntimeInfoFilesArray.length; j++) { + sRuntimeInfoFiles += sValidRuntimeInfoFilesArray[j] + " "; + } + } + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug(sFileNameMinusExtension + " ear_file = " + + earFile + "\n" + sFileNameMinusExtension + " runtime files = " + + sRuntimeInfoFiles); + try { + DeploymentInfo deploymentInfo = deliv.getDeploymentInfo(earFile, + sValidRuntimeInfoFilesArray); + return deploymentInfo; + } catch (Exception e) { + e.printStackTrace(); + throw new TSDeploymentException( + "Exception reading runtime information from Deliverable instance: " + + e.getMessage()); + } + } + + private void populatePortingReplacementTables(String sDir, + String[] sAppJarsArray) throws TSDeploymentException { + String sFileNameMinusExtension = ""; + String[] sValidRuntimeInfoFilesArray = null; + String earFile = ""; + File fTestDir = new File(sDir); + // String[] sAppJarsArray = fTestDir.list(ArchiveFilter.getInstance()); + String[] sRuntimeInfoFilesArray = fTestDir + .list(RuntimeInfoFilter.getInstance()); + + // if there are no archives to deploy, just warn and return + if (sAppJarsArray == null || sAppJarsArray.length < 1) { + return; + } + + DeploymentInfo[] infoArray = new DeploymentInfo[sAppJarsArray.length]; + for (int ii = 0; ii < sAppJarsArray.length; ii++) { + earFile = sDir + File.separator + sAppJarsArray[ii]; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("earFile = " + earFile); + sFileNameMinusExtension = sAppJarsArray[ii].substring(0, + sAppJarsArray[ii].lastIndexOf(".")); + // sClientClassPaths = ""; + // get only those runtime files which go with this + // .ear file + // also rewrites runtime.xml + sValidRuntimeInfoFilesArray = getValidRuntimeInfoFiles( + sDir + File.separator + sAppJarsArray[ii], sRuntimeInfoFilesArray, + sDir, null, false); + infoArray[ii] = getDeploymentInfo(earFile, sAppJarsArray[ii], + sFileNameMinusExtension, sValidRuntimeInfoFilesArray); + } + TSDeploymentInterface ctsDeploy1 = (TSDeploymentInterface) htTSDeployers + .get("cts1"); + + // if this is not an interop test, don't use cts2 + TSDeploymentInterface ctsDeploy2; + if (isInteropDir(sDir)) + ctsDeploy2 = (TSDeploymentInterface) htTSDeployers.get("cts2"); + else + ctsDeploy2 = ctsDeploy1; + + // never reset these in case we have common apps in a diff dir + // should we tack on "notcommon" to the beginning of each entry that + // is not from a common bean so that we can remove those when we get into + // a different dir? + // Make sure that htJNDIMapsFromServer1 always matches the porting class.1 + // and the same for 2 + if (bReversed) { + // maps from server whose porting package is 1 + htJNDIMapsFromServer1.putAll(ctsDeploy2.getInteropJNDINames(infoArray)); + // maps from server whose porting package is 2 + htJNDIMapsFromServer2.putAll(ctsDeploy1.getInteropJNDINames(infoArray)); + sInteropDirectionWhenTablesWerePopulated = "reverse"; + } else { + // maps from server whose porting package is 1 + htJNDIMapsFromServer1.putAll(ctsDeploy1.getInteropJNDINames(infoArray)); + // maps from server whose porting package is 2 + htJNDIMapsFromServer2.putAll(ctsDeploy2.getInteropJNDINames(infoArray)); + sInteropDirectionWhenTablesWerePopulated = "forward"; + } + + if (TestUtil.harnessDebug) + printAllMappings(); + } + + private void printAllMappings() { + String sKey; + + TestUtil.logHarness("RuntimeInfo mappings from Porting impl 1"); + + // dump all mappings from the hashtables + for (Enumeration e = htJNDIMapsFromServer1.keys(); e.hasMoreElements();) { + sKey = (String) e.nextElement(); + + TestUtil.logHarness("----------------------------------------"); + TestUtil.logHarness("RuntimeInfo key: " + sKey); + TestUtil.logHarness( + "To be replaced with: " + (String) htJNDIMapsFromServer1.get(sKey)); + TestUtil.logHarness("----------------------------------------"); + } + + TestUtil.logHarness("RuntimeInfo mappings from Porting impl 2"); + + for (Enumeration e = htJNDIMapsFromServer2.keys(); e.hasMoreElements();) { + sKey = (String) e.nextElement(); + + TestUtil.logHarness("----------------------------------------"); + TestUtil.logHarness("RuntimeInfo key: " + sKey); + TestUtil.logHarness( + "To be replaced with: " + (String) htJNDIMapsFromServer2.get(sKey)); + TestUtil.logHarness("----------------------------------------"); + } + } + + private String continueToDeployApps(String sDir, String[] sAppJarsArray) + throws TSDeploymentException, TSJMSAdminException { + DeploymentInfo deploymentInfo = null; + String sClientClassPaths = ""; + File fTestDir = new File(sDir); + // String[] sAppJarsArray = fTestDir.list(ArchiveFilter.getInstance()); + String[] sRuntimeInfoFilesArray = fTestDir + .list(RuntimeInfoFilter.getInstance()); + String[] sValidRuntimeInfoFilesArray = null; + String sFileNameMinusExtension = ""; + String sRuntimeFileMinusExtension = ""; + String sRuntimeInfoFiles = ""; // for debug output + TSDeploymentInterface ctsDeploy = null; + TSJMSAdminInterface ctsJMS = null; + String[] sQueues = null; + String[] sTopics = null; + String earFile = ""; + + // if there are no archives to deploy, just warn and return + if (sAppJarsArray == null || sAppJarsArray.length < 1) { + TestUtil.logHarness( + "There are no archives to deploy in this directory: " + sDir); + return ""; + } + Arrays.sort(sAppJarsArray); + // need to figure out the exact build rules for this + for (int ii = 0; ii < sAppJarsArray.length; ii++) { + earFile = sDir + File.separator + sAppJarsArray[ii]; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("earFile = " + earFile); + sFileNameMinusExtension = sAppJarsArray[ii].substring(0, + sAppJarsArray[ii].lastIndexOf(".")); + // sClientClassPaths = ""; + // if (isInteropDir(sDir)) { + Hashtable oppositeServerJNDITable = null; + if (sInteropDirectionWhenTablesWerePopulated.equals("forward")) { + if (sFileNameMinusExtension.indexOf("_j2ee2") != -1 + || sFileNameMinusExtension.startsWith("vi_built_")) + oppositeServerJNDITable = htJNDIMapsFromServer1; + else + oppositeServerJNDITable = htJNDIMapsFromServer2; + } else // reverse + { + if (sFileNameMinusExtension.indexOf("_j2ee2") != -1 + || sFileNameMinusExtension.startsWith("vi_built_")) + oppositeServerJNDITable = htJNDIMapsFromServer2; + else + oppositeServerJNDITable = htJNDIMapsFromServer1; + } + + if (bSweepRebuildableReverseRuntimeFiles) { + swapSettings("reverse"); + } + // get only those runtime files which go with this + // .ear file + sValidRuntimeInfoFilesArray = getValidRuntimeInfoFiles( + sDir + File.separator + sAppJarsArray[ii], sRuntimeInfoFilesArray, + sDir, oppositeServerJNDITable, true); + + if (bSweepRebuildableReverseRuntimeFiles) { + swapSettings("forward"); + } + + /* + * } else { // get only those runtime files which go with this // .ear + * file sValidRuntimeInfoFilesArray = getValidRuntimeInfoFiles(sDir + + * File.separator + sAppJarsArray[ii], sRuntimeInfoFilesArray, sDir, null, + * true); } + */ + deploymentInfo = getDeploymentInfo(earFile, sAppJarsArray[ii], + sFileNameMinusExtension, sValidRuntimeInfoFilesArray); + // save off all common app infos so that they can be passed to new test + // directory deployments + if (bDeployingCommonApps) + vCommonDeploymentInfos.addElement(deploymentInfo); + // always add to the current deploymentinfos + vCurrentDeploymentInfos.addElement(deploymentInfo); + // give the current ear's deployment info access to previosly deployed + // info objects + deploymentInfo.setPreviousInfos((DeploymentInfo[]) vCurrentDeploymentInfos + .toArray(new DeploymentInfo[vCurrentDeploymentInfos.size()])); + // deploy + if (!sClientClassPaths.equals("")) + sClientClassPaths += File.pathSeparator; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("generateSQL is set to: " + + deploymentInfo.getProperty("generateSQL")); + try { + if (sFileNameMinusExtension.indexOf("_j2ee2") != -1 + || sFileNameMinusExtension.startsWith("vi_built_")) { + deploymentInfo.setProperty("deployment_host", + jteMgr.getProperty("deployment_host.2")); + deploymentInfo.setProperty("deployment_port", + jteMgr.getProperty("deployment_port.2")); + deploymentInfo.setProperty("deployment.props.number", "2"); + + ctsDeploy = (TSDeploymentInterface) htTSDeployers.get("cts2"); + if (bSupportsAutoJMS) { + ctsJMS = (TSJMSAdminInterface) htTSJMSAdmins.get("cts2"); + sQueues = TSJMSAdmin.getQueues(sDir, 2); + sTopics = TSJMSAdmin.getTopics(sDir, 2); + // one time creation of connection factories on server 2 + if (bCreateConnectionFactories2 + && TSJMSAdmin.requiresJmsFactories(sDir)) { + Hashtable htTopicFactories = TSJMSAdmin + .getTopicConnectionFactories(2); + int iSize = htTopicFactories.size(); + sTopicFactories2 = new String[iSize]; + String[] sTopicFactoryProps = new String[iSize]; + int jj = 0; + for (Enumeration e = htTopicFactories.keys(); e + .hasMoreElements();) { + String sElement = (String) e.nextElement(); + sTopicFactories2[jj] = sElement; + sTopicFactoryProps[jj] = (String) htTopicFactories + .get(sElement); + jj++; + } + ctsJMS.createTopicConnectionFactories(sTopicFactories2, + sTopicFactoryProps); + Hashtable htQueueFactories = TSJMSAdmin + .getQueueConnectionFactories(2); + iSize = htQueueFactories.size(); + sQueueFactories2 = new String[iSize]; + String[] sQueueFactoryProps = new String[iSize]; + jj = 0; + for (Enumeration e = htQueueFactories.keys(); e + .hasMoreElements();) { + String sElement = (String) e.nextElement(); + sQueueFactories2[jj] = sElement; + sQueueFactoryProps[jj] = (String) htQueueFactories + .get(sElement); + jj++; + } + ctsJMS.createQueueConnectionFactories(sQueueFactories2, + sQueueFactoryProps); + bCreateConnectionFactories2 = false; + } + } + } else { + deploymentInfo.setProperty("deployment_host", + jteMgr.getProperty("deployment_host.1")); + deploymentInfo.setProperty("deployment_port", + jteMgr.getProperty("deployment_port.1")); + deploymentInfo.setProperty("deployment.props.number", "1"); + + ctsDeploy = (TSDeploymentInterface) htTSDeployers.get("cts1"); + if (bSupportsAutoJMS) { + ctsJMS = (TSJMSAdminInterface) htTSJMSAdmins.get("cts1"); + sQueues = TSJMSAdmin.getQueues(sDir, 1); + sTopics = TSJMSAdmin.getTopics(sDir, 1); + // one time creation of connection factories on server 1 + if (bCreateConnectionFactories1 + && TSJMSAdmin.requiresJmsFactories(sDir)) { + Hashtable htTopicFactories = TSJMSAdmin + .getTopicConnectionFactories(1); + int iSize = htTopicFactories.size(); + sTopicFactories1 = new String[iSize]; + String[] sTopicFactoryProps = new String[iSize]; + int jj = 0; + for (Enumeration e = htTopicFactories.keys(); e + .hasMoreElements();) { + String sElement = (String) e.nextElement(); + sTopicFactories1[jj] = sElement; + sTopicFactoryProps[jj] = (String) htTopicFactories + .get(sElement); + jj++; + } + ctsJMS.createTopicConnectionFactories(sTopicFactories1, + sTopicFactoryProps); + Hashtable htQueueFactories = TSJMSAdmin + .getQueueConnectionFactories(1); + iSize = htQueueFactories.size(); + sQueueFactories1 = new String[iSize]; + String[] sQueueFactoryProps = new String[iSize]; + jj = 0; + for (Enumeration e = htQueueFactories.keys(); e + .hasMoreElements();) { + String sElement = (String) e.nextElement(); + sQueueFactories1[jj] = sElement; + sQueueFactoryProps[jj] = (String) htQueueFactories + .get(sElement); + jj++; + } + ctsJMS.createQueueConnectionFactories(sQueueFactories1, + sQueueFactoryProps); + bCreateConnectionFactories1 = false; + } + } + } + } catch (PropertyNotSetException e) { + e.printStackTrace(); + throw new TSDeploymentException( + "Failed to get values for deployment_host properties."); + } + if (bSupportsAutoJMS) { + // create topics/queues here + if (sQueues != null) { + ctsJMS.createQueues(sQueues); + } + if (sTopics != null) { + ctsJMS.createTopics(sTopics); + } + } + // check to see if we have a connector + if (earFile.endsWith(".rar")) { + try { + Properties connectorProps = new Properties(); + connectorProps.setProperty("rar_file", earFile); + connectorProps.setProperty("deployment_host", + deploymentInfo.getProperty("deployment_host")); + connectorProps.setProperty("deployment_port", + deploymentInfo.getProperty("deployment_port")); + connectorProps.setProperty("deployment.props.number", + deploymentInfo.getProperty("deployment.props.number")); + + ctsDeploy.deployConnector(connectorProps); + } catch (TSDeploymentException e) { + logOut.println("Failed to deploy Connector: " + earFile); + e.printStackTrace(); + throw e; + } + } else { + sClientClassPaths += ctsDeploy.deploy(deploymentInfo); + if (!sClientClassPaths.endsWith(File.pathSeparator)) + sClientClassPaths += File.pathSeparator; + } + } + return sClientClassPaths; + } + + private void undeployApps(String sDir) + throws TSDeploymentException, TSJMSAdminException { + if (executionMode == ExecutionMode.DEPLOY_RUN_UNDEPLOY + || executionMode == ExecutionMode.UNDEPLOY) { + String[] sAppJarsArray; + String sInteropDirections = sInteropDirectionWhenTablesWerePopulated; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "undeployApps - InteropDirections: " + sInteropDirections); + + sAppJarsArray = ProfileHelper.getArchives(sDir, sInteropDirections); + + if (sInteropDirections.equals("forward") + || sInteropDirections.equals("both")) { + swapSettings("forward"); + TestUtil.logHarness("Undeploying apps..."); + continueToUndeployApps(sDir, sAppJarsArray); + } + if (sInteropDirections.equals("reverse") + || sInteropDirections.equals("both")) { + + if (isInteropDir(sDir)) { + swapSettings("reverse"); + TestUtil.logHarness("Deploying apps for reverse run..."); + continueToUndeployApps(sDir, sAppJarsArray); + + } else { + // This is only for the case that we are a rebuildable test and the + // direction + // has been overridden to reverse. We don't swap settings to reverse + // and deploy in the + // reverse direction for rebuiuldable tests - only true interop tests + + // Adding explicit call to be sure that settings are in the forward + // direction since when + // these tests run, the settings are swapped to reverse + swapSettings("forward"); + + if (sInteropDirections.equals("reverse")) { + TestUtil.logHarness("Undeploying apps for reverse rebuildable..."); + continueToUndeployApps(sDir, sAppJarsArray); + } + } + + } + } else { + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug( + "Undeployment of apps disabled due to execute mode being set to:" + + String.valueOf(executionMode)); + } + } + + private void continueToUndeployApps(String sDir, String[] sAppJarsArray) + throws TSDeploymentException, TSJMSAdminException { + File fTestDir = new File(sDir); + // String[] sAppJarsArray = fTestDir.list(ArchiveFilter.getInstance()); + String sFileNameMinusExtension = ""; + TSDeploymentInterface ctsDeploy = null; + TSJMSAdminInterface ctsJMS = null; + String[] sQueues = null; + String[] sTopics = null; + // if there are no archives to deploy, just warn and return + if (sAppJarsArray == null) { + TestUtil.logHarness( + "There are no archives to undeploy in this directory: " + sDir); + return; + } + // set the property, sFileNameMinusExtension.ear_file + // set the prop, sFileNameMinusExtension.runtime_files + // need to figure out the exact build rules for this + for (int ii = 0; ii < sAppJarsArray.length; ii++) { + sFileNameMinusExtension = sAppJarsArray[ii].substring(0, + sAppJarsArray[ii].lastIndexOf(".")); + pDeployProps.put("ear_file", sDir + File.separator + sAppJarsArray[ii]); + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug(sFileNameMinusExtension + " ear_file = " + sDir + + File.separator + sAppJarsArray[ii]); + try { + if (sFileNameMinusExtension.indexOf("_j2ee2") != -1 + || sFileNameMinusExtension.startsWith("vi_built_")) { + pDeployProps.setProperty("deployment_host", + jteMgr.getProperty("deployment_host.2")); + pDeployProps.setProperty("deployment_port", + jteMgr.getProperty("deployment_port.2")); + pDeployProps.setProperty("deployment.props.number", "2"); + + ctsDeploy = (TSDeploymentInterface) htTSDeployers.get("cts2"); + if (bSupportsAutoJMS) { + ctsJMS = (TSJMSAdminInterface) htTSJMSAdmins.get("cts2"); + sQueues = TSJMSAdmin.getQueues(sDir, 2); + sTopics = TSJMSAdmin.getTopics(sDir, 2); + } + } else { + pDeployProps.setProperty("deployment_host", + jteMgr.getProperty("deployment_host.1")); + pDeployProps.setProperty("deployment_port", + jteMgr.getProperty("deployment_port.1")); + pDeployProps.setProperty("deployment.props.number", "1"); + + ctsDeploy = (TSDeploymentInterface) htTSDeployers.get("cts1"); + if (bSupportsAutoJMS) { + ctsJMS = (TSJMSAdminInterface) htTSJMSAdmins.get("cts1"); + sQueues = TSJMSAdmin.getQueues(sDir, 1); + sTopics = TSJMSAdmin.getTopics(sDir, 1); + } + } + } catch (PropertyNotSetException e) { + e.printStackTrace(); + throw new TSDeploymentException( + "Failed to get values for deployment_host properties."); + } + String earFile = pDeployProps.getProperty("ear_file"); + // check to see if we have a connector + if (earFile.endsWith(".rar")) { + // undeploy connector here + try { + Properties connectorProps = new Properties(); + connectorProps.setProperty("rar_file", earFile); + connectorProps.setProperty("deployment_host", + pDeployProps.getProperty("deployment_host")); + connectorProps.setProperty("deployment_port", + pDeployProps.getProperty("deployment_port")); + connectorProps.setProperty("deployment.props.number", + pDeployProps.getProperty("deployment.props.number")); + + if (ctsDeploy.isConnectorDeployed(connectorProps)) { + ctsDeploy.undeployConnector(connectorProps); + } + } catch (TSDeploymentException e) { + logOut.println("Failed to undeploy Connector: " + earFile); + e.printStackTrace(); + throw e; + } + } else { + if (ctsDeploy.isDeployed(pDeployProps)) { + ctsDeploy.undeploy(pDeployProps); + logOut.println("Successfully undeployed app: " + sDir + + File.separator + sAppJarsArray[ii]); + if (bSupportsAutoJMS) { + // remove JMS topics/queues here + // create topics/queues here + if (sQueues != null) { + ctsJMS.removeQueues(sQueues); + } + if (sTopics != null) { + ctsJMS.removeTopics(sTopics); + } + } + } + } + } + } + + private void swap() { + if (bSupportsAutoDeploy) { + + Object cts1 = htTSDeployers.get("cts1"); + Object jms1 = htTSJMSAdmins.get("cts1"); + Object cts2 = htTSDeployers.get("cts2"); + Object jms2 = htTSJMSAdmins.get("cts2"); + htTSDeployers.put("cts1", cts2); + htTSDeployers.put("cts2", cts1); + htTSJMSAdmins.put("cts1", jms2); + htTSJMSAdmins.put("cts2", jms1); + } + try { + runtimeConfig = new TSRuntimeConfiguration(logOut); + TestUtil.logHarness("ss: modified runtime.xml"); + } catch (Exception e) { + e.printStackTrace(); + TestUtil.logHarness( + "Failed to modify xml files with correct settings. Please check the values of 'mailHost, mailFrom, webServerHost, and webServerPort'"); + } + } + + public void swapSettings(String sDirection) { + TestUtil.logHarnessDebug( + "*******swapSettings CALLED with direction: " + sDirection); + + if (sDirection.equals("reverse")) { + if (bReversed) + return; + else { + try { + jteMgr = deliv.getPropertyManager(); + jteMgr.swapInteropPropertyValues(sDirection); + } catch (Exception e) { + e.printStackTrace(); + } + bReversed = true; + // deployers and runtime info + swap(); + } + } else { + if (!bReversed) + return; + else { + try { + jteMgr = deliv.getPropertyManager(); + jteMgr.swapInteropPropertyValues(sDirection); + } catch (Exception e) { + e.printStackTrace(); + } + bReversed = false; + // deployers and runtime info + swap(); + } + } + } + + public static class RuntimeInfoFilter implements FilenameFilter { + private static RuntimeInfoFilter instance = new RuntimeInfoFilter(); + + private RuntimeInfoFilter() { + } + + public static RuntimeInfoFilter getInstance() { + return instance; + } + + public boolean accept(File dir, String name) { + boolean bReturn = false; + + if ((name.endsWith(".xml") + && (name.indexOf(".sun-") != -1 || name.startsWith("sun-"))) + || name.endsWith("dbschema")) { + bReturn = true; + } + return bReturn; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TS.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TS.java new file mode 100644 index 0000000..af5ef5a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TS.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.util.*; +import java.io.*; +import com.sun.javatest.finder.*; +import com.sun.javatest.*; +import com.sun.javatest.util.BackupPolicy; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.*; +import com.sun.ts.lib.deliverable.*; +import com.sun.interview.Interview; +import com.sun.ts.lib.javatest.*; + +public class TS extends TestSuite { + private TestEnvironment env; + + private boolean observerAdded; + + private PropertyManagerInterface propMgr; + + public TS(File root, Map tsInfo, ClassLoader cl) throws Fault { + super(root, tsInfo, cl); + } + + public File getInitialExcludeList() { + File jtxFile = super.getInitialExcludeList(); + if (jtxFile != null && jtxFile.exists() && jtxFile.isFile()) { + return jtxFile; + } + String tsHome = System.getProperty("TS_HOME"); + jtxFile = new File(tsHome, "bin/ts.jtx"); + return jtxFile; + } + + public InterviewParameters createInterview() { + InterviewParameters ctsInterv = null; + try { + ctsInterv = new TSLegacyParameters(this); + } catch (Interview.HelpNotFoundFault f) { + TestUtil.logHarness("TS.createInterview() couldn't find help files."); + } catch (Interview.BadHelpFault bf) { + TestUtil.logHarness("TS.createInterview() found invalid help files."); + } catch (Exception ep) { + TestUtil.logHarness("TS.createInterview()" + ep.toString()); + ep.printStackTrace(); + } + return ctsInterv; + } + + public Script createScript(TestDescription td, String[] exclTestCases, + TestEnvironment scriptEnv, WorkDirectory workDir, + BackupPolicy backupPolicy) throws Fault { + Script s = new TSScript(); + s.initArgs(TestUtil.EMPTY_STRING_ARRAY); + s.initTestDescription(td); + s.initExcludedTestCases(exclTestCases); + s.initTestEnvironment(scriptEnv); + s.initWorkDir(workDir); + s.initBackupPolicy(backupPolicy); + return s; + } + + public TestFinder createTestFinder() throws Fault { + File fTSRoot = getRoot(); + if (fTSRoot == null) { + TestUtil.logHarness("getRoot() returns null!"); + fTSRoot = new File(System.getProperty("TS_HOME"), "src"); + } + File jtd = new File(fTSRoot, "testsuite.jtd"); + TestFinder finder = null; + String[] args = null; + if (jtd.exists() && !Boolean.getBoolean("no.binary.finder")) { + finder = new BinaryTestFinder(); + args = new String[] { "-binary", jtd.getPath() }; + TestUtil.logHarness("Use BinaryTestFinder..."); + } else { + String finderFilePath = getFinderFilePath(); + if (finderFilePath == null) { + finder = new TSTestFinder(); + args = TestUtil.EMPTY_STRING_ARRAY; + TestUtil.logHarness("Use TSTestFinder..."); + } else { + finder = new ChameleonTestFinder(); + args = new String[] { "-f", finderFilePath }; + TestUtil.logHarness("Use ChameleonTestFinder..."); + } + } + try { + finder.init(args, fTSRoot, null); + } catch (TestFinder.Fault exp) { + exp.printStackTrace(); + throw new Fault(null, "error initializing test finder."); + } + return finder; + } + + public void starting(Harness harness) throws Fault { + if (observerAdded) { + return; + } + env = harness.getParameters().getEnv(); + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .createPropertyManager(env); + } catch (Exception ex) { + ex.printStackTrace(); + TestUtil + .logHarness("Failed to create PropertyManager in TS constructor."); + } + try { + // create the tmp dir at the very beginning + String sTestDir = propMgr.getProperty("harness.temp.directory"); + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("Harness temp dir = " + sTestDir); + } + createDir(sTestDir); + cleanDir(new File(sTestDir), new File(sTestDir)); + + } catch (Exception e) { + e.printStackTrace(); + TestUtil.logHarness("Failed to create PropertyManager."); + } + + harness.addObserver(new TSHarnessObserver()); + observerAdded = true; + } + + private String getFinderFilePath() { + File propsDir = new File( + System.getProperty("TS_HOME", System.getProperty("ts.home")) + + File.separator + "src" + File.separator + "com" + File.separator + + "sun" + File.separator + "ts" + File.separator + "lib", + "harness"); + File finderProperties = new File(propsDir, "finder.properties"); + System.err.println("finderProperties = " + finderProperties.toString()); + if (!finderProperties.exists()) { + finderProperties = new File(propsDir, "map.jtc"); + } + if (finderProperties.exists()) { + return finderProperties.getPath(); + } + return null; + } + + private void createDir(String sDir) throws Exception { + File fDir = new File(sDir); + + if (!fDir.exists()) { + if (!fDir.mkdirs()) { + throw new Exception("Failed to create directory: " + sDir); + } + TestUtil.logHarnessDebug("Successfully created directory: " + sDir); + } + } + + private void cleanDir(File initialDir, File dir) { + File[] files = dir.listFiles(); + + if (files == null) { + return; + } + + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + // commenting out - don't clean subdirectories that might be created by + // other deliverables + // cleanDir(initialDir, files[i]); + } else { + files[i].delete(); + } + } + + // don't clean directories since CTS deliverable may create dirs under this + // if (!dir.equals(initialDir)) { + // dir.delete(); + // } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHTMLTestFinder.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHTMLTestFinder.java new file mode 100644 index 0000000..2c69358 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHTMLTestFinder.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.*; +import java.util.*; +import com.sun.javatest.*; +import com.sun.javatest.finder.*; +import com.sun.ts.lib.util.TestUtil; + +/** + * A adapter between html test description and cts tag test description. It is + * designed specific for jaxp/api/xml_schema tests. If applied to other test + * directories, at least change the executeClass and testDir value. + * + * @created November 1, 2002 + */ +public class TSHTMLTestFinder extends HTMLTestFinder { + public void foundTestDescription(Map entries, File file, int line) { + VehicleVerifier vehicleVerifier = VehicleVerifier.getInstance(file); + String[] vehicles = vehicleVerifier.getVehicleSet(); + for (int i = 0; i < vehicles.length; i++) { + TestDescription td = createTestDescription(entries, file, vehicles[i]); + // System.out.println("### TestDesciption: " + td.toString()); + foundTestDescription(td); + } + } + + private TestDescription createTestDescription(Map map, File file, + String vehicle) { + Map result = new Hashtable(13); + String id = (String) map.get("id"); + if (id == null) { + id = (String) map.get("name"); + } + if (id == null) { + System.out.println("### id or name is null"); + Thread.dumpStack(); + } + id = new StringBuffer(50).append(id).append("_from_").append(vehicle) + .toString(); + // String executeClass = (String) map.get("executeClass"); + String executeClass = "com.sun.ts.tests.jaxp.api.xml_schema.XmlSchemaRunner"; + String executeArgs = (String) map.get("executeArgs"); + if (id != null) { + result.put("testName", id); + result.put("id", id); + } + if (executeClass != null) { + result.put("classname", executeClass); + } + if (executeArgs != null) { + result.put("testArgs", executeArgs); + } + result.put("service_eetest", "yes"); + + String testDir = file.getParent(); + // result.put("test_directory", TestUtil.getRelativePath(testDir)); + result.put("test_directory", "com/sun/ts/tests/jaxp/api/xml_schema"); + + File root = this.getRoot(); + return new TestDescription(root, file, result); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHarnessObserver.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHarnessObserver.java new file mode 100644 index 0000000..314f4a3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSHarnessObserver.java @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.javatest.*; +import com.sun.javatest.util.StringArray; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.*; +import com.sun.ts.lib.deliverable.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.jar.*; + +/** + * This class is used to capture output from the tests (which goes to the .jtr + * files) and to also send it to the standard output stream. This is done so + * that "gmake runclient" when running Javatest in batch mode, will behave + * similar to the old "gmake runclient". + * + * @author Kyle Grucci + */ +public class TSHarnessObserver + implements Harness.Observer, TestResult.Observer { + private boolean supportsAutoDeploy = true; + + private boolean supportsAutoJMSAdmin = true; + + private static SuiteSynchronizer ss; + + private static int iPassedCount; + + private static int iFailedCount; + + private static int iErrorCount; + + private static int iNotRunCount; + + private static int iFinishedTests; + + private static int iRemainingTests; + + private static int iTotalTestsFound; + + private static Vector vTests = new Vector(); + + private static boolean jtrOutput; + + private static String sLastTestDirectory = ""; + + private static int executionMode; + + private static String keywords = "all"; + + private static final String SEP = "*******************************"; + + private static final String SEP2 = "********************************************************************************"; + + private PrintWriter logDeploy; + + private StringWriter logLastDeployOutput; + + static { + jtrOutput = Boolean.getBoolean("cts.jtroutput"); + } + + public TSHarnessObserver() { + try { + DeliverableInterface deliverable = DeliverableFactory + .getDeliverableInstance(); + supportsAutoDeploy = deliverable.supportsAutoDeployment(); + supportsAutoJMSAdmin = deliverable.supportsAutoJMSAdmin(); + } catch (Exception ex) { + TestUtil.logHarness("Failed to get deliverable instance."); + ex.printStackTrace(); + } + } + + // ------methods from Harness.Observer---------------------------------------- + public void startingTestRun(com.sun.javatest.Parameters p) { + + if (jtrOutput) + println("Starting tests"); + + PropertyManagerInterface propMgr = null; + try { + // get keywords that are set and add them to the prop mgr + Parameters.MutableKeywordsParameters mkp = (Parameters.MutableKeywordsParameters) p + .getKeywordsParameters(); + keywords = mkp.getMatchKeywordsValue(); + TestUtil.logHarness("startingTestRun - keywords set to: " + keywords); + + if (keywords == null) + keywords = "all"; + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + propMgr.setProperty("current.keywords", keywords); + } catch (Exception e) { + e.printStackTrace(); + } + executionMode = ExecutionMode.getExecutionMode(propMgr); + } + + public void stoppingTestRun() { + } + + public void finishedTestRun(boolean allOK) { + } + + public synchronized void finishedTesting() { + + PropertyManagerInterface propMgr = null; + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + if (keywords == null) + keywords = "all"; + propMgr.setProperty("current.keywords", keywords); + } catch (Exception e) { + e.printStackTrace(); + } + + // do common/last apps undeployment here... + try { + if (executionMode == ExecutionMode.DEPLOY_RUN_UNDEPLOY + || executionMode == ExecutionMode.UNDEPLOY) { + ss = SuiteSynchronizer + .getSuiteSynchronizer(new PrintWriter(System.out, true)); + sLastTestDirectory = ""; + if (supportsAutoDeploy) { + ss.undeployLastApp(); + ss.doCommonUnDeployment(); + } + if (supportsAutoJMSAdmin) { + ss.removeJmsConnectionFactories(); + } + } + } catch (TSDeploymentException de) { + TestUtil.logHarness(SEP + + "\nAn error occurred during common/last app Undeployment\n" + SEP); + de.printStackTrace(); + } catch (TSJMSAdminException je) { + TestUtil.logHarness( + SEP + "\nAn error occurred during JMS topic/queue/factory removal\n" + + SEP); + je.printStackTrace(); + } + + if (jtrOutput) { + int iSize = vTests.size(); + if (iSize == 0) { + return; + } + StringBuffer msg = new StringBuffer(1000); + msg.append(SEP2).append('\n'); + + if (executionMode == ExecutionMode.LIST) { + msg.append("Listing of tests in this directory: ") + .append(iFinishedTests).append(" tests found.").append('\n'); + + Iterator it = TSTestFinder.htTestNamesFound.entrySet().iterator(); + + boolean bHeaderWritten = false; + + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it + .next(); + + String sKey = entry.getKey(); + Integer iValue = entry.getValue(); + if (iValue.intValue() > 1) { + if (!bHeaderWritten) { + msg.append('\n'); + msg.append("Found duplicate @testName declarations").append('\n'); + msg.append( + "------------------------------------------------------") + .append('\n'); + bHeaderWritten = true; + } + + msg.append(iValue + " occurrences of " + + sKey.substring(sKey.indexOf("com" + File.separator))) + .append('\n'); + } + } + msg.append('\n'); + } else { + msg.append("Completed running ").append(iFinishedTests) + .append(" tests.").append('\n'); + msg.append("Number of Tests Passed = ").append(iPassedCount) + .append('\n'); + msg.append("Number of Tests Failed = " + iFailedCount) + .append('\n'); + msg.append("Number of Tests with Errors = " + iErrorCount).append('\n'); + } + + msg.append(SEP2).append('\n'); + for (int ii = 0; ii < iSize; ii++) { + String elem = (String) vTests.get(ii); + msg.append(elem).append('\n'); + } + println(msg.toString()); + + vTests.removeAllElements(); + iFinishedTests = 0; + iPassedCount = 0; + iErrorCount = 0; + iNotRunCount = 0; + iFailedCount = 0; + iTotalTestsFound = 0; + } + + removeTempPropsFile(); + removeTempJars(); + } + + private void removeTempPropsFile() { + try { + String tempDir = System.getProperty("java.io.tmpdir"); + String userName = System.getProperty("user.name"); + String tempFile = tempDir + File.separator + userName + "-cts-props.txt"; + File tempF = new File(tempFile); + tempF.delete(); + } catch (Throwable e) { + } + } + + private void removeTempJars() { + try { + String tempDir = System.getProperty("java.io.tmpdir"); + File tempDirFile = new File(tempDir); + String userName = System.getProperty("user.name"); + File[] tempJars = tempDirFile.listFiles(); + int numFiles = (tempJars == null) ? 0 : tempJars.length; + for (int i = 0; i < numFiles; i++) { + if (tempJars[i].getName().startsWith(userName + "-ts-deployment-plan") + && tempJars[i].getName().endsWith(".jar")) { + try { + tempJars[i].delete(); + } catch (Throwable ee) { + } + } + } + } catch (Throwable e) { + } + } + + public void error(String s) { + TestUtil.logHarness(s); + } + + public synchronized void startingTest(TestResult tr) { + Properties pTestProps = null; + String sVehicle = ""; + String sIsServiceTest = ""; + PropertyManagerInterface propMgr = null; + + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + + if (keywords == null) { + TestUtil.logHarness("startingTest - resetting keywords set to: all"); + keywords = "all"; + } + propMgr.setProperty("current.keywords", keywords); + } catch (Exception e) { + e.printStackTrace(); + } + TestDescription td = null; + try { + td = tr.getDescription(); + } catch (TestResult.Fault e) { + e.printStackTrace(); + } + + if (jtrOutput) { + tr.addObserver(this); + if (executionMode == ExecutionMode.DEPLOY_RUN_UNDEPLOY + || executionMode == ExecutionMode.RUN + || executionMode == ExecutionMode.DEPLOY_RUN) { + StringBuffer msg = new StringBuffer(300); + msg.append(SEP2).append('\n'); + msg.append("Beginning Test: ") + .append(td.getParameter("classname").replace('.', '/')) + .append(".java#").append(td.getParameter("id")).append('\n'); + msg.append(SEP2).append('\n'); + println(msg.toString()); + } + } + // do deployment here + if (ss == null) + ss = SuiteSynchronizer + .getSuiteSynchronizer(new PrintWriter(System.out, true)); + + // get properties from the test description + String testPropsInDescp = td.getParameter("testProps"); + String[] sTestPropKeys = TestUtil.EMPTY_STRING_ARRAY; + if (testPropsInDescp != null) { + StringTokenizer st = new StringTokenizer(testPropsInDescp.trim()); + sTestPropKeys = new String[st.countTokens()]; + for (int ii = 0; ii < sTestPropKeys.length; ii++) { + sTestPropKeys[ii] = st.nextToken(); + } + } + // construct a properties object with the test specific keys + // and the values from the jte file + try { + pTestProps = propMgr.getTestSpecificProperties(sTestPropKeys); + } catch (PropertyNotSetException e) { + e.printStackTrace(); + } + // get and set which vehicle this test should run in + String sID = td.getParameter("id"); + sIsServiceTest = td.getParameter("service_eetest"); + sVehicle = null; + // do we have a service test? + if (sIsServiceTest.equals("yes")) { + sVehicle = sID.substring(sID.lastIndexOf("_") + 1); + } else { + sVehicle = "not a service test"; + } + + // 7/24/09 - Remove check to not deploy if standalone vehicle due to + // the fact that there may be some standalone vehicle tests which require + // deployment of an endpoint. Special casing jaxrs here for now since there + // are other + // test dirs that rely upon the standalone vehicle not having anything + // deployed. + if (supportsAutoDeploy) { + String testDir = ""; + + // ss.setOutputWriter(logOut); + testDir = TSTestFinder.getAbsolutePath(td.getParameter("test_directory")); + + if (!sVehicle.equals("standalone") || (testDir.indexOf("jaxrs") != -1)) { + TestResult.Section deploySection = tr.createSection("Deployment"); + logDeploy = deploySection.createOutput("log"); + + try { + // just return if we're in the same test directory + if (sLastTestDirectory.equals(testDir)) { + // log saved deployment output to the jtr file + if (ss.getDeploymentStatus().equals("failed")) + TestUtil.logHarness( + "An error ocurred during deployment of apps in this directory: " + + testDir + + ". Thus, all other tests in this directory will fail with the same error."); + } else { + logLastDeployOutput = new StringWriter(); + TestUtil.setAdditionalWriter(new PrintWriter(logLastDeployOutput)); + sLastTestDirectory = testDir; + ss.doDeployment(testDir, pTestProps); + } + } catch (TSDeploymentException de) { + // already logged in SuiteSynchronizer + } catch (TSJMSAdminException je) { + TestUtil.logHarness(SEP + + "\nAn error occurred during JMS topic/queue creation/removal\n" + + SEP); + je.printStackTrace(); + } finally { + // Write the contents of the StringWriter to the deployment section of + // the JTR file + logDeploy.write(logLastDeployOutput.getBuffer().toString()); + deploySection.setStatus(new Status(Status.PASSED, + "Deployment phase completed. However, check the output above to see if actual deployment passed or failed.")); + logDeploy.close(); + } + } + + } + } + + public synchronized void finishedTest(TestResult tr) { + if (!jtrOutput) { + return; + } + TestDescription td = null; + String sTestName = ""; + String sClassName = ""; + String sTestNameAndStatus = ""; + + try { + td = tr.getDescription(); + } catch (TestResult.Fault e) { + e.printStackTrace(); + } + sTestName = td.getParameter("id"); + sClassName = td.getParameter("classname"); + Status sTestStatus = tr.getStatus(); + + iTotalTestsFound = tr.getParent().getEnclosingTable().getCurrentTestCount(); + + if (executionMode == ExecutionMode.DEPLOY_RUN_UNDEPLOY + || executionMode == ExecutionMode.RUN + || executionMode == ExecutionMode.DEPLOY_RUN + || executionMode == ExecutionMode.LIST) { + if (executionMode == ExecutionMode.LIST) { + sTestNameAndStatus = "NOT_RUN........" + sClassName.replace('.', '/') + + ".java#" + sTestName; + iNotRunCount++; + } else if (sTestStatus.getType() == Status.PASSED) { + sTestNameAndStatus = "PASSED........" + sClassName.replace('.', '/') + + ".java#" + sTestName; + iPassedCount++; + } else if (sTestStatus.getType() == Status.ERROR) { + sTestNameAndStatus = "ERROR........" + sClassName.replace('.', '/') + + ".java#" + sTestName; + iErrorCount++; + } else if (sTestStatus.getType() == Status.NOT_RUN) { + sTestNameAndStatus = "NOT RUN........" + sClassName.replace('.', '/') + + ".java#" + sTestName; + iNotRunCount++; + } else { + sTestNameAndStatus = "FAILED........" + sClassName.replace('.', '/') + + ".java#" + sTestName; + iFailedCount++; + } + vTests.addElement(sTestNameAndStatus); + iFinishedTests++; + + iRemainingTests = iTotalTestsFound - iFinishedTests; + StringBuffer msg = new StringBuffer(400); + msg.append(SEP2).append('\n'); + msg.append("Finished Test: ").append(sTestNameAndStatus).append('\n'); + msg.append(SEP2).append('\n'); + msg.append("Number of tests completed: ").append(iFinishedTests) + .append(" ("); + msg.append(iPassedCount).append(" passed, ").append(iFailedCount) + .append(" failed, ").append(iErrorCount).append(" with errors)"); + msg.append('\n'); + msg.append("Number of tests remaining: " + iRemainingTests); + // msg.append('\n'); + // msg.append("Number of tests found: " + iTotalTestsFound); + println(sTestStatus.toString()); + println(msg.toString()); + } else { + if (executionMode == ExecutionMode.DEPLOY + || executionMode == ExecutionMode.UNDEPLOY) { + if ((sTestStatus.getType() == Status.PASSED) + && (sTestStatus.getReason().equals("DEPLOYED"))) { + iPassedCount++; + } else if (sTestStatus.getType() == Status.ERROR) { + iErrorCount++; + } else if (sTestStatus.getType() == Status.NOT_RUN) { + iNotRunCount++; + } else { + iFailedCount++; + } + } + } + } + + // ------methods from TestResult.Observer---------------------------------- + public void createdSection(TestResult tr, TestResult.Section section) { + } + + public void completedSection(TestResult tr, TestResult.Section section) { + } + + public void createdOutput(TestResult tr, TestResult.Section section, + String outputName) { + } + + public void completedOutput(TestResult tr, TestResult.Section section, + String outputName) { + } + + public void updatedOutput(TestResult tr, TestResult.Section section, + String outputName, int start, int end, String text) { + print(text); + } + + public void updatedProperty(TestResult tr, String name, String value) { + } + + public void completed(TestResult tr) { + } + + private void println(String msg) { + if (jtrOutput) { + System.out.println(msg); + } + } + + private void print(String msg) { + if (jtrOutput) { + System.out.print(msg); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSKeywords.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSKeywords.java new file mode 100644 index 0000000..edc3e37 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSKeywords.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.util.*; +import java.util.*; +import java.io.*; + +/** + * This class is used by the TS harness to figure out which keywords should be + * associated with directories of tests. Keywords are read in by the + * TSTestFinder and written out to the test decriptions. + * + * A singleton class not intended for concurrent access. + * + * + */ +public class TSKeywords { + public final static String KEYWORD_PROP_FILE_NAME = "keyword.properties"; + + private Properties mapping; + + private String[] keys; // sorted ascending + + private String relativeTestDir; + + private boolean loaded; + + // an uninitialized singleton instance + private static TSKeywords instance = new TSKeywords(); + + private TSKeywords() { + } + + public static TSKeywords getInstance(File path) { + if (instance == null) { + instance = new TSKeywords(); + } + instance.init(path); + return instance; + } + + private void init(File file) { + if (!loaded) { + mapping = ConfigUtil.loadPropertiesFor(KEYWORD_PROP_FILE_NAME); + keys = ConfigUtil.loadKeysFrom(mapping); + loaded = true; + } + if (mapping != null) { + this.relativeTestDir = TestUtil.getRelativePath(file.getPath()); + } + } + + /** + * This method gets the current set of keywords to be used for a given + * directory path. + * + * @return a String array of the keywords that this test should be run in + */ + public String[] getKeywordSet() { + if (mapping == null || keys == null) { + return TestUtil.EMPTY_STRING_ARRAY; + } + + String[] result = ConfigUtil.getMappingValue(this.mapping, this.keys, + this.relativeTestDir); + return result; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSRuntimeConfiguration.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSRuntimeConfiguration.java new file mode 100644 index 0000000..114a0db --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSRuntimeConfiguration.java @@ -0,0 +1,515 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import com.sun.ts.lib.deliverable.DeliverableFactory; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.PropertyNotSetException; +import com.sun.ts.lib.util.TestUtil; + +/** + * This is a utility class that is called by SuiteSynchronizer to replace any + * configurable properties in the runtime xml files with the user specific + * values from ts.jte. A copy is made of each runtime xml file (with the + * substituted values) in the harness.temp.directory/tmp directory. Each time a + * given test is run, this copy is only created iff the jte file or the original + * runtime have been changed since the last writing of the copy. + * + * @author Kyle Grucci + */ +public class TSRuntimeConfiguration { + // whether running with s1as or j2sdkee RI + private static Boolean runningS1AS; + + public final static String SUN_EJB_JAR_XML = ".sun-ejb-jar.xml"; + + public final static String SUN_WEB_XML = ".sun-web.xml"; + + public final static String SUN_APPLICATION_XML = ".sun-application.xml"; + + public final static String SUN_APPLICATION_CLIENT_XML = ".sun-application-client.xml"; + + public final static String SUN_CONNECTOR_XML = ".sun-connector.xml"; + + public final static String SUN_CMP_MAPPINGS_XML = ".sun-cmp-mappings.xml"; + + private File tempFile; + + private PrintWriter log; + + private Hashtable htReplacementProps = new Hashtable(); + + private Hashtable htReplacerTable = new Hashtable(); + + private String sTempDir = ""; + + private StringReplacer replacer; + + private File jteFile = new File(System.getProperty("TS_HOME") + File.separator + + "bin" + File.separator + "ts.jte"); + + /** The string to replace all mail-from tags with */ + private String mailFrom = ""; + + /** The string to replace all mail-host tags with */ + private String mailHost = ""; + + /** The web server host */ + private String webHost = ""; + + private String webHost2 = ""; + + /** The web server port */ + private String webPort = ""; + + private String webPort2 = ""; + + private String securedWebPort = ""; + + private String securedWebPort2 = ""; + + /** The wsdl repository */ + private String wsdlRepository1 = ""; + + private String wsdlRepository2 = ""; + + private String tsHome = ""; + + private String user1 = "cts1"; + + private String user2 = "cts2"; + + private String user3 = "cts3"; + + private String password1 = "cts1"; + + private String password2 = "cts2"; + + private String password3 = "cts3"; + + private String rauser1 = "cts1"; + + private String rauser2 = "cts2"; + + private String rapassword1 = "cts1"; + + private String rapassword2 = "cts2"; + + /** + * host + port of the naming service for 1st & 2nd servers in interop tests + */ + private String namingServiceHost1 = ""; + + private String namingServicePort1 = ""; + + private String namingServiceHost2 = ""; + + private String namingServicePort2 = ""; + + private int iPort = 0; + + private PropertyManagerInterface propMgr; + + public TSRuntimeConfiguration(PrintWriter out) + throws PropertyNotSetException { + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + } catch (Exception e) { + e.printStackTrace(); + } + log = out; + replacer = new StringReplacer(); + tsHome = propMgr.getProperty("ts_home", tsHome); + webHost = propMgr.getProperty("webServerHost", webHost); + webPort = propMgr.getProperty("webServerPort", webPort); + webHost2 = propMgr.getProperty("webServerHost.2", webHost2); + webPort2 = propMgr.getProperty("webServerPort.2", webPort2); + securedWebPort = propMgr.getProperty("securedWebServicePort", + securedWebPort); + securedWebPort2 = propMgr.getProperty("securedWebServicePort.2", + securedWebPort2); + mailFrom = propMgr.getProperty("mailFrom", mailFrom); + mailHost = propMgr.getProperty("mailHost", mailHost); + user1 = propMgr.getProperty("user1", user1); + user2 = propMgr.getProperty("user2", user2); + user3 = propMgr.getProperty("user3", user3); + password1 = propMgr.getProperty("password1", password1); + password2 = propMgr.getProperty("password2", password2); + password3 = propMgr.getProperty("password3", password3); + + rauser1 = propMgr.getProperty("rauser1", rauser1); + rauser2 = propMgr.getProperty("rauser2", rauser2); + rapassword1 = propMgr.getProperty("rapassword1", rapassword1); + rapassword2 = propMgr.getProperty("rapassword2", rapassword2); + + namingServiceHost1 = propMgr.getProperty("namingServiceHost1", + namingServiceHost1); + namingServiceHost2 = propMgr.getProperty("namingServiceHost2", + namingServiceHost2); + namingServicePort1 = propMgr.getProperty("namingServicePort1", + namingServicePort1); + namingServicePort2 = propMgr.getProperty("namingServicePort2", + namingServicePort2); + wsdlRepository1 = propMgr.getProperty("wsdlRepository1", wsdlRepository1); + wsdlRepository2 = propMgr.getProperty("wsdlRepository2", wsdlRepository2); + + if (TestUtil.harnessDebug) { + String msg = "TSRuntimeConfig: user1=" + user1 + ", rauser1=" + rauser1 + + ", password1=" + password1 + ", user2=" + user2 + ", password2=" + + password2 + ", user3=" + user3 + ", password3=" + password3 + + ", rapassword1=" + rapassword1 + ", rauser2=" + rauser2 + + ", rapassword2=" + rapassword2 + ", webPort = " + webPort + + ", webHost = " + webHost + ", mailFrom = " + mailFrom + + ", mailHost = " + mailHost + ", namingServiceHost1 = " + + namingServiceHost1 + ", namingServicePort1 = " + namingServicePort1 + + ", namingServiceHost2 = " + namingServiceHost2 + + ", namingServicePort2 = " + namingServicePort2 + + ", securedWebServicePort = " + securedWebPort + + ", securedWebServicePort.2 = " + securedWebPort2 + + ", wsdlRepository1 = " + wsdlRepository1 + ", wsdlRepository2 = " + + wsdlRepository2; + TestUtil.logHarnessDebug(msg); + } + + // we need to change the jte props for host and port props to include + // a ".1" at the end because currently any .2 props will never be found + // due to the fact that the .1 version is a substring of the .2 version. + htReplacementProps.put("webServerHost", webHost); + htReplacementProps.put("webServerPort", webPort); + htReplacementProps.put("webServerHost.1", webHost); + htReplacementProps.put("webServerPort.1", webPort); + htReplacementProps.put("webServerHost.2", webHost2); + htReplacementProps.put("webServerPort.2", webPort2); + htReplacementProps.put("securedWebServicePort", securedWebPort); + htReplacementProps.put("securedWebServicePort.1", securedWebPort); + htReplacementProps.put("securedWebServicePort.2", securedWebPort2); + htReplacementProps.put("ts_home", tsHome); + htReplacementProps.put("mailFrom", mailFrom); + htReplacementProps.put("mailHost", mailHost); + htReplacementProps.put("namingServiceHost1", namingServiceHost1); + htReplacementProps.put("namingServicePort1", namingServicePort1); + htReplacementProps.put("namingServiceHost2", namingServiceHost2); + htReplacementProps.put("namingServicePort2", namingServicePort2); + htReplacementProps.put("user1", user1); + htReplacementProps.put("user2", user2); + htReplacementProps.put("user3", user3); + htReplacementProps.put("password1", password1); + htReplacementProps.put("password2", password2); + htReplacementProps.put("password3", password3); + htReplacementProps.put("rauser1", rauser1); + htReplacementProps.put("rauser2", rauser2); + htReplacementProps.put("rapassword1", rapassword1); + htReplacementProps.put("rapassword2", rapassword2); + htReplacementProps.put("wsdlRepository1", wsdlRepository1); + htReplacementProps.put("wsdlRepository2", wsdlRepository2); + + sTempDir = propMgr.getProperty("harness.temp.directory"); + htReplacementProps.put("harness.temp.directory", sTempDir); + + } + + public void setTable(Hashtable table) { + this.htReplacerTable = table; + } + + public String sweepRuntimeFile(File file) + throws FileNotFoundException, IOException { + File xml = new File(sTempDir + File.separator + file.getName()); + + if (htReplacerTable != null && !(htReplacerTable.isEmpty())) { + htReplacerTable = replaceOnRuntimeInfoStrings(htReplacerTable); + + } + return replacer.replace(file, htReplacementProps, htReplacerTable, + sTempDir); + } + + final class StringReplacer { + public String sFindString; // string we are searching for + + public String sReplaceString; // replace sFindString with this + + public String sDirString; + + public String sFileNameStringToReplace; + + public String sNewFileNameString; + + public int iHowMany = -1; + + public String[] sFileList; + + public boolean bNewFile = false; + + private Hashtable htFindAndReplace = null; + + private Hashtable htCustomTable = null; + + private Vector vInfoObjects = new Vector(); + + private Vector vMatchingInfoObjects = new Vector(); + + private Vector vNonMatchingInfoObjects = new Vector(); + + private boolean bSomethingWasReplaced = false; + + public String replace(File file, Hashtable htStrings, + Hashtable htReplacerTable, String sTempDir) { + String[] sFileList = null; + htFindAndReplace = htStrings; + htCustomTable = htReplacerTable; + String sTemp = ""; + ReplacementInfo ri = null; + String sNewFileName = ""; + StringBuffer sFoundBuffer = new StringBuffer(); + char c; + bSomethingWasReplaced = false; + BufferedReader fReader = null; + BufferedWriter fNewWriter = null; + try { + vInfoObjects = new Vector(); + String sKey = ""; + // create ReplacementInfo objects + for (Enumeration e = htFindAndReplace.keys(); e.hasMoreElements();) { + sKey = (String) e.nextElement(); + vInfoObjects.addElement( + new ReplacementInfo(sKey, (String) htFindAndReplace.get(sKey))); + } + // add in the table the custom table of replacement strings + // if any + if (htCustomTable != null) { + for (Enumeration e = htCustomTable.keys(); e.hasMoreElements();) { + sKey = (String) e.nextElement(); + vInfoObjects.addElement( + new ReplacementInfo(sKey, (String) htCustomTable.get(sKey))); + } + } + // reader of the file that we're searching + fReader = new BufferedReader(new FileReader(file)); + StringWriter sWriter = new StringWriter(); + // stores new file contents + + // The following code is here to account for the fact that we + // have some properties to replace which are substrings of other + // properties. We need to be sure that we will be able to + // replace either. Thus, we check the char after certain props + // to see if they continue to match another property. If so, + // then we will replace with the longer property value + boolean bCheckForDot = false; + String sHold = ""; + int iCharRead; // holds each char that we read + vMatchingInfoObjects.addAll(vInfoObjects); + while ((iCharRead = fReader.read()) != -1) { + c = (char) iCharRead; + + if (bCheckForDot) { + if (c != '.') { + // hold the dot and let the old processing happen + sHold = new String((new Character(c)).toString()); + TestUtil.logHarnessDebug("sHold = " + sHold); + } else { + sFoundBuffer.append(c); + bCheckForDot = false; + continue; + // since there is no need to just check . + } + } else { + if (sHold != null) { + // just write the char that we were holding. This + // assumes that this char is not the beginning of a + // string we want to replace + sWriter.write(sHold); + sHold = null; + } + + sFoundBuffer.append(c); + } + + sTemp = new String(sFoundBuffer); + + // get all ris that still match + for (Enumeration e = vMatchingInfoObjects.elements(); e + .hasMoreElements();) { + ri = (ReplacementInfo) e.nextElement(); + if (ri.sFind.startsWith(sTemp)) { + if (ri.sFind.equals(sTemp)) { + + // what if we have a substring of another string that + // we are searching for? + if (!bCheckForDot) { + if (sTemp.equals("webServerHost") + || sTemp.equals("webServerPort") + || sTemp.equals("securedWebServicePort")) { + // set boolean and break out to read next char + bCheckForDot = true; + break; + } + } else { + bCheckForDot = false; + } + + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("REPLACER:MATCH found: " + ri.sFind + + " matches " + sTemp); + ri.foundOccurance(); + bSomethingWasReplaced = true; + sWriter.write(ri.sReplace); + // reset sFoundBuffer + sFoundBuffer = new StringBuffer(); + // reset matchers to all again + vMatchingInfoObjects.removeAllElements(); + vMatchingInfoObjects.addAll(vInfoObjects); + break; + } + } else { + vNonMatchingInfoObjects.addElement(ri); + // the char that we just read causes our string not + // to match the string we're looking for. Write the + // old string to the new file and reset sFoundBuffer. + // this will never happen!!! + } + } + // remove all non-matching ri's + vMatchingInfoObjects.removeAll(vNonMatchingInfoObjects); + vNonMatchingInfoObjects.removeAllElements(); + // reset everything if there are none left matching + if (vMatchingInfoObjects.isEmpty()) { + sWriter.write(sTemp); + sFoundBuffer = new StringBuffer(); + vMatchingInfoObjects.removeAllElements(); + vMatchingInfoObjects.addAll(vInfoObjects); + } + } + fReader.close(); + + /* + * Always copy the file to tmp even if we don't replace anything as it + * makes the location consistent for xml deployment handlers. + */ + + // if (bSomethingWasReplaced) { + sNewFileName = sTempDir + File.separator + file.getName(); + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("New filename:" + sNewFileName); + File fTmpRuntimeFile = new File(sNewFileName); + + if (fTmpRuntimeFile.exists()) { + TestUtil.logHarnessDebug("Old runtime file exists:" + sNewFileName); + fTmpRuntimeFile.delete(); + TestUtil.logHarnessDebug("Deleted old runtime file:" + sNewFileName); + } + // fTmpRuntimeFile + fNewWriter = new BufferedWriter(new FileWriter(new File(sNewFileName))); + fNewWriter.write(sWriter.toString()); + fNewWriter.flush(); + // } else { + // sNewFileName = null; + // } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fNewWriter != null) { + try { + fNewWriter.close(); + } catch (IOException exp) { + } + } + } + return sNewFileName; + } + + class ReplacementInfo { + private int iFoundOccurances = 0; + + private String sFind = null; + + private String sReplace = null; + + ReplacementInfo(String sFindString, String sReplaceString) { + sFind = sFindString; + sReplace = sReplaceString; + iFoundOccurances = 0; + } + + public void foundOccurance() { + iFoundOccurances++; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("we found an occurance #" + iFoundOccurances + + " of '" + sFind + "'"); + } + } + } + + /** + * Parse the HashTable which contains strings retrieved via calls into the + * porting classes for deployment. We must substitute on these strings prior + * to substituting them into the runtime.xml. + */ + private Hashtable replaceOnRuntimeInfoStrings(Hashtable extras) { + boolean changeIt = false; + Hashtable resultTable = new Hashtable(extras); + String searchFor[] = { "namingServiceHost1", "namingServicePort1", + "namingServiceHost2", "namingServicePort2", "webServerHost.1", + "webServerPort.1", "webServerHost.2", "webServerPort.2", + "securedWebServicePort.1", "securedWebServicePort.2", "wsdlRepository1", + "wsdlRepository2", "harness.temp.directory", "webServerHost", + "webServerPort, securedWebServicePort" }; + + for (Enumeration e = extras.keys(); e.hasMoreElements();) { + String sKey = (String) e.nextElement(); + String val = (String) extras.get(sKey); + TestUtil.logHarnessDebug("extra Key = " + sKey); + TestUtil.logHarnessDebug("extra Val = " + val); + String oldJndi = val; + changeIt = false; + String buff = null; + int startPos = 0; + for (int i = 0; i < searchFor.length; i++) { + if (TestUtil.harnessDebug) + TestUtil.logHarness("\n###Searching for=" + searchFor[i]); + if ((startPos = val.lastIndexOf(searchFor[i])) != -1) { + changeIt = true; + String startBuff = val.substring(0, startPos); + buff = (String) htReplacementProps.get(searchFor[i]); + val = startBuff + buff + + val.substring(startPos + searchFor[i].length()); + } + } + if (changeIt) { + resultTable.put((String) sKey, val); + if (TestUtil.harnessDebug) + TestUtil.logHarness("\n###\nold RuntimeInfo Val=" + oldJndi + + "\nNew RuntimeInfo Val = " + val); + } + } + return resultTable; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSScript.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSScript.java new file mode 100644 index 0000000..ccc7b4c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSScript.java @@ -0,0 +1,819 @@ +/* + * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.javatest.*; +import com.sun.javatest.util.StringArray; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.*; +import com.sun.ts.lib.deliverable.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; +import org.apache.tools.ant.taskdefs.condition.Os; +import org.apache.tools.ant.Project; + +public class TSScript extends com.sun.javatest.Script { + + TestResult.Section section; + + Status status; + + TestResult testResult; + + String keywords; + + PrintWriter logOut; + + private static String sClientClassesPath = ""; + + private static SuiteSynchronizer ss; + + String testDir = ""; + + String sVehicle = ""; + + String sIsServiceTest = ""; + + java.util.Properties pTestProps; + + PropertyManagerInterface propMgr; + + boolean bAppClientTest; + + int executionMode; + + java.util.Properties pExecProps = new Properties(); + + public static boolean bUseSameJVMCommand; + + private String sInteropDirection; + + private boolean bIsRebuildableReverseTest = false; + + static { + bUseSameJVMCommand = Boolean.getBoolean("same.jvm"); + } + + public Status run(String[] args, TestDescription td, TestEnvironment env) { + + pTestProps = new java.util.Properties(); + String[] sArgs = null; + String[] sVal = null; + String testName = td.getParameter("testName"); + String executeClass = td.getParameter("classname"); + String executeArgs = td.getParameter("testArgs"); + String sTestJteFile = null; + String sSrcDir = TSTestFinder + .getAbsolutePath(td.getParameter("test_directory")); + String sClassesVIBuiltDir = TestUtil.replaceLastSrc(sSrcDir, + "classes_vi_built"); + testDir = TestUtil.srcToDist(sSrcDir); + // based on the test description, we should construct the set of props + // that get sent to the test. + testResult = getTestResult(); + section = testResult.createSection("TestRun"); + logOut = section.createOutput("log"); + sInteropDirection = td.getParameter("direction"); + if (sInteropDirection == null) { + sInteropDirection = "forward"; + } + if (testDir.indexOf("interop") == -1 + && sInteropDirection.equals("reverse")) { + bIsRebuildableReverseTest = true; + File fClassesVIBuiltDir = new File(sClassesVIBuiltDir); + String[] sVIBuiltClasses = fClassesVIBuiltDir + .list(ClassFilter.getInstance()); + + if (sVIBuiltClasses == null || sVIBuiltClasses.length == 0) { + String error = "TEST NOT RUN: This test cannot be run until you" + + TestUtil.NEW_LINE + + "rebuild the test classes and/or archives associated with it." + + TestUtil.NEW_LINE + "Please see the TCK documentation for more" + + TestUtil.NEW_LINE + "information on rebuildable tests."; + + // Report an error since the vi built archives do not exist yet + logOut.println("*********************************************"); + logOut.println(error); + logOut.println("*********************************************"); + return Status.error("VI classes and/or archives have not been built."); + } + } + + try { + // grab keywords before resetting property manager + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + keywords = propMgr.getProperty("current.keywords"); + + // reset property manager with currrent environment + propMgr = DeliverableFactory.getDeliverableInstance() + .createPropertyManager(env); + + ss = SuiteSynchronizer.getSuiteSynchronizer(logOut); + + // If we're just deploying/undeploying, return now + executionMode = ExecutionMode.getExecutionMode(propMgr); + if (executionMode == ExecutionMode.LIST) { + logOut.println("TEST: " + testName); + return Status.error("LISTED"); + } else if (executionMode == ExecutionMode.DEPLOY) { + if (ss.getDeploymentStatus().equals("failed")) { + logOut.println(ss.getDeploymentExceptionTrace()); + return Status.failed( + "An error occurred during the Deployment phase for tests in this directory."); + } else { + return Status.passed("DEPLOYED"); + } + } else if (executionMode == ExecutionMode.UNDEPLOY) { + if (ss.getDeploymentStatus().equals("failed")) { + logOut.println(ss.getDeploymentExceptionTrace()); + return Status.failed( + "An error occurred during the Deployment phase for tests in this directory."); + } else { + return Status.passed("UNDEPLOYED"); + } + } + // else continue on + + // We must reset all settings to forward because of the call above to + // recreate + // the property manager with the new environment. The call above is needed + // for every + // test since a user may run the GUI and change jte file settings prior to + // running + // another set of tests. This also fixes bug# 4953862. + ss.swapSettings("forward"); + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "TSScript - sInteropDirection: " + sInteropDirection); + } + if (sInteropDirection.equals("reverse")) { + ss.swapSettings("reverse"); + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("Reversed settings for test: " + testName); + } + } + + if (TestUtil.harnessDebug) { + StringBuffer sb = new StringBuffer(); + sb.append("test description contains key/value:"); + for (Iterator e = td.getParameterKeys(); e.hasNext();) { + String k = (String) (e.next()); + sb.append(k).append('=').append(td.getParameter(k)); + } + TestUtil.logHarnessDebug(sb.toString()); + } + // Add the path to any -ap args + String sTemp = ""; + String sTempArgs = ""; + String defaultBin = System.getProperty("TS_HOME") + File.separator + + "bin"; + String sTSBinDir = System.getProperty("bin.dir", defaultBin); + if (executeArgs != null) { + StringTokenizer st = new StringTokenizer(executeArgs); + while (st.hasMoreTokens()) { + sTemp = st.nextToken(); + if (sTemp.equals("-ap")) { + String next = st.nextToken(); + if (next.equals("tssql.stmt") + && sInteropDirection.equals("reverse")) { + sTempArgs += sTemp + " " + sTSBinDir + File.separator + + "tssql.stmt.ri" + " "; + } else { + sTempArgs += sTemp + " " + sTSBinDir + File.separator + next + + " "; + } + } else { + sTempArgs += sTemp + " "; + } + } + executeArgs = sTempArgs.trim(); + } + // get properties from the test description + String testPropsInDescp = td.getParameter("testProps"); + String[] sTestPropKeys = TestUtil.EMPTY_STRING_ARRAY; + if (testPropsInDescp != null) { + StringTokenizer st = new StringTokenizer(testPropsInDescp.trim()); + sTestPropKeys = new String[st.countTokens()]; + for (int ii = 0; ii < sTestPropKeys.length; ii++) { + sTestPropKeys[ii] = st.nextToken(); + } + } + // construct a properties object with the test specific keys + // and the values from the jte file + try { + pTestProps = propMgr.getTestSpecificProperties(sTestPropKeys); + } catch (PropertyNotSetException pnse) { + pnse.printStackTrace(); + return Status.failed( + "Please supply values for the necessary properties to run these tests. " + + pnse.getMessage()); + } + + // set current.keywords so we can pass it to the sig tests + // get keywords that are set and add them to the prop mgr + // also set jimage.dir for Java 11 sig tests + TestUtil + .logHarness("keywords (to be passed to tests) set to: " + keywords); + pTestProps.put("current.keywords", keywords); + String version = (String)System.getProperties().get("java.version"); + if (!version.startsWith("1.")) { + pTestProps.put("jimage.dir", propMgr.getProperty("jimage.dir")); + } + + // so we know what kind of test this is + String finderType = td.getParameter("finder"); + pTestProps.put("finder", (finderType == null ? "cts" : finderType)); + // Added test classname for JCKService tests. + pTestProps.put("test_classname", executeClass); + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("** for JCK::testClassName= " + executeClass); + } + // get and set which vehicle this test should run in + String sID = td.getParameter("id"); + sIsServiceTest = td.getParameter("service_eetest"); + sVehicle = null; + // do we have a service test? + if (sIsServiceTest.equals("yes")) { + + if (sID.endsWith("_reverse")) { + // remove "_reverse" first + sVehicle = sID.substring(0, sID.lastIndexOf("_")); + sVehicle = sVehicle.substring(sVehicle.lastIndexOf("_") + 1); + } else { + sVehicle = sID.substring(sID.lastIndexOf("_") + 1); + } + + // set the ExecuteClass to our VehicleClient + if (sVehicle.equalsIgnoreCase("wsappclient")) { + executeClass = "com.sun.ts.tests.common.vehicle.wsappclient.WSAppclient"; + } else { + executeClass = "com.sun.ts.tests.common.vehicle.VehicleClient"; + } + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("sVehicle = " + sVehicle); + } + if (sVehicle.indexOf("servlet") != -1 + || sVehicle.indexOf("connectorservlet") != -1 + || sVehicle.indexOf("customvehicle") != -1 + || sVehicle.indexOf("web") != -1 || sVehicle.indexOf("jsp") != -1 + || sVehicle.indexOf("jsf") != -1) { + try { + pTestProps.put("webServerHost", + propMgr.getProperty("webServerHost")); + pTestProps.put("webServerPort", + propMgr.getProperty("webServerPort")); + } catch (PropertyNotSetException e) { + e.printStackTrace(); + return Status.failed( + "Please supply values for webServerHost & webServerPort. They are required to run service tests in a jsp or servlet."); + } + } + + if (!sVehicle.equals("standalone") && !sVehicle.equals("ejbembed") + && !sVehicle.equals("customvehicle")) { + // only use the vehicle ear name in serviceeetest to create + // unique JNDI names and context roots. + // This is not used in the standalone TCK case + String vehicleArchiveName = getVehicleArchiveName(); + if (vehicleArchiveName == null) { + String msg = "TSScript: No vehicle ear found in : \"" + testDir + + "\". If this is a test that requires test clients" + + " to be built before executing the tests, please refer to" + + " the TCK documentation for further instructions."; + TestUtil.logErr(msg); + return Status.failed(msg); + } + pTestProps.put("vehicle_archive_name", vehicleArchiveName); + } + } else { + sVehicle = "not a service test"; + } + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("sVehicle = " + sVehicle); + } + + // if we are standalone (like JDBC ouside of J2EE, don't deploy) + // just run! + if (!sVehicle.equals("standalone")) { + // check the status of deployment + // which happened in the observer class + if (ss.getDeploymentStatus().equals("failed")) { + + System.err.println("*************test args = " + executeArgs); + // If we have a negative deployment test, and we fail deployment + // return PASS here. + if (executeArgs != null && executeArgs.contains("-expectdeploymentfailure")) { + logOut.println("Deployment failed as expected"); + return Status.passed("Deployment failed as expected"); + } else { + logOut.println(ss.getDeploymentExceptionTrace()); + return Status.failed( + "An error occurred during the Deployment phase for tests in this directory."); + } + } + sClientClassesPath = ss.getClientClassPath(); + } + // Set up the test-specific props file here and add it to the args + // that are passed to EETest + try { + sTestJteFile = createTestPropertyFile(pTestProps); + } catch (Exception e) { + return Status.failed("TSScript: Failed to create tstest.jte file"); + } + + // create args + // ADD ARGS FOR APPCLIENTCONTAINER + // -client $(SRC_DIR)$(SLASH)$(APP_NAME).ear -name $(APP_NAME)_client + // call SuiteSynchronizer.runAppclient which calls + // TSDeployment.runAppclient(executeargs + if (sVehicle.equals("not a service test")) { + if (executeArgs == null) { + executeArgs = "-p " + sTestJteFile + " -t " + testName; + } else { + executeArgs += " -p " + sTestJteFile + " -t " + testName; + } + } else { + if (executeArgs == null) { + executeArgs = "-p " + sTestJteFile + " -t " + testName + " -vehicle " + + sVehicle; + } else { + executeArgs = " -p " + sTestJteFile + " -t " + testName + " -vehicle " + + sVehicle + " " + executeArgs; + } + } + // props needed: + // args + // earfile + // testname + String sClientEar = getClientEarFile(); + // sClientEar should also come up null in the case that + // the vehicle is standalone (ktg 6-8-00) + + // In the case where we have special embedded ejb vehicle tests, + // we need to exec the special commandline from ts.jte + if (sVehicle.equalsIgnoreCase("ejbembed")) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testExecuteejbembed used"); + } + + pExecProps = new Properties(); + pExecProps.put("clientClasspath", TestUtil.srcToDist(testDir) + + File.separator + "ejbembed_vehicle_ejb.jar"); + status = execute("testExecuteEjbEmbed", executeClass, executeArgs); + } else if (sClientEar == null || sVehicle.equals("standalone") + || sVehicle.indexOf("customvehicle") != -1 + || sVehicle.indexOf("connectorservlet") != -1 + || sVehicle.indexOf("servlet") != -1 || sVehicle.indexOf("web") != -1 + || sVehicle.indexOf("jsp") != -1 || sVehicle.indexOf("jsf") != -1) { + // not an appclient test so run as usual + bAppClientTest = false; + + // Added to allow execution of standalone clients within the same JVM + // as the JavaTest harness. This mode can only be used when running + // the tests for sanity checking. + if (bUseSameJVMCommand) { + TestUtil.logHarness("Running test client in SameJVM mode"); + status = execute("testExecuteSameJVM", executeClass, executeArgs); + } else { + if (sInteropDirection.equals("reverse")) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testExecute2 used"); + } + status = execute("testExecute2", executeClass, executeArgs); + } else { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testExecute used"); + } + status = execute("testExecute", executeClass, executeArgs); + } + } + + } else { + bAppClientTest = true; + pExecProps = new Properties(); + pExecProps.put("executeArgs", executeArgs); + pExecProps.put("ear_file", sClientEar); + pExecProps.put("clientClasspath", sClientClassesPath); + + if (sClientEar.indexOf("_vehicles") != -1) { + pExecProps.put("client_name", + sClientEar.substring(sClientEar.lastIndexOf(File.separator) + 1, + sClientEar.indexOf("_vehicles")) + "_" + sVehicle + + "_vehicle_client"); + } else { + pExecProps.put("client_name", + sClientEar.substring(sClientEar.lastIndexOf(File.separator) + 1, + sClientEar.lastIndexOf(".")) + "_client"); + } + + // Added test classname for JCKService Tests + pExecProps.put("test_classname", executeClass); + TSDeploymentInterface ctsDeploy = null; + // Is our appclient contained in an ear that was deployed on + // server1 or server2? + if (sClientEar.indexOf("_j2ee2") != -1 + || sClientEar.startsWith("vi_built_")) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("ss.getTSDeployer = cts2"); + } + ctsDeploy = ss.getTSDeployer("cts2"); + } else { + // we should always get in here + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("ss.getTSDeployer = cts1"); + } + ctsDeploy = ss.getTSDeployer("cts1"); + } + if (sInteropDirection.equals("reverse")) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testExecuteAppClient2 used"); + } + status = execute("testExecuteAppClient2", + "this.is.specified.in.the.jte.file", + ctsDeploy.getAppClientArgs(pExecProps)); + } else { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testExecuteAppClient used"); + } + status = execute("testExecuteAppClient", + "this.is.specified.in.the.jte.file", + ctsDeploy.getAppClientArgs(pExecProps)); + } + } + } catch (ClassCastException e) { + e.printStackTrace(); + status = Status.failed("Can't load test: required interface not found"); + } catch (Exception e) { + status = Status.failed("Illegal access to test: " + e); + e.printStackTrace(); + } finally { + if (logOut != null) { + logOut.close(); + } + } + section.setStatus(status); + return status; + } + + private String getVehicleArchiveName() { + String[] sAppJarsArray = ProfileHelper + .getArchives(TestUtil.srcToDist(testDir), sInteropDirection); + if (sAppJarsArray == null) { + sAppJarsArray = TestUtil.EMPTY_STRING_ARRAY; + } + String vehicleName = null; + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testdir = " + testDir); + } + if (sIsServiceTest.equals("yes")) { + vehicleName = getVehicleArchiveName0(sAppJarsArray, ".ear"); + if (vehicleName == null) { + vehicleName = getVehicleArchiveName0(sAppJarsArray, ".war"); + } + if (vehicleName == null) { + vehicleName = getVehicleArchiveName0(sAppJarsArray, ".jar"); + } + } + return vehicleName; + } + + private String getVehicleArchiveName0(String[] archiveNames, + String archiveExt) { + String vehicleArchiveName = null; + for (int ii = 0; ii < archiveNames.length; ii++) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("archiveNames[ii] = " + archiveNames[ii]); + } + if ((archiveNames[ii].indexOf("_vehicles") != -1 + || archiveNames[ii].indexOf(sVehicle + "_vehicle") != -1) + && archiveNames[ii].endsWith(archiveExt)) { + + if (archiveNames[ii].startsWith("vi_built_")) { + // strip off the vi_built_ string since this is used by vehicle + // tests as the context root or jndi name and should + // not have the vi_built_ string on it + vehicleArchiveName = archiveNames[ii].substring(9, + archiveNames[ii].lastIndexOf(archiveExt)); + + } else { + vehicleArchiveName = archiveNames[ii].substring(0, + archiveNames[ii].lastIndexOf(archiveExt)); + } + + if (TestUtil.harnessDebug) { + TestUtil + .logHarnessDebug("vehicleArchiveName = " + vehicleArchiveName); + } + break; + } + } + return vehicleArchiveName; + } + + private String getClientEarFile() { + File fTestDir = new File(TestUtil.srcToDist(testDir)); + if (!fTestDir.exists()) { + return null; + } + String[] sAppJarsArray = ProfileHelper + .getArchives(TestUtil.srcToDist(testDir), sInteropDirection); + Enumeration entries = null; + String sEntry = null; + String sAppClientEar = null; + JarFile earFile = null; + String sRuntimeFileName = null; + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("testdir = " + testDir); + } + try { + for (int ii = 0; ii < sAppJarsArray.length + && sAppClientEar == null; ii++) { + + if ((bIsRebuildableReverseTest + && sAppJarsArray[ii].indexOf("vi_built_") == -1) + || (!bIsRebuildableReverseTest + && sAppJarsArray[ii].indexOf("vi_built_") != -1)) { + continue; + } + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "earFile = " + testDir + File.separator + sAppJarsArray[ii]); + } + + // if a service test, then first check that the ear + // ends in _ + if (sIsServiceTest.equals("yes")) { + if (sAppJarsArray[ii].indexOf("_vehicles") != -1 + || sAppJarsArray[ii].indexOf(sVehicle + "_vehicle") != -1) { + sAppClientEar = testDir + File.separator + sAppJarsArray[ii]; + break; + } + } else { + if (sAppJarsArray[ii].endsWith(".ear")) { + earFile = new JarFile(testDir + File.separator + sAppJarsArray[ii]); + entries = earFile.entries(); + while (entries.hasMoreElements()) { + sEntry = ((JarEntry) entries.nextElement()).getName(); + if (sEntry.indexOf("_client.jar") != -1) { + sAppClientEar = testDir + File.separator + sAppJarsArray[ii]; + break; + } + } + try { + if (earFile != null) { + earFile.close(); + } + earFile = null; + } catch (IOException ioe) { + ioe.printStackTrace(logOut); + } + } else { + if (sAppJarsArray[ii].endsWith("_client.jar")) { + sAppClientEar = testDir + File.separator + sAppJarsArray[ii]; + break; + } + } + } + } + } catch (IOException e) { + logOut.println("Error trying to read ear files"); + e.printStackTrace(); + } + return sAppClientEar; + } + + // Set up the test-specific props file here and add it to the args + // that are passed to EETest + private String createTestPropertyFile(java.util.Properties p) + throws Exception { + String sTestDir = p.getProperty("harness.temp.directory"); + File ctsTempDir = new File(sTestDir); + if (!ctsTempDir.exists()) { + if (!ctsTempDir.mkdirs()) { + throw new Exception( + "Failed to create the testsuite's temporary working directory: " + + sTestDir); + } + } + FileOutputStream propsOut = null; + String sJteFile = sTestDir + File.separator + "tstest.jte"; + try { + propsOut = new FileOutputStream(sJteFile); + p.store(propsOut, null); + return sJteFile; + } catch (Exception e) { + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug( + "createTestPropertyFile: An exception was thrown while trying to create the test property file"); + } + e.printStackTrace(logOut); + throw e; + } finally { + if (propsOut != null) { + propsOut.close(); + } + } + } + + private boolean isWindows() { + return Os.isFamily("windows"); + } + + private String formatPath(String classpath) { + + if (bIsRebuildableReverseTest) { + // replace classes with classes_vi_built + classpath = classpath.replace("classes", "classes_vi_built"); + } + + try { + String added = DeliverableFactory.getDeliverableInstance() + .getAdditionalClasspath(testDir); + + if (added != null) { + if (!added.startsWith(File.pathSeparator)) { + classpath += File.pathSeparator; + } + classpath += added; + } + } catch (Exception e) { + TestUtil.logHarness( + "Failed to get additional classpath for the following dist directory: " + + testDir); + } + + if (isWindows()) { + return org.apache.tools.ant.Project.translatePath(classpath); + } + return classpath; + } + + protected Status invokeCommand(String key) { + Status s = null; + try { + String[] command = env.lookup("command." + key); + String sClassPathFromExecProps = pExecProps.getProperty("clientClasspath", + sClientClassesPath); + TestUtil + .logHarness("sClassPathFromExecProps = " + sClassPathFromExecProps); + + for (int ii = 0; ii < command.length; ii++) { + if (isWindows() && command[ii].toUpperCase().startsWith("PATH=")) { + int iEqualsIndex = command[ii].indexOf("="); + String existingPath = command[ii].substring(iEqualsIndex + 1); + command[ii] = "PATH=" + Project.translatePath(existingPath); + } + + if (command[ii].startsWith("CLASSPATH=")) { + int iEqualsIndex = command[ii].indexOf("="); + String existingClassPath = command[ii].substring(iEqualsIndex + 1); + if (sVehicle.equals("ejbembed")) { + command[ii] = "CLASSPATH=" + formatPath(existingClassPath) + + File.pathSeparator + sClassPathFromExecProps; + } else { + command[ii] = "CLASSPATH=" + sClassPathFromExecProps + + File.pathSeparator + formatPath(existingClassPath); + } + + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("new classpath = " + command[ii]); + } + } + if (command[ii].equals("-classpath")) { + command[ii + 1] = formatPath(command[ii + 1]) + File.pathSeparator + + sClassPathFromExecProps; + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("new -classpath = " + command[ii]); + } + } + if (command[ii] + .startsWith("-Dcom.sun.enterprise.iiop.security.interceptorFactory") + && !testDir.contains("csiv2")) { + command[ii] = "-DNotInCSIV2=true"; + } + } + if (command.length == 0) { + return Status.error("environment `" + env.getName() + + "' does not define a command `" + key + "'"); + } + String className = command[0]; + String[] args = new String[command.length - 1]; + System.arraycopy(command, 1, args, 0, args.length); + String basic = "command: " + className + " " + StringArray.join(args); + section.getMessageWriter().println(basic); + s = invokeClass(className, args, logOut, logOut); + return s; + } catch (TestEnvironment.Fault e) { + return Status.error("problem getting info in environment `" + + env.getName() + "' for `command." + key + "'"); + } catch (Throwable t) { + t.printStackTrace(); + return Status.error( + "An unexpected error occured in TSScript's invokeCommand method" + + t.getMessage()); + } + } + + private Status invokeClass(String className, String[] args, + PrintWriter logOut, PrintWriter refOut) { + // this is the central place where we get to run what the user + // says in the environment file: + Command testCommand; + try { + Class c = Class.forName(className); + testCommand = (Command) (c.newInstance()); + } catch (ClassCastException e) { + return Status.error("Can't run class `" + className + + "': it does not implement interface " + Command.class.getName()); + } catch (ClassNotFoundException ex) { + return Status.error("Can't find class `" + className + "', used in `" + + env.getName() + "'"); + } catch (IllegalAccessException ex) { + return Status.error("Illegal access to class `" + className + + "', used in `" + env.getName() + "'"); + } catch (IllegalArgumentException ex) { + return Status.error("Bad class name `" + className + "', used in `" + + env.getName() + "'"); + } catch (InstantiationException ex) { + return Status.error("Can't instantiate class `" + className + + "', used in `" + env.getName() + "'"); + } catch (ThreadDeath e) { + throw (ThreadDeath) (e.fillInStackTrace()); + } catch (Exception e) { + e.printStackTrace(logOut); + return Status.error("Unexpected exception trying to load command `" + + className + "': " + e); + } catch (Error e) { + e.printStackTrace(logOut); + return Status.error( + "Unexpected error trying to load command `" + className + "': " + e); + } catch (Throwable e) { + e.printStackTrace(logOut); + return Status.error("Unexpected throwable trying to load command `" + + className + "': " + e); + } + try { + return testCommand.run(args, logOut, refOut); + } catch (ThreadDeath e) { + throw (ThreadDeath) (e.fillInStackTrace()); + } catch (Exception e) { + e.printStackTrace(logOut); + // error reduced to failed in following line for benefit of + // negative tests + return Status.failed("Unexpected exception while executing command " + + className + ": " + e); + } catch (Error e) { + e.printStackTrace(logOut); + // error reduced to failed in following line for benefit of + // negative tests + return Status.failed( + "Unexpected error while executing command " + className + ": " + e); + } catch (Throwable e) { + e.printStackTrace(logOut); + // error *NOT* reduced to failed in following line for benefit of + // negative tests: test should never throw something which is not + // an Exception or Error + return Status.error("Unexpected throwable while executing command " + + className + ": " + e); + } + } + + public static class ClassFilter implements FilenameFilter { + + private static ClassFilter instance = new ClassFilter(); + + private ClassFilter() { + } + + public static ClassFilter getInstance() { + return instance; + } + + public boolean accept(File dir, String name) { + return name.endsWith(".class"); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TSTestFinder.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSTestFinder.java new file mode 100644 index 0000000..5030a43 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TSTestFinder.java @@ -0,0 +1,655 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +import com.sun.javatest.TestDescription; +import com.sun.javatest.TestFinderQueue; +import com.sun.javatest.finder.CommentStream; +import com.sun.javatest.finder.TagTestFinder; +import com.sun.ts.lib.util.AssertionMapper; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.DeliverableFactory; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Vector; +import java.util.Enumeration; + +/** + * This is a specific implementation of the TagTestFinder which is to be used + * for J2EE-TS testing. + * + * A test description consists of a single block comment in Java files. A file + * may contain multiple test descriptions. + * + * @author Vella Raman + * @see com.sun.javatest.TestFinder + * @see com.sun.javatest.finder.TagTestFinder + */ +public class TSTestFinder extends TagTestFinder { + + public static final String TS_HOME; + + protected static final File[] NON_TEST_DIRS; + + protected static final String PARSE_TAG_BAD = "Invalid tag: "; + + private static final String INTEROP_FORWARD = "forward"; + + private static final String INTEROP_REVERSE = "reverse"; + + private static final String INTEROP_BOTH = "both"; + + private static final String SRC_TOKEN = File.separator + "src" + + File.separator; + + private static final String[] defaultVehicles = { "ejb", "servlet", "jsp", + "appclient" }; + + private static final String[] EXCLUDE_NAMES = { "SCCS", "Codemgr_wsdata", + "DeletedFiles", "DELETED-FILES", "deleted_files", "TemporarilyRemoved", + "ts_dep" }; + + private static final String KEY_CLASS_SETUP_PROPS = "class.setup_props:"; + + private static final String KEY_CLASS_TEST_ARGS = "class.testArgs:"; + + private static final String KEY_TEST_NAME = "testName:"; + + private static final String KEY_TEST_ARGS = "testArgs:"; + + private static final String KEY_CUSTOM = "custom:"; + + private static final String KEY_TEST_CASE_SETUP_PROPS = "tcase.setup_props:"; + + private static final String KEY_ASSERTION_IDS = "assertion_ids:"; + + private static final String KEY_KEYWORDS = "keywords:"; + + private static final String[] VALID_TAG_NAMES = { KEY_CLASS_SETUP_PROPS, + KEY_CLASS_TEST_ARGS, KEY_TEST_NAME, KEY_TEST_ARGS, KEY_CUSTOM, + KEY_TEST_CASE_SETUP_PROPS, KEY_ASSERTION_IDS, KEY_KEYWORDS }; + + private static final boolean PROCESS_ASSERTION; + + private static final boolean REPORT_MISSING; + + private static final boolean ASSERTION_COVERAGE; + + static { + TS_HOME = System.getProperty("TS_HOME"); + PROCESS_ASSERTION = Boolean.getBoolean("process.assertion"); + REPORT_MISSING = Boolean.getBoolean("report.missing.assertion.ids.tag"); + ASSERTION_COVERAGE = Boolean.getBoolean("assertion.coverage"); + + NON_TEST_DIRS = new File[] { new File(TS_HOME, "src/web"), + new File(TS_HOME, "src/org/omg/stub"), + new File(TS_HOME, "src/com/sun/ts/lib"), + new File(TS_HOME, "src/com/sun/ts/tests/common") }; + + } + + protected boolean bJCKServiceTest; + + protected String sInteropDirections = "forward"; + + protected File appTestDir; + + private static TSKeywords tsKeywords; + + private VehicleVerifier vehicleVerifier; + + private boolean fastScan; + + private int iNumberOfAssertions = 0; + + private String sClass = ""; + + private int executionMode = ExecutionMode.DEFAULT; + + public static Hashtable htTestNamesFound = new Hashtable(); + + // ---------------------------------------------------------------- + // Constructors + + /** + * Constructs the list of file names to exclude for pruning in the search for + * files to examine for test descriptions. This constructor also sets the + * allowable comment formats. + */ + public TSTestFinder() { + super(); + Arrays.sort(VALID_TAG_NAMES); + exclude(EXCLUDE_NAMES); + setInitialTag(null); + + try { + PropertyManagerInterface propMgr = DeliverableFactory + .getDeliverableInstance().getPropertyManager(); + executionMode = ExecutionMode.getExecutionMode(propMgr); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Scan a file, looking for test descriptions and/or more files to scan. + * Overwrite to filter out directories that do not contain any tests. + * + * @param file + * The file to scan + */ + public void scan(File file) { + for (int i = 0; i < NON_TEST_DIRS.length; i++) { + if (file.compareTo(NON_TEST_DIRS[i]) == 0) { + return; + } + } + super.scan(file); + } + + public static String getAbsolutePath(String testRootPath, String path) { + return new File(testRootPath, path).getAbsolutePath(); + } + + public static String getAbsolutePath(String path) { + return getAbsolutePath(TS_HOME + "/src", path); + } + + public static void main(String[] argv) { + String sRoot = null; + Vector vTestDescriptions = new Vector(); + TestDescription td = null; + for (int ii = 0; ii < argv.length; ii++) { + if (argv[ii].startsWith("-rootdir")) { + sRoot = argv[++ii]; + } else { + TestUtil.logHarness("Must supply a rootdir"); + System.exit(-1); + } + } + TestFinderQueue tfq = new TestFinderQueue(); + TSTestFinder tf = new TSTestFinder(); + try { + tf.init(TestUtil.EMPTY_STRING_ARRAY, new File(sRoot), null); + tfq.setTestFinder(tf); + tfq.setTests(new String[] { sRoot }); + } catch (Exception e) { + TestUtil.logHarness("Exception initializing the TestFinder"); + e.printStackTrace(); + } + while ((td = tfq.next()) != null) { + vTestDescriptions.addElement(td); + } + // write all test description info to a file + try { + tf.writeToFile(vTestDescriptions); + TestUtil.logHarness("Total # of Assertions = " + tf.iNumberOfAssertions); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Make sure that the provide name-value pair is of the proper format as + * described in the tag-spec. + * + * @param tagValues + * The dictionary of the entries being read + * @param name + * The name of the entry that has been read + * @param value + * The value of the entry that has been read + */ + protected void processEntry(Map tagValues, String name, String value) { + if (Arrays.binarySearch(VALID_TAG_NAMES, name) < 0) { + name = "error"; + value = PARSE_TAG_BAD + name; + } + super.processEntry(tagValues, name, value); + } + + /** + * Override the scan method in TagTestFinder since we have to deal with + * CommentStreams that are valid test tags ( but not a test description object + * of themselves -- the class.setup_props tag ). + * + * @param file + * The file to scan + */ + protected void scanFile(File file) { + String name = file.getName(); + + // Return immediately if we don't have a java source file + // or we have a java file that we know we don't want to scan + if (!name.endsWith(".java") || name.equals("BaseUIComponentClient.java") + || name.equals("DataModelURLClient.java")) { + return; + } + + int dot = name.indexOf('.'); + if (dot == 0) + return; + if (TestUtil.harnessDebug) + TestUtil.logHarnessDebug("Scanning " + name); + String sVal = null; + String extn = name.substring(dot); + Class csc = getClassForExtension(extn); + if (csc == null) { + String[] msgs = { "no parser found for specified file", "file: " + file, + "extension: " + extn }; + TestUtil.logErr(msgs[0] + msgs[1] + msgs[2]); + return; + } + CommentStream cs = null; + try { + cs = (CommentStream) (csc.newInstance()); + } catch (InstantiationException e) { + String[] msgs = { "problem instantiating class for extension", + "extension: " + extn, "class: " + csc.getName() }; + TestUtil.logErr(msgs[0] + msgs[1] + msgs[2]); + return; + } catch (IllegalAccessException e) { + String[] msgs = { + "illegal access while instantiating class for extension", + "extension: " + extn, "class: " + csc.getName() }; + TestUtil.logErr(msgs[0] + msgs[1] + msgs[2]); + return; + } + try { + cs.init(new BufferedReader(new FileReader(file))); + if (fastScan) + cs.setFastScan(true); + Map propTags = new Hashtable(); + String comment; + + while ((comment = cs.readComment()) != null) { + Map myTagValues = parseComment(comment, file); + if (myTagValues.isEmpty()) { + continue; + } + if (myTagValues.containsKey(KEY_CLASS_SETUP_PROPS) + || myTagValues.containsKey(KEY_CLASS_TEST_ARGS)) { + propTags = myTagValues; + } else if (myTagValues.containsKey(KEY_TEST_NAME)) { + // add the directory that this file is located in, so + // we can use it later to deploy the jar + myTagValues.put("testdirectory", file.getPath()); + if (!propTags.isEmpty()) { + sVal = (String) propTags.get(KEY_CLASS_SETUP_PROPS); + if (sVal != null) { + myTagValues.put(KEY_CLASS_SETUP_PROPS, sVal); + } + sVal = (String) propTags.get(KEY_CLASS_TEST_ARGS); + if (sVal != null) { + myTagValues.put(KEY_CLASS_TEST_ARGS, sVal); + } + } + foundTestDescription(myTagValues, file, 0); + } + } + } catch (FileNotFoundException e) { + String msgs = "can't find file " + file.getPath(); + e.printStackTrace(); + TestUtil.logErr(msgs); + } catch (IOException e) { + String msgs = "problem reading file " + file.getPath(); + e.printStackTrace(); + TestUtil.logErr(msgs); + error(null, msgs); + } catch (Throwable e) { + String msgs = "got exception: problem reading file " + file.getPath(); + e.printStackTrace(); + TestUtil.logErr(msgs); + } finally { + try { + if (cs != null) + cs.close(); + } catch (IOException e) { + TestUtil.logErr(e.getMessage()); + } + } + } + + protected void foundTestDescription(Map entries, File file, int line) { + String[] sVal = null; + TestDescription td = null; + if (!entries.isEmpty()) { + vehicleVerifier = VehicleVerifier.getInstance(file, + (String) entries.get(KEY_TEST_NAME)); + sVal = vehicleVerifier.getVehicleSet(); + if (sVal.length > 0) { + for (int ii = 0; ii < sVal.length; ii++) { + if (sInteropDirections.equals(INTEROP_FORWARD) + || sInteropDirections.equals(INTEROP_BOTH)) { + // create 1 desc for each vehicle to be tested + td = createTestDescription(entries, file, sVal[ii].trim(), false); + foundTestDescription(td); + } + if (sInteropDirections.equals(INTEROP_REVERSE) + || sInteropDirections.equals(INTEROP_BOTH)) { + // create 1 desc for each vehicle to be tested + td = createTestDescription(entries, file, sVal[ii].trim(), true); + foundTestDescription(td); + } + } + } else { + if (sInteropDirections.equals(INTEROP_FORWARD) + || sInteropDirections.equals(INTEROP_BOTH)) { + td = createTestDescription(entries, file, null, false); + foundTestDescription(td); + } + if (sInteropDirections.equals(INTEROP_REVERSE) + || sInteropDirections.equals(INTEROP_BOTH)) { + td = createTestDescription(entries, file, null, true); + foundTestDescription(td); + } + } + } + } + + private void writeToFile(Vector v) throws IOException { + TestDescription td = null; + FileWriter fw = new FileWriter("test_report.txt"); + int iSize = v.size(); + for (int ii = 0; ii < iSize; ii++) { + td = (TestDescription) v.elementAt(ii); + writeTest(td, fw); + } + fw.close(); + } + + private void writeTest(TestDescription td, FileWriter fw) throws IOException { + String sName = td.getParameter("testName"); + String sAssertion = td.getParameter("assertion_ids"); + String sLastClass = sClass; + sClass = td.getParameter("classname"); + sClass = sClass.substring(0, sClass.lastIndexOf('.')); + if (!sClass.equals(sLastClass)) { + fw.write(sClass + "\tTests" + TestUtil.NEW_LINE + TestUtil.NEW_LINE); + } + fw.write("Test:\t" + sName + TestUtil.NEW_LINE); + fw.write("Assertion:\t" + sAssertion + TestUtil.NEW_LINE); + fw.write(TestUtil.NEW_LINE); + iNumberOfAssertions++; + } + + private String[] getDefaultVehicles() { + return defaultVehicles; + } + + private TestDescription createTestDescription(Map tags, File file, + String sVehicle, boolean bReverse) { + Vector propv = new Vector(); + String sval = null; + String fn = file.getName(); + String key = null; + String cls = fn.substring(0, fn.indexOf('.')); + String fullclass = getPkgName(file) + '.' + cls; + Hashtable desc = new Hashtable(); + desc.put("classname", fullclass); + String test_dir = null; + if (bJCKServiceTest) { + // to id this description as a jckservicetest one + desc.put("finder", "jck"); + test_dir = appTestDir.getAbsolutePath(); + } else { + // to id this description as a cts one + desc.put("finder", "cts"); + test_dir = file.getParent(); + } + desc.put("test_directory", TestUtil.getRelativePath(test_dir)); + for (Iterator e = tags.keySet().iterator(); e.hasNext();) { + key = ((String) e.next()); + + if ((key.equals(KEY_TEST_NAME))) { + sval = (String) tags.get(key); + if (sval != null) + sval = sval.trim(); + + if (htTestNamesFound + .containsKey((String) (file.getPath() + "#" + sval))) { + // TestUtil.logHarness("Found duplicate @testName declaration: " + + // sval); + // TestUtil.logHarness("Located in source file: " + file.getName()); + Integer iCount = (Integer) (htTestNamesFound + .get((String) (file.getPath() + "#" + sval))); + htTestNamesFound.put((String) (file.getPath() + "#" + sval), + new Integer((iCount.intValue()) + 1)); + } else { + htTestNamesFound.put((String) (file.getPath() + "#" + sval), + new Integer(1)); + } + + if (sVehicle != null) { + sval += "_from_" + sVehicle; + desc.put("service_eetest", "yes"); + } else { + desc.put("service_eetest", "no"); + } + if (bReverse) { + sval += '_' + "reverse"; + desc.put("direction", INTEROP_REVERSE); + } else { + desc.put("direction", INTEROP_FORWARD); + } + desc.put("id", sval); + } + if ((key.equals(KEY_TEST_NAME)) || (key.equals(KEY_CUSTOM))) { + sval = (String) tags.get(key); + if (sval != null) + sval = sval.trim(); + key = key.substring(0, key.indexOf(':')); + desc.put(key, sval); + } else if (key.equals(KEY_ASSERTION_IDS) && PROCESS_ASSERTION) { + sval = (String) tags.get(key); + if (sval != null) + sval = sval.trim(); + key = key.substring(0, key.indexOf(':')); + if (ASSERTION_COVERAGE) { + // use the original value as specified in source code for coverage + // tool + desc.put(key, sval); + } else { + desc.put(key, AssertionMapper.getAssertionDescriptions(sval, file)); + } + } else if ((key.equals(KEY_CLASS_TEST_ARGS)) + || (key.equals(KEY_TEST_ARGS))) { + String sCurrentArgs = (String) desc.get("testArgs"); + sval = (String) tags.get(key); + if (sval == null) + continue; + sval = sval.trim(); + key = key.substring(0, key.indexOf(':')); + if (sCurrentArgs == null) + desc.put("testArgs", sval); + else + desc.put("testArgs", sCurrentArgs + " " + sval); + } else if ((key.equals(KEY_KEYWORDS))) { + sval = (String) tags.get(key); + if (sval != null) { + sval = sval.trim(); + } + key = key.substring(0, key.indexOf(':')); + + desc.put(key, sval); + } + if ((key.equals(KEY_CLASS_SETUP_PROPS)) + || (key.equals(KEY_TEST_CASE_SETUP_PROPS))) { + sval = (String) tags.get(key); + TestUtil + .logHarnessDebug("KEY_TEST_CASE_SETUP_PROPS sval \"" + sval + "\""); + if (sval == null) + continue; + sval = sval.trim(); + // if there is no final semi-colon add one to avoid the hang + if (!sval.endsWith(";")) { + sval = sval + ";"; + } + TestUtil.logHarnessDebug( + "KEY_TEST_CASE_SETUP_PROPS normalized sval \"" + sval + "\""); + int sl = sval.length() - 1; + int start = 0; + int count = 1; + int sep = 0; + int sep2 = 0; + while (count < sl) { + sep = sval.indexOf(';'); + if (sep != -1) { + String propdesc = sval.substring(start, sep); + sval = sval.substring(sep + 1); + // remove description (if there is a ',' in our string) + // we only want property names + if ((sep2 = propdesc.indexOf(',')) != -1) + propdesc = propdesc.substring(0, sep2); + propv.addElement(propdesc); + count += sep + 1; + } else { + continue; + } + } + } + + // Put properties as space separated String.. + String s1 = ""; + for (int j = 0, size = propv.size(); j < size; j++) + s1 = s1 + ' ' + propv.elementAt(j); + desc.put("testProps", s1); + } + + // add in inherent keywords here + String sKeywords = (String) desc.get("keywords"); + + if (sKeywords != null) { + sKeywords = sval.trim() + " " + sKeywords; + sKeywords += " "; + } else { + sKeywords = ""; + } + + // default keyword for all tests not containing keywords in the src tags + sKeywords += "all "; + + // Get keywords from keyword.properties file + tsKeywords = TSKeywords.getInstance(file); + String[] sKeywordsFromProperties = tsKeywords.getKeywordSet(); + + for (int ii = 0; ii < sKeywordsFromProperties.length; ii++) { + + // For any technologies that may be run on a web profile impl, + // only attach the javaee_web_profile or _web_profile keywords + // if + // the vehicle in use for the test is required by a web profile impl. + if (sKeywordsFromProperties[ii].contains("web_profile") + && sVehicle != null) { + if ((sVehicle.contains("web") || sVehicle.contains("servlet") + || sVehicle.contains("jsp") || sVehicle.contains("ejbembed") + || sVehicle.contains("ejblite") || sVehicle.contains("jsf")) + && !sVehicle.contains("puservlet")) { + sKeywords += sKeywordsFromProperties[ii] + " "; + } + } else { + sKeywords += sKeywordsFromProperties[ii] + " "; + } + } + + // Add test name as a keyword. This allows you to specify a test name as + // a keyword to subset tests. Useful if you have a bunch of leaf + // directories containing the same test names and you want to run just + // those tests from each dir in a single run. + sKeywords += desc.get("testName") + " "; + + // Add the vehicle as a standlone keyword. This is useful + // if you want to use expressions when specifying keywords like the + // following... javaee.webprofile | connector & web.vehicle + if (sVehicle != null) { + sKeywords += sVehicle + "_vehicle "; + } else { + sKeywords += "novehicle "; + } + + // add keywords for forward and reverse tests + if (bReverse) { + sKeywords += "reverse"; + } else { + sKeywords += "forward"; + } + desc.put("keywords", sKeywords); + + // Print out the keywords for this test description + TestUtil.logHarnessDebug("Keywords for this test, " + + (String) tags.get(KEY_TEST_NAME) + ", are: " + sKeywords); + + if (REPORT_MISSING && !desc.containsKey("assertion_ids")) { + AssertionMapper.log("WARN: missing assertion_ids tag in testName " + + desc.get("testName") + " in file " + file.getPath()); + } + File root = this.getRoot(); + return new TestDescription(root, file, desc); + } + + private String getPkgName(File clientFile) { + String result = null; + String clientFileDir = clientFile.getParent(); + int i = clientFileDir.indexOf(TSTestFinder.SRC_TOKEN); + if (i != -1) { + result = clientFileDir.substring(i + 5); + result = result.replace(File.separatorChar, '.'); + } else { + result = getPkgName2(clientFile); + } + + return result; + } + + private String getPkgName2(File tfile) { + String pkgName = null; + String line = null; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(tfile)); + while ((line = br.readLine()) != null) { + line = line.trim(); + if (line.length() > 0 && line.startsWith("package") + && line.endsWith(";")) { + int pkgstart = line.indexOf(' '); + pkgName = line.substring(pkgstart, line.indexOf(';')); + return pkgName.trim(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (br != null) { + try { + br.close(); + } catch (Exception except) { + } + } + } + return pkgName; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/TestRunException.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/TestRunException.java new file mode 100644 index 0000000..9a36647 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/TestRunException.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.harness; + +/** + * This class defines any exception thrown by the Regression extensions. + * + * @author Iris A Garcia + * @version @(#)TestRunException.java 1.2 99/03/15 + */ +public class TestRunException extends RuntimeException { + private static final long serialVersionUID = -9119523505446607510L; + + public TestRunException(String msg) { + super(msg); + } // TestRunException() + + public TestRunException(Throwable t) { + super(t.getMessage(), t); + } // TestRunException() + + public Throwable getThrowable() { + return getCause(); + } // getThrowable() +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/VehicleVerifier.java b/tck/old-tck/source/src/com/sun/ts/lib/harness/VehicleVerifier.java new file mode 100644 index 0000000..dcd110d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/VehicleVerifier.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.harness; + +import com.sun.ts.lib.util.*; +import java.util.*; +import java.io.*; + +/** + * This class is used by the TS harness to figure out which vehicles are to be + * used by the Service tests in the TS. These defaults can be overridden by + * editing appropriate properties file. However, this override mechanism is only + * to be used for debugging purposes. When testing for J2EE certification, the + * defaults specified in this class must be used. + * + * A singleton class not intended for concurrent access. + * + * @author Kyle Grucci + */ +public class VehicleVerifier { + public final static String VEHICLE_PROP_FILE_NAME = "vehicle.properties"; + + public final static String EXCLUDE_KEY = "exclude.dir"; + + private static Properties mapping; + + private static String[] keys; // sorted ascending + + private static String[] excludes; + + private String relativeTestDir; + + private String testName; + + private static boolean loaded; + + // an uninitialized singleton instance + private static VehicleVerifier instance = new VehicleVerifier(); + + private VehicleVerifier() { + } + + public static VehicleVerifier getInstance(File path) { + if (instance == null) { + instance = new VehicleVerifier(); + } + instance.init(path, null); + return instance; + } + + public static VehicleVerifier getInstance(File path, String sTestName) { + if (instance == null) { + instance = new VehicleVerifier(); + } + instance.init(path, sTestName); + return instance; + } + + private void loadExcludes() { + if (this.mapping == null) { + excludes = TestUtil.EMPTY_STRING_ARRAY; + } else { + excludes = ConfigUtil.stringToArray((String) mapping.remove(EXCLUDE_KEY)); + } + } + + private void init(File file, String sTest) { + if (!loaded) { + mapping = ConfigUtil.loadPropertiesFor(VEHICLE_PROP_FILE_NAME); + loadExcludes(); + keys = ConfigUtil.loadKeysFrom(mapping); + loaded = true; + } + testName = sTest; + if (mapping != null) { + this.relativeTestDir = TestUtil.getRelativePath(file.getPath()); + if (testName != null) { + this.relativeTestDir += "#" + testName; + TestUtil.logHarnessDebug( + "VehicleVerifier.init: relative dir = " + this.relativeTestDir); + + } + } + // if mapping is null, it means this tck uses no vehicles and + // vehicle.properties + // does not exist. So don't bother to convert testDir to relative path. + } + + private boolean isExcluded() { + for (int i = 0; i < excludes.length; i++) { + if (relativeTestDir.startsWith(excludes[i])) { + TestUtil.logHarnessDebug( + "VehicleVerifier: This test dir is excluded from those listed in vehicle.properties."); + TestUtil.logHarnessDebug( + "VehicleVerifier: Please check your exclude list in the vehicle.properties file."); + return true; + } + } + return false; + } + + /** + * This method gets the current set of vehicles to be used for a given + * directory path. + * + * @return a String array of the vehicles that this test should be run in + */ + public String[] getVehicleSet() { + if (mapping == null || keys == null) { + return TestUtil.EMPTY_STRING_ARRAY; + } + if (isExcluded()) { + return TestUtil.EMPTY_STRING_ARRAY; + } + String[] result = ConfigUtil.getMappingValue(this.mapping, this.keys, + this.relativeTestDir); + return result; + } + + public static void main(String args[]) { + File testDir = null; + if (args.length == 0) { + testDir = new File(System.getProperty("user.dir")); + } else { + testDir = new File(args[0]); + } + VehicleVerifier ver = VehicleVerifier.getInstance(testDir); + String[] result = ver.getVehicleSet(); + System.out + .println(testDir.getPath() + " : " + Arrays.asList(result).toString()); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/commonarchives.properties b/tck/old-tck/source/src/com/sun/ts/lib/harness/commonarchives.properties new file mode 100644 index 0000000..fdef867 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/commonarchives.properties @@ -0,0 +1,183 @@ +# +# Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +#tx session tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/session=com/sun/ts/tests/ejb/ee/tx/txbean + +#tx entity tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/entity/bmp=com/sun/ts/tests/ejb/ee/tx/txEbean + +#tx entity cmp tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/entity/cmp=com/sun/ts/tests/ejb/ee/tx/txECMPbean + +#tx EPMBean tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/entity/pm=com/sun/ts/tests/ejb/ee/tx/txEPMbean + +#Adding the connector sub dirs explicitly as deployment directory +#does not require deployment of standalone connector. +commonarchives.com/sun/ts/tests/connector/localTx/msginflow=com/sun/ts/tests/connector/mdb + +#ejbql tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/pm/ejbql=com/sun/ts/tests/ejb/ee/pm/ejbql/schema + +#multi server multi/database tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMS_Direct=com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanA com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanB com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanC +commonarchives.com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMS_Indirect=com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanA com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanB com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBMSBeans/BeanC + +#single server multi/database tests' common apps +commonarchives.com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSS_Direct=com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanA com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanB com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanC +commonarchives.com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSS_Indirect=com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanA com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanB com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxMDBSSBeans/BeanC + +# jaxws common apps +commonarchives.com/sun/ts/tests/jaxws/ee/w2j/document/literal/asynctest/client=com/sun/ts/tests/jaxws/ee/w2j/document/literal/asynctest/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/rpc/literal/nosei/client=com/sun/ts/tests/jaxws/ee/j2w/rpc/literal/nosei/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/document/literal/nosei/client=com/sun/ts/tests/jaxws/ee/j2w/document/literal/nosei/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/document/literal/marshalltest/client=com/sun/ts/tests/jaxws/ee/j2w/document/literal/marshalltest/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/document/literal/sessionmaintaintest/client=com/sun/ts/tests/jaxws/ee/j2w/document/literal/sessionmaintaintest/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/document/literal/restful/client=com/sun/ts/tests/jaxws/ee/j2w/document/literal/restful/server + +commonarchives.com/sun/ts/tests/jaxws/ee/j2w/document/literal/webmethod/client=com/sun/ts/tests/jaxws/ee/j2w/document/literal/webmethod/server + + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws=com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + +commonarchives.com/sun/ts/tests/jaxws/wsi/j2w=com/sun/ts/tests/jaxws/sharedwebservices/doclitservice com/sun/ts/tests/jaxws/sharedwebservices/faultservice com/sun/ts/tests/jaxws/sharedwebservices/rpclitservice com/sun/ts/tests/jaxws/sharedwebservices/simpleservice + +commonarchives.com/sun/ts/tests/jaxws/wsi/w2j/rpc/literal/R1015=com/sun/ts/tests/jaxws/sharedwebservices/simpleservice + +commonarchives.com/sun/ts/tests/jaxws/wsi/w2j/rpc/literal/R2105=com/sun/ts/tests/jaxws/sharedwebservices/rpclitservice + +commonarchives.com/sun/ts/tests/jaxws/ee/w2j/rpc/literal/handlertest=com/sun/ts/tests/jaxws/sharedwebservices/rlhandlerservice + +commonarchives.com/sun/ts/tests/jaxws/ee/w2j/rpc/literal/onewayhandlertest/client=com/sun/ts/tests/jaxws/ee/w2j/rpc/literal/onewayhandlertest/server + +commonarchives.com/sun/ts/tests/jaxws/ee/w2j/document/literal/onewayhandlertest/client=com/sun/ts/tests/jaxws/ee/w2j/document/literal/onewayhandlertest/server + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws_handler=com/sun/ts/tests/jaxws/sharedwebservices/dlhandlerservice com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws_handler_soap=com/sun/ts/tests/jaxws/sharedwebservices/dlhandlerservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws/Binding=com/sun/ts/tests/jaxws/sharedwebservices/dlhandlerservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws/BindingProvider=com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws_wsaddressing=com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws/Provider=com/sun/ts/tests/jaxws/sharedwebservices/dlhelloproviderservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws/LogicalMessage=com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws/WebServiceContext=com/sun/ts/tests/jaxws/sharedwebservices/hellosecureservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws_http/HTTPBinding=com/sun/ts/tests/jaxws/sharedwebservices/xmlbinddlhelloproviderservice + +commonarchives.com/sun/ts/tests/jaxws/api/jakarta_xml_ws_soap/SOAPBinding=com/sun/ts/tests/jaxws/sharedwebservices/doclithelloservice + +# servlet common app +commonarchives.com/sun/ts/tests/servlet/spec/annotation/webserviceref=com/sun/ts/tests/servlet/common/sharedwebservices/servlethttptestservice + + +# jws common app +commonarchives.com/sun/ts/tests/jws/handlerchain/client=com/sun/ts/tests/jws/handlerchain/server + +commonarchives.com/sun/ts/tests/jws/oneway/client=com/sun/ts/tests/jws/oneway/server + +commonarchives.com/sun/ts/tests/jws/webmethod/webmethod1/client=com/sun/ts/tests/jws/webmethod/webmethod1/server + +commonarchives.com/sun/ts/tests/jws/webmethod/webmethod2/client=com/sun/ts/tests/jws/webmethod/webmethod2/server + +commonarchives.com/sun/ts/tests/jws/webmethod/webmethod3/client=com/sun/ts/tests/jws/webmethod/webmethod3/server + +commonarchives.com/sun/ts/tests/jws/webparam/webparam1/client=com/sun/ts/tests/jws/webparam/webparam1/server + +commonarchives.com/sun/ts/tests/jws/webparam/webparam2/client=com/sun/ts/tests/jws/webparam/webparam2/server + +commonarchives.com/sun/ts/tests/jws/webparam/webparam3/client=com/sun/ts/tests/jws/webparam/webparam3/server + +commonarchives.com/sun/ts/tests/jws/webresult/webresult1/client=com/sun/ts/tests/jws/webresult/webresult1/server + +commonarchives.com/sun/ts/tests/jws/webresult/webresult2/client=com/sun/ts/tests/jws/webresult/webresult2/server + +commonarchives.com/sun/ts/tests/jws/webresult/webresult3/client=com/sun/ts/tests/jws/webresult/webresult3/server + +commonarchives.com/sun/ts/tests/jws/webservice/webservice1/client=com/sun/ts/tests/jws/webservice/webservice1/server + +commonarchives.com/sun/ts/tests/jws/webservice/webservice2/client=com/sun/ts/tests/jws/webservice/webservice2/server + +commonarchives.com/sun/ts/tests/jws/webservice/webservice3/client=com/sun/ts/tests/jws/webservice/webservice3/server + +commonarchives.com/sun/ts/tests/jws/webservice/webservice4/client=com/sun/ts/tests/jws/webservice/webservice4/server + +# jacc common app +commonarchives.com/sun/ts/tests/jacc=com/sun/ts/tests/jacc/util + +commonarchives.com/sun/ts/tests/jaxp/tck_source/commonarchives.com/sun/ts/tests/api/xml_schema=com/sun/ts/tests/jaxp/api/xml_schema + +# webservices12 common apps +commonarchives.com/sun/ts/tests/webservices12/ejb/annotations/WSEjbAsyncTest/client=com/sun/ts/tests/webservices12/ejb/annotations/WSEjbAsyncTest/server + +commonarchives.com/sun/ts/tests/webservices12/specialcases/clients/j2w/doclit/nameattrserviceref=com/sun/ts/tests/webservices12/specialcases/services/j2w/doclit/noname2 + +commonarchives.com/sun/ts/tests/webservices12/specialcases/clients/j2w/doclit/defaultserviceref=com/sun/ts/tests/webservices12/specialcases/services/j2w/doclit/noname + +commonarchives.com/sun/ts/tests/webservices12/specialcases/clients/j2w/doclit/providerserviceref=com/sun/ts/tests/webservices12/specialcases/services/w2j/doclit/provider + +# webservices12/servlet/WebServiceRefsTest/client common app +commonarchives.com/sun/ts/tests/webservices12/servlet/WebServiceRefsTest/client=com/sun/ts/tests/webservices12/servlet/WebServiceRefsTest/server1 com/sun/ts/tests/webservices12/servlet/WebServiceRefsTest/server2 + +# webservices12/servlet/HandlerTest/client common app +commonarchives.com/sun/ts/tests/webservices12/servlet/HandlerTest/client=com/sun/ts/tests/webservices12/servlet/HandlerTest/server + +# webservices12/ejb/annotations/HandlerTest/client common app +commonarchives.com/sun/ts/tests/webservices12/ejb/annotations/HandlerTest/client=com/sun/ts/tests/webservices12/ejb/annotations/HandlerTest/server + +# webservices12/wsdlImport/file client common app +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/shared1/client=com/sun/ts/tests/webservices12/wsdlImport/file/shared1/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/shared2/client=com/sun/ts/tests/webservices12/wsdlImport/file/shared2/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/shared3/client=com/sun/ts/tests/webservices12/wsdlImport/file/shared3/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/shared4/client=com/sun/ts/tests/webservices12/wsdlImport/file/shared4/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/twin1/client=com/sun/ts/tests/webservices12/wsdlImport/file/twin1/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/twin2/client=com/sun/ts/tests/webservices12/wsdlImport/file/twin2/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/twin3/client=com/sun/ts/tests/webservices12/wsdlImport/file/twin3/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/file/twin4/client=com/sun/ts/tests/webservices12/wsdlImport/file/twin4/server + + +# webservices12/wsdlImport/http client common app +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/shared1/client=com/sun/ts/tests/webservices12/wsdlImport/http/shared1/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/shared2/client=com/sun/ts/tests/webservices12/wsdlImport/http/shared2/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/shared3/client=com/sun/ts/tests/webservices12/wsdlImport/http/shared3/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/shared4/client=com/sun/ts/tests/webservices12/wsdlImport/http/shared4/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/twin1/client=com/sun/ts/tests/webservices12/wsdlImport/http/twin1/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/twin2/client=com/sun/ts/tests/webservices12/wsdlImport/http/twin2/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/twin3/client=com/sun/ts/tests/webservices12/wsdlImport/http/twin3/server +commonarchives.com/sun/ts/tests/webservices12/wsdlImport/http/twin4/client=com/sun/ts/tests/webservices12/wsdlImport/http/twin4/server + +# webservices13/servlet/WSWebServiceRefLookup client common app +commonarchives.com/sun/ts/tests/webservices13/servlet/WSWebServiceRefLookup/client=com/sun/ts/tests/webservices13/servlet/WSWebServiceRefLookup/server + +# webservices13/servlet/WSWebServiceRefLookupDDs client common app +commonarchives.com/sun/ts/tests/webservices13/servlet/WSWebServiceRefLookupDDs/client=com/sun/ts/tests/webservices13/servlet/WSWebServiceRefLookupDDs/server + +#ejb30 common app +commonarchives.com/sun/ts/tests/ejb30/assembly=com/sun/ts/tests/ejb30/common/helloejbjar +commonarchives.com/sun/ts/tests/ejb30/misc/jndi/earjar=com/sun/ts/tests/ejb30/common/helloejbjar + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/finder.properties b/tck/old-tck/source/src/com/sun/ts/lib/harness/finder.properties new file mode 100644 index 0000000..dbd03c0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/finder.properties @@ -0,0 +1,34 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# Properties file for ChameleonTestFinder. +# Test finders are chosen according to the following rules: +# 1, If testsuite.jtd is present in test root directory, com.sun.javatest. +# finder.BinaryTestFinder is used, and this file is ignored; +# 2, If finder.properties or map.jtc is present in test root directory, +# ChameleonTestFinder is used, which is +# initialized with this file; +# 3, Otherwise, com.sun.ts.lib.harness.TSTestFinder is used. +# +# The default finder, com.sun.ts.lib.harness.TSTestFinder, will be used +# for all test areas that do not have an entry below. Do not add entries +# unless your test areas require a different finder. +# +# Key and value should be separated by a spece or multiple spaces +# + +com/*.java com.sun.ts.lib.harness.TSTestFinder + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/keyword.properties b/tck/old-tck/source/src/com/sun/ts/lib/harness/keyword.properties new file mode 100644 index 0000000..edc78c4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/keyword.properties @@ -0,0 +1,587 @@ +# +# Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + + +# A properties file to map default keywords to test directories. This is used +# to dynamically assign keywords when tests are found by the harness. The +# keywords are then used by end-users to subset the tests being run based on +# Javatest's built-in keyword facility. This is useful when running additional +# alacarte tests in addition to a defined profile. +# +# An entry key is a test directory relative to the testsuite root (i.e., +# ${TS_HOME}/src) with unix file separator (forward slash). An entry value +# is a list of vehicle names separated by a space. Although other reasonable +# delimiters may also work, a single space is recommended for consistency. +# Acceptable vehicle names are combinations of the following strings: +# ejb, servlet, jsp, appclient, and standalone. Each item may only appear +# once in one entry vale. +# +# For examples, some invalid entries: +# /files/ts/src/com/sun/ts/tests/samples/jdbc = jdbc +# com\sun\ts\tests\samples\jdbc = jdbc +# com\\sun\\ts\\tests\\samples\\jdbc = jdbc +# samples/jdbc = jdbc +# /com/sun/ts/tests/samples/jdbc = jdbc +# com/sun/ts/tests/samples/jdbc = jdbc +# com/sun/ts/tests/samples/jdbc = jdbc +# +# Entry order is insignificant. As a good practice, make the entry key +# (test directory) specific. For example, +# com/sun/ts/tests/jdbc = jdbc +# conveys to the harness that all tests under com/sun/ts/tests/jdbc +# should have the keyword, "jdbc". +# +# This file should not be modified by end users. +# + + +# Test directories and their default keywords +com/sun/ts/tests/appclient = appclient javaee javaee_web_profile_optional +com/sun/ts/tests/appclient/deploy/ejblink = appclient javaee_web_profile_optional +com/sun/ts/tests/appclient/deploy/ejbref = appclient javaee_web_profile_optional + +com/sun/ts/tests/appclient/deploy/ejblink/single = javaee_optional +com/sun/ts/tests/appclient/deploy/ejbref/single = javaee_optional + +com/sun/ts/tests/assembly = assembly javaee +com/sun/ts/tests/connector = connector javaee connector_standalone connector_web_profile javaee_web_profile_optional +com/sun/ts/tests/connector/deployment = javaee +com/sun/ts/tests/connector/localTx/msginflow = connector_mdb_optional javaee +com/sun/ts/tests/connector/localTx/transaction = connector connector_jta_optional javaee +com/sun/ts/tests/connector/permissiondd = connector javaee +com/sun/ts/tests/connector/xa/transaction = connector_jta_optional javaee +com/sun/ts/tests/connector/resourceDefs/servlet = javaee connector_resourcedef_servlet_optional +com/sun/ts/tests/connector/resourceDefs/ejb = javaee connector_resourcedef_ejb_optional + +com/sun/ts/tests/ejb = ejb javaee + +com/sun/ts/tests/ejb/ee/bb = javaee_optional ejb_1x_optional javaee_web_profile_optional + +com/sun/ts/tests/ejb/ee/bb/localaccess = ejb_1x_optional javaee_optional +com/sun/ts/tests/ejb/ee/bb/localaccess/ebaccesstest = javaee_optional ejb_1x_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/localaccess/mdbqaccesstest = javaee_optional ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/localaccess/mdbtaccesstest = javaee_optional ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/localaccess/sbaccesstest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/localaccess/webaccesstest = javaee_optional javaee_web_profile_optional + +com/sun/ts/tests/ejb/ee/bb/session/lrapitest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/bean2beansinglejartest/bean1 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/bean2beansinglejartest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/sessioncontexttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/argsemantics = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/handletest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/exceptionerrortest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/cm/allowedmethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/clientviewtest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/bean2beanmultijartest/bean1 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/bean2beanmultijartest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/sessionbeantest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/statetest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateful/bm/allowedmethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/reentranttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/argsemantics = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/cm/allowedmethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/clientviewtest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/sessionbeantest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/statetest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/session/stateless/bm/allowedmethodstest = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb/ee/tx = javaee_optional ejb_1x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxM_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxRN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/cm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxR_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxRN_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxM_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxN_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxS_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxBM_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxM_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateful/bm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxM_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/cm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxM_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxRN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/sessionLocal/stateless/bm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/cm/TxRN_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/cm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/cm/TxR_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/bm/TxRN_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/bm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/bmp/bm/TxR_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/cm/TxRN_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/cm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/cm/TxR_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/bm/TxRN_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/bm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entityLocal/pm/bm/TxR_Diamond = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/cm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/cm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/bm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/bmp/bm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/cm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/bm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/pm/bm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/cm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/cm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/bm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/entity/cmp/bm/Tx_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxM_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxRN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/cm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxR_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxRN_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxM_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxN_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxS_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxBM_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxM_GlobalSingle = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateful/bm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxM_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/Tx_SetRollbackOnly = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/cm/TxS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxR_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxM_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/Tx_Multi = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxNS_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxRN_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxRN_Exceptions = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxR_Single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/tx/session/stateless/bm/TxS_Exceptions = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb/ee/bb/entity/lrapitest = javaee_optional ejb_1x_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp = ejb_1x_optional javaee_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/reentranttest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/nonreentranttest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/argsemantics = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/entitybeantest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/entitycontexttest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/multiclienttest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/allowedmethodstest = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/handletest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/entity/bmp/clientviewtest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20 = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/reentranttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/nonreentranttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/entitycmptest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/unknownpktest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/argsemantics = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/entitybeantest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/entitycontexttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/multiclienttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/allowedmethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/clientviewtest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/homemethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/complexpktest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/handletest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp20/clientviewtest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp = ejb_1x_optional javaee_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/reentranttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/nonreentranttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/argsemantics = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/entitybeantest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/entitycontexttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/multiclienttest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/allowedmethodstest = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/complexpktest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/handletest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/bb/entity/cmp/clientviewtest = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/deploy = javaee_optional ejb_1x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/deploy/mdb/ejblink/single = javaee_optional +com/sun/ts/tests/ejb/ee/deploy/mdb/ejblink/singleT = javaee_optional +com/sun/ts/tests/ejb/ee/deploy/mdb/ejbref/single = javaee_optional +com/sun/ts/tests/ejb/ee/deploy/mdb/ejbref/singleT = javaee_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11 = ejb_1x_optional javaee_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejbref/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejbref/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejbref/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/enventry/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/enventry/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/enventry/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/method/sec/style2 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/method/sec/style1 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/method/sec/style3 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejblink/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejblink/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/ejblink/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/pkey = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/resref/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/resref/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/resref/scope = javaee_optional ejb_2x_optionalejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp = ejb_1x_optional javaee_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejbref/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejbref/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejbref/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/enventry/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/enventry/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/enventry/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/method/sec/style2 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/method/sec/style1 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/method/sec/style3 = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejblink/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejblink/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/ejblink/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/pkey = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/resref/casesens = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/resref/single = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/bmp/resref/scope = javaee_optional ejb_2x_optional ejb_1x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20 = ejb_2x_optional javaee_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejbref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejbref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejbref/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/enventry/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/enventry/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/enventry/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/method/sec/style2 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/method/sec/style1 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/method/sec/style3 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejblink/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejblink/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/ejblink/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/pkey = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/resref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/resref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/entity/cmp20/resref/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejbref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejbref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejbref/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/enventry/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/enventry/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/enventry/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/method/sec/style2 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/method/sec/style1 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/method/sec/style3 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejblink/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejblink/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/ejblink/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/resref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/resref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateful/resref/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejbref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejbref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejbref/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/enventry/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/enventry/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/enventry/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/method/sec/style2 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/method/sec/style1 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/method/sec/style3 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejblink/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejblink/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/ejblink/scope = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/resref/casesens = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/resref/single = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/deploy/session/stateless/resref/scope = javaee_optional ejb_2x_optional + + +com/sun/ts/tests/ejb/ee/pm = javaee_optional ejb_1x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/ejbql = javaee_optional ejb_ql_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/ejbql/null_values = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/ejbql/schema = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/ejbql/tx = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/selfXself = javaee_optional ejb_2x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/pm/manyXmany/uni/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/manyXmany/bi/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/manyXmany/bi/delete = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXmany/uni/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXmany/bi/cascadedelete = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXmany/bi/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXmany/bi/delete = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXone/uni/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXone/bi/cascadedelete = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXone/bi/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/oneXone/bi/delete = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/manyXone/uni/btob = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/pm/manyXone/uni/delete = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb/ee/sec = javaee_optional ejb_1x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/sec/bmp/secrunaspropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/bmp/sec = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/bmp/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/bmp/util = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/bmp/lsecp = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/bmp/secpropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/secrunaspropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/sec = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/lsecp = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/secpropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp20/lsecr = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/secrunaspropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/sec = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/lsecp = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/secpropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/lsecr = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateful/mdb = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp/secrunaspropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp/sec = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/cmp/secpropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/secrunaspropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/sec = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/lsecp = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/secpropagation = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/sec/stateless/lsecr = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb/ee/timer = javaee_optional ejb_1x_optional javaee_web_profile_optional +com/sun/ts/tests/ejb/ee/timer/common = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/entity/bmp = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/entity/cmp20 = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/mdb = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/session/stateless/cm = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/session/stateless/bm = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb/ee/timer/apitests = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb/ee/webservices = javaee_optional javaee_web_profile_optional + +com/sun/ts/tests/ejb30 = ejb ejb30 javaee +com/sun/ts/tests/ejb30/lite = javaee ejb_web_profile javaee_web_profile +com/sun/ts/tests/ejb30/lite/packaging/embed = javaee_optional +com/sun/ts/tests/ejb30/common/migration/threetwo = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/common/migration/twothree = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/async = javaee ejb_remote_async_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/bb/localaccess = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/bb/mdb = javaee ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/bb/session = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/bb/session/stateful/migration/threetwo/annotated = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/migration/threetwo/descriptor = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/migration/threetwo/override = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/threetwo/annotated = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/threetwo/descriptor = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/threetwo/override = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/remove/complement = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/remove/annotated = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/remove/descriptor = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateful/remove/override = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/twothree/annotated = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/twothree/descriptor = javaee_optional ejb_2x_optional +com/sun/ts/tests/ejb30/bb/session/stateless/migration/twothree/override = javaee_optional ejb_2x_optional + +com/sun/ts/tests/ejb30/assembly = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/misc = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/sec = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/basic/mdb = javaee ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/interceptor/business/mdb = javaee ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/schedule/auto/attr/mdb = javaee ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/schedule/tx = javaee ejb_persistent_timer_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/schedule/tz = javaee ejb_persistent_timer_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/timer/schedule/timerconfig = javaee ejb_persistent_timer_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/tx/mdb = javaee ejb_mdb_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/tx/session = javaee ejb_3x_remote_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/webservice = javaee_optional ejb_jaxws_endpoints_optional javaee_web_profile_optional +com/sun/ts/tests/ejb30/zombie = javaee ejb_mdb_optional javaee_web_profile_optional + +com/sun/ts/tests/ejb32 = ejb ejb32 javaee +com/sun/ts/tests/ejb32/lite = javaee ejb_web_profile javaee_web_profile +com/sun/ts/tests/ejb32/lite/timer/interceptor/aroundtimeout/singleton/annotated = javaee javaee_web_profile_optional ejb_persistent_timer_optional +com/sun/ts/tests/ejb32/lite/timer/schedule/lifecycle = javaee javaee_web_profile_optional ejb_persistent_timer_optional +com/sun/ts/tests/ejb32/lite/timer/schedule/expire = javaee javaee_web_profile_optional ejb_persistent_timer_optional +com/sun/ts/tests/ejb32/mdb = javaee ejb_mdb_optional + +com/sun/ts/tests/el = el javaee javaee_web_profile + +com/sun/ts/tests/integration = integration javaee +com/sun/ts/tests/integration/entity = javaee_optional + +com/sun/ts/tests/jacc = jacc javaee +com/sun/ts/tests/jacc/web = jacc javaee jacc_web_profile jacc_web javaee_web_profile_optional +com/sun/ts/tests/jacc/ejb = jacc javaee jacc_ejb +com/sun/ts/tests/jaspic = jaspic javaee +com/sun/ts/tests/jaspic/spi/servlet = jaspic jaspic_servlet javaee jaspic_web_profile javaee_web_profile_optional +com/sun/ts/tests/jaspic/spi/soap = jaspic jaspic_soap jaspic_soap_optional +com/sun/ts/tests/jaspic/spi/authstatus = jaspic jaspic_soap jaspic_soap_optional +com/sun/ts/tests/jaspic/spi/baseline = jaspic jaspic_baseline +com/sun/ts/tests/javamail = javamail javaee javamail_web_profile javaee_web_profile_optional +com/sun/ts/tests/javaee = javaee +com/sun/ts/tests/jaxrs = jaxrs javaee jaxrs_web_profile javaee_web_profile +com/sun/ts/tests/jaxrs/jaxrs21/ee/sse/sseeventsource = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/jaxrs21/ee/sse/sseeventsink = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/api/rs/core/linkjaxbadapter = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/filter/interceptor = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/provider/overridestandard = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/provider/standardhaspriority = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/provider/standardnotnull = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/provider/standardwithxmlbinding = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/provider/jaxbcontext = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jaxrs/spec/client/typedentitieswithxmlbinding = jaxrs javaee_optional jaxrs_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/jdbc = jdbc javaee javaee_web_profile +com/sun/ts/tests/jms = jms javaee jms_web_profile javaee_web_profile_optional +com/sun/ts/tests/jms/ee20/resourcedefs = jms jms_optional javaee_optional javaee_web_profile_optional +com/sun/ts/tests/jpa = jpa javaee javaee_web_profile +com/sun/ts/tests/jpa/ee/packaging/appclient = javaee +com/sun/ts/tests/jpa/ee/packaging/ejb = javaee +com/sun/ts/tests/jpa/ee/pluggability = javaee javaee_web_profile +com/sun/ts/tests/jpa/ee/propagation/am = javaee +com/sun/ts/tests/jpa/ee/propagation/cm/extended = javaee +com/sun/ts/tests/jpa/se = jpa seonly +com/sun/ts/tests/jpa/jpa22/se = jpa seonly +com/sun/ts/tests/jsonp = jsonp javaee javaee_web_profile +com/sun/ts/tests/jsonb = jsonb javaee javaee_web_profile +com/sun/ts/tests/jsf = jsf javaee javaee_web_profile +com/sun/ts/tests/jsp = jsp javaee javaee_web_profile +com/sun/ts/tests/jsp/spec/tagext/resource = jsp javaee +com/sun/ts/tests/jstl = jstl javaee javaee_web_profile +com/sun/ts/tests/jta = jta javaee javaee_web_profile +com/sun/ts/tests/jta/ee/txpropagationtest = jta javaee +com/sun/ts/tests/jta/ee/usertransaction = jta javaee javaee_web_profile +#com/sun/ts/tests/saaj = saaj javaee saaj_web_profile javaee_web_profile_optional +com/sun/ts/tests/samples = samples javaee +com/sun/ts/tests/samples/ejb = samples ejb javaee +com/sun/ts/tests/samples/javamail = samples javamail javaee javamail_web_profile javaee_web_profile_optional +com/sun/ts/tests/samples/jdbc = samples jdbc javaee javaee_web_profile +com/sun/ts/tests/servlet = servlet javaee javaee_web_profile +com/sun/ts/tests/servlet/ee/spec/security/runAs = servlet javaee +com/sun/ts/tests/servlet/ee/spec/security/permissiondd = javaee security_manager_enabled +com/sun/ts/tests/servlet/spec/security/secbasic = servlet javaee +com/sun/ts/tests/servlet/spec/security/secform = servlet javaee +com/sun/ts/tests/servlet/spec/security/clientcert = servlet javaee +com/sun/ts/tests/servlet/spec/security/clientcertanno = servlet javaee +com/sun/ts/tests/servlet/spec/security/annotations = javaee +com/sun/ts/tests/signaturetest = signaturetest +com/sun/ts/tests/signaturetest/caj = signaturetest caj +com/sun/ts/tests/signaturetest/connector = connector +com/sun/ts/tests/signaturetest/jacc = signaturetest jacc +com/sun/ts/tests/signaturetest/jaspic = signaturetest jaspic jaspic_servlet jaspic_soap jaspic_core +com/sun/ts/tests/signaturetest/javaee = signaturetest javaee javaee_web_profile +com/sun/ts/tests/signaturetest/jaxrs = signaturetest jaxrs +#com/sun/ts/tests/signaturetest/jaxws = signaturetest jaxws +com/sun/ts/tests/signaturetest/jms = signaturetest jms +com/sun/ts/tests/signaturetest/jpa = signaturetest jpa +com/sun/ts/tests/signaturetest/jsf = signaturetest jsf +com/sun/ts/tests/signaturetest/jsonb = signaturetest jsonb +com/sun/ts/tests/signaturetest/jsonp = signaturetest jsonp +com/sun/ts/tests/signaturetest/jsp = signaturetest jsp +com/sun/ts/tests/signaturetest/jstl = signaturetest jstl +#com/sun/ts/tests/signaturetest/saaj = signaturetest saaj +com/sun/ts/tests/signaturetest/servlet = signaturetest servlet +com/sun/ts/tests/signaturetest/websocket = signaturetest websocket +com/sun/ts/tests/signaturetest/securityapi = signaturetest securityapi +com/sun/ts/tests/signaturetest/wsmd = signaturetest wsmd +com/sun/ts/tests/xa = xa javaee xa_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/asynccontext = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/asyncevent = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/dispatchertype = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/registration = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/servletcontext30 = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/servletrequest30 = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/servletrequestwrapper30 = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/httpservletrequest30 = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/httpservletresponse30 = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/api/jakarta_servlet/sessioncookieconfig = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/annotationservlet = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/aordering = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/async = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/fileupload = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/fragment = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/spec/security = servlet30 javaee javaee_web_profile +com/sun/ts/tests/servlet/ee/platform = javaee +com/sun/ts/tests/servlet/ee/platform/deploy/ejblink/single = javaee_optional javaee_web_profile_optional +com/sun/ts/tests/servlet/ee/platform/deploy/ejbref/single = javaee_optional javaee_web_profile_optional +#com/sun/ts/tests/jws = jws webservices javaee jaxws_web_profile javaee_web_profile_optional + +#com/sun/ts/tests/jaxws = jaxws webservices javaee jaxws_web_profile javaee_web_profile_optional +#com/sun/ts/tests/jaxws/se = jaxws webservices javaee jaxws_web_profile javaee_web_profile_optional seonly + +com/sun/ts/tests/webservices12 = webservices javaee_optional +com/sun/ts/tests/webservices12/ejb/annotations/WSEjbWebServiceProviderTest= webservices javaee_optional xml_binding +com/sun/ts/tests/webservices12/narrow = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/sec/descriptors/servlet/basicSSL = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/servlet = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/specialcases = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/specialcases/services/w2j/doclit/provider = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional xml_binding +com/sun/ts/tests/webservices12/wsdlImport/file/simple1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/simple2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/simple3 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/nested1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/nested2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/shared1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/file/shared2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/simple1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/simple2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/simple3 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/nested1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/nested2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/shared1 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices12/wsdlImport/http/shared2 = webservices javaee_optional jaxws_web_profile javaee_web_profile_optional +com/sun/ts/tests/webservices13 = webservices javaee_optional +com/sun/ts/tests/websocket = websocket javaee javaee_web_profile +com/sun/ts/tests/ejb30/persistence/lock = javaee +com/sun/ts/tests/ejb30/persistence/ee = javaee +com/sun/ts/tests/ejb30/sec/permsxml = javaee security_manager_enabled +com/sun/ts/tests/securityapi = securityapi javaee javaee_web_profile diff --git a/tck/old-tck/source/src/com/sun/ts/lib/harness/rebuildable.properties b/tck/old-tck/source/src/com/sun/ts/lib/harness/rebuildable.properties new file mode 100644 index 0000000..4a9cba9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/harness/rebuildable.properties @@ -0,0 +1,56 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# A properties file to determine whether a test directory contains tests +# which must be rebuilt and run against the RI. +# +# An entry key is a test directory relative to the testsutie root (i.e., +# ${TS_HOME}/src) with unix file separator (forward slash). An entry value +# is "true". +# +# For examples, some invalid entries: +# rebuildable./files/ts/src/com/sun/ts/tests/samples/jdbc = true +# rebuildable.com\sun\ts\tests\samples\jdbc = true +# rebuildable.com\\sun\\ts\\tests\\samples\\jdbc = true +# rebuildable.samples/jdbc = true +# +# Entry order is insignificant. As a good practice, make the entry key +# (test directory) specific. For example, +# rebuildable.com/sun/ts/tests = true +# conveys to the harness that all tests under com/sun/ts/tests are rebuildable +# tests. +# +# This file may be modified for debugging purpose only. When testing for +# compatibility certification, the original version of this file must be +# used. Do NOT make modifications without maintaining a backup copy. +# + +rebuildable.com/sun/ts/tests/jaxws= true +rebuildable.com/sun/ts/tests/jws= true + +# If any test (sub-)directories that have been covered by entries above +# are not service test directories, list them in exclude.dir. It should +# arise rarely, and one possible senario could be: +# com/sun/ts/tests/foo is listed above as servicve tests, but later a +# non-service test dir com/sun/ts/tests/foo/non_service_tests is added, +# and you do not want to list a large number of subdirectories of foo +# in this properties file. +# If you get into this situation often, start questioning the test design +# The syntax: exclude.dir = com/sun/ts/tests/foo/non_service_test com/sun/ +# ts/tests/bar/non_service_test com/sun/ts/tests/buz/non_service_test +# + +exclude.dir = diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/common/SunRIURL.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/common/SunRIURL.java new file mode 100644 index 0000000..3a8ecf4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/common/SunRIURL.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.implementation.sun.common; + +import java.net.*; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.porting.*; + +/** + * This is a J2EE Reference specific implementation of the TSURLInterface which + * is to be used for J2EE-TS testing. TS tests use this interface to obtain the + * URL String to use to access a given web component. If a given J2EE Server + * implmentation requires that URLs be created in a different manner, then this + * implementation can be replaced. + * + * @author Kyle Grucci + */ +public class SunRIURL implements TSURLInterface { + private URL url = null; + + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL object. + */ + public URL getURL(String protocol, String host, int port, String file) + throws MalformedURLException { + try { + url = new URL(protocol, host, port, file); + } catch (MalformedURLException e) { + TestUtil.logErr("Failed during URL creation", e); + throw e; + } + return url; + } + + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL as a String. + */ + public String getURLString(String protocol, String host, int port, + String file) { + if (file.startsWith("/")) + return protocol + "://" + host + ":" + port + file; + else + return protocol + "://" + host + ":" + port + "/" + file; + } + + /** + * This method is called by TS tests to get the request string to use to + * access a given web component. + * + * @param request + * - the request file. + * @return a valid String object. + */ + public String getRequest(String request) { + return request; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/SunRIDeploymentInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/SunRIDeploymentInfo.java new file mode 100644 index 0000000..9e98d54 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/SunRIDeploymentInfo.java @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.implementation.sun.javaee.runtime; + +import jakarta.xml.bind.*; +import com.sun.ts.lib.porting.DeploymentInfo; +import com.sun.ts.lib.implementation.sun.javaee.runtime.app.*; +import com.sun.ts.lib.implementation.sun.javaee.runtime.appclient.*; +import com.sun.ts.lib.implementation.sun.javaee.runtime.ejb.*; +import com.sun.ts.lib.implementation.sun.javaee.runtime.web.*; +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.DeliverableFactory; +import org.xml.sax.*; +import javax.xml.parsers.*; +import javax.xml.transform.sax.*; +import java.io.*; +import java.util.*; +import com.sun.ts.lib.util.*; + +/** + * Provides all information required to deploy an application on a server. Much + * of this information is extracted from runtime xml files. The following + * information is provided: + *

    + *
  • EJB Jar info
  • + *
  • Web Resources - Display name, context root, resource references and ejb + * references for each web resource in this ear.
  • + *
  • EJB Resources - Name, JNDI name, resource references, ejb references, and + * CMP information for each ejb resource in this ear.
  • + *
  • Resource References - For each resource reference, the JNDI name, default + * resource principal name and password, and any mail configuration information + * is provided.
  • + *
  • EJB References - For each EJB reference, the EJB name and its + * corresponding JNDI name is provided.
  • + *
+ *

+ * See: javaee.home.ri/lib/dtds/sun-application_5_0-0.dtd + * javaee.home.ri/lib/dtds/sun-application-client_5_0-0.dtd + * javaee.home.ri/lib/dtds/sun-ejb-jar_3_0-0.dtd + * javaee.home.ri/lib/dtds/sun-web-app_2_5-0.dtd for more and updated + * information. + * + * @author Mark Roth, Kyle Grucci, Ryan O'Connell + */ +public class SunRIDeploymentInfo + implements DeploymentInfo, java.io.Serializable { + + private static final String EJB_PARSE_PKG = "com.sun.ts.lib.implementation.sun.javaee.runtime.ejb"; + + private static final String WEB_PARSE_PKG = "com.sun.ts.lib.implementation.sun.javaee.runtime.web"; + + private static final String APP_PARSE_PKG = "com.sun.ts.lib.implementation.sun.javaee.runtime.app"; + + private static final String APC_PARSE_PKG = "com.sun.ts.lib.implementation.sun.javaee.runtime.appclient"; + + private static final String EJB_RUNTIME_FILE = "sun-ejb-jar.xml"; + + private static final String WEB_RUNTIME_FILE = "sun-web.xml"; + + private static final String APC_RUNTIME_FILE = "sun-application-client.xml"; + + private static final String APP_RUNTIME_FILE = "sun-application.xml"; + + // Maps DD filename (String) -> + // com.sun.ts.lib.implementation.sun.javaee.runtime.ejb.SunEjbJar interfaces + private Map ejbRuntimeData = new HashMap(); + + // Maps DD filename (String) -> + // com.sun.ts.lib.implementation.sun.javaee.runtime.web.SunWebApp interfaces + private Map webRuntimeData = new HashMap(); + + // Maps DD filename (String) -> + // com.sun.ts.lib.implementation.sun.javaee.runtime.app.SunApplication + // interfaces + private Map appRuntimeData = new HashMap(); + + // Maps DD filename (String) -> + // com.sun.ts.lib.implementation.sun.javaee.runtime.appclient.SunApplicationClient + // interfaces + private Map appClientRuntimeData = new HashMap(); + + /** The ear file to deploy to the server */ + private String earFile; + + /** The runtime files being analyzed */ + private String[] runtimeFiles; + + protected DeploymentInfo[] prevDeployInfos = null; + + /** + * Creates a new deployment information object. + * + * @param earFile + * Full path to the ear file being deployed + * @param runtimeFiles + * Array of full paths to runtime.xml files to analyze. + * + * @exception IOException + * Thrown if an IO error occured while analyzing runtime + * information. + * @exception DeploymentInfo.ParseException + * Thrown if a parsing error occured while analyzing runtime + * information. + */ + public SunRIDeploymentInfo(String earFile, String[] runtimeFiles) + throws IOException, DeploymentInfo.ParseException { + this.earFile = earFile; + this.runtimeFiles = runtimeFiles; + + // default is to not generate sql for this ear + setProperty("generateSQL", "false"); + + unmarshalFiles(runtimeFiles); + } + + /** + * A temporary properties list, until all information can be provided by this + * API. + */ + protected Properties properties = new Properties(); + + /** + * Sets the value of the given property. This method should be temporary, + * until all important information can be provided by the API. + */ + public void setProperty(String key, String value) { + properties.setProperty(key, value); + } + + /** + * Returns the value of the given property. This method should be temporary, + * until all important information can be provided by the API. + */ + public String getProperty(String key) { + return properties.getProperty(key); + } + + /** + * Sets/gets an array of deploymentInfo objects from previously deployed apps + * in the currrent directory along with all common apps + */ + public void setPreviousInfos(DeploymentInfo[] infos) { + prevDeployInfos = infos; + } + + public DeploymentInfo[] getPreviousInfos() { + return prevDeployInfos; + } + + /** + * Returns the ear file to deploy + */ + public String getEarFile() { + return earFile; + } + + /** + * Returns the list of runtime files to be deployed + */ + public String[] getRuntimeFiles() { + return runtimeFiles; + } + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.ejb.SunEjbJar interface. + */ + public Map getEjbRuntimeData() { + return ejbRuntimeData; + } + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.web.SunWebApp interface. + */ + public Map getWebRuntimeData() { + return webRuntimeData; + } + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.app.SunApplication + * interface. + */ + public Map getAppRuntimeData() { + return appRuntimeData; + } + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.appclient.SunApplicationClient + * interface. + */ + public Map getAppClientRuntimeData() { + return appClientRuntimeData; + } + + private List makeList(Map aMap) { + List result = new ArrayList(); + if (aMap == null) { + return result; + } + Iterator i = aMap.values().iterator(); + while (i.hasNext()) { + result.add(i.next()); + } + return result; + } + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.appclient.SunApplicationClient + * interface. + */ + public List getAppClientRuntimeDDs() { + return makeList(appClientRuntimeData); + } + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.app.SunApplication + * interface. + */ + public List getAppRuntimeDDs() { + return makeList(appRuntimeData); + } + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.web.SunWebApp interface. + */ + public List getWebRuntimeDDs() { + return makeList(webRuntimeData); + } + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.implementation.sun.javaee.runtime.ejb.SunEjbJar interface. + */ + public List getEjbRuntimeDDs() { + return makeList(ejbRuntimeData); + } + + private String normalizeFile(String fileName) { + int index = fileName.lastIndexOf(File.separator); + index++; + int index2 = fileName.indexOf(".sun-"); + if (index2 == -1) { + index2 = fileName.length(); + } + String result = fileName.substring(index, index2); + return result; + } + + private void unmarshalFiles(String[] files) + throws DeploymentInfo.ParseException { + String file = ""; + try { + int numFiles = (files == null) ? 0 : files.length; + for (int i = 0; i < numFiles; i++) { + file = files[i]; + if (file.endsWith(EJB_RUNTIME_FILE)) { + this.ejbRuntimeData.put(normalizeFile(file), + (SunEjbJar) (unmarshalFile(EJB_PARSE_PKG, file))); + } else if (file.endsWith(WEB_RUNTIME_FILE)) { + this.webRuntimeData.put(normalizeFile(file), + (SunWebApp) (unmarshalFile(WEB_PARSE_PKG, file))); + } else if (file.endsWith(APP_RUNTIME_FILE)) { + this.appRuntimeData.put(normalizeFile(file), + (SunApplication) (unmarshalFile(APP_PARSE_PKG, file))); + } else if (file.endsWith(APC_RUNTIME_FILE)) { + this.appClientRuntimeData.put(normalizeFile(file), + (SunApplicationClient) (unmarshalFile(APC_PARSE_PKG, file))); + } else { + TestUtil.logHarnessDebug( + "Warning unknown file type found in unmarshalFiles (String[])"); + TestUtil.logHarnessDebug("\tfile name is \"" + file + + "\", Ignoring file and continuing..."); + } + if (TestUtil.harnessDebug) { + TestUtil.logHarnessDebug("###################"); + TestUtil.logHarnessDebug("### DD file key was \"" + file + "\""); + TestUtil.logHarnessDebug( + "### DD file key is \"" + normalizeFile(file) + "\""); + TestUtil.logHarnessDebug("###################"); + } + } + } catch (Exception e) { + TestUtil.logHarness("Error unmarshalling file \"" + file + "\""); + e.printStackTrace(); + throw new DeploymentInfo.ParseException( + "Error unmarshalling file \"" + file + "\""); + } + } + + private String getAppserverLibDir() { + String libDir = File.separator + "j2eetck" + File.separator + "lib"; + try { + PropertyManagerInterface propMgr = DeliverableFactory + .getDeliverableInstance().getPropertyManager(); + String ctsDtdDirectory = propMgr.getProperty("ts.home", libDir); + libDir = ctsDtdDirectory + File.separator + "lib"; + } catch (Exception e) { + e.printStackTrace(); + } + return libDir; + } + + public class MyResolver implements EntityResolver { + public InputSource resolveEntity(String publicId, String systemId) { + int index = systemId.lastIndexOf('/'); + if (index == -1) { // should never happen + index = systemId.lastIndexOf('\\'); + } + String fileName = systemId.substring(index + 1); + String libDir = getAppserverLibDir(); + String result = systemId; + if (fileName.endsWith(".xsd")) { + result = libDir + File.separator + "schemas" + File.separator + + fileName; + } else if (fileName.endsWith(".dtd")) { + result = libDir + File.separator + "dtds" + File.separator + fileName; + } else { + TestUtil.logHarnessDebug("No match for \"" + systemId + "\""); + } + if (new File(result).exists()) { + TestUtil + .logHarnessDebug("Entity Resolver Returning \"" + result + "\""); + return new InputSource(result); + } + TestUtil.logHarnessDebug( + "Entity Resolver could not find \"" + result + "\", returning null"); + return null; + } + } + + private Object unmarshalFile(String pkg, String aFile) throws Exception { + SAXParserFactory spf = SAXParserFactory.newInstance(); + // TestUtil.logHarnessDebug("********************************************************************************"); + // TestUtil.logHarnessDebug("**** Factory is namespace aware \"" + + // spf.isNamespaceAware() + "\""); + spf.setNamespaceAware(true); + // TestUtil.logHarnessDebug("**** Factory is namespace aware \"" + + // spf.isNamespaceAware() + "\""); + SAXParser saxParser = spf.newSAXParser(); + // TestUtil.logHarnessDebug("**** Parser is namespace aware \"" + + // saxParser.isNamespaceAware() + "\""); + // TestUtil.logHarnessDebug("********************************************************************************"); + XMLReader xmlReader = saxParser.getXMLReader(); + xmlReader.setEntityResolver(new MyResolver()); + SAXSource source = new SAXSource(xmlReader, new InputSource(aFile)); + JAXBContext jc = JAXBContext.newInstance(pkg); + Unmarshaller um = jc.createUnmarshaller(); + TestUtil.logHarnessDebug("Unmarshalling file \"" + aFile + "\""); + Object tree = um.unmarshal(source); + return tree; + } + + /** + * Returns a String that conatains the contents of all the runtime XML files. + */ + public String getContentAsXml() { + String NL = System.getProperty("line.separator", "\n"); + int numFiles = (runtimeFiles == null) ? 0 : runtimeFiles.length; + org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); + builder.setEntityResolver(new MyResolver()); + File runtimeFile = null; + Writer writer = new StringWriter(); + org.jdom.output.XMLOutputter out = new org.jdom.output.XMLOutputter( + org.jdom.output.Format.getPrettyFormat()); + for (int i = 0; i < numFiles; i++) { + try { + writer.write( + "*******************************************************************" + + NL); + writer.write("File: \"" + runtimeFiles[i] + "\"" + NL); + runtimeFile = new File(runtimeFiles[i]); + org.jdom.Document doc = builder.build(runtimeFile); + out.output(doc, writer); + writer.write(NL); + } catch (Exception e) { + e.printStackTrace(); + try { + writer.write( + "*******************************************************************" + + NL); + writer.write(NL + NL + "Error processing file \"" + runtimeFiles[i] + + "\"" + NL + NL); + writer.write( + "*******************************************************************" + + NL); + } catch (Exception ee) { + } // keep processing runtime files + } + } + try { + writer.close(); + } catch (Exception e) { + } + return writer.toString(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/CallProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/CallProperty.java new file mode 100644 index 0000000..ab91645 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/CallProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "call-property") +public class CallProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/DefaultResourcePrincipal.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/DefaultResourcePrincipal.java new file mode 100644 index 0000000..63c7e29 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/DefaultResourcePrincipal.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "password" +}) +@XmlRootElement(name = "default-resource-principal") +public class DefaultResourcePrincipal + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String password; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + /** + * Sets the value of the password property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassword(String value) { + this.password = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/EjbRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/EjbRef.java new file mode 100644 index 0000000..2ec6c8c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/EjbRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbRefName", + "jndiName" +}) +@XmlRootElement(name = "ejb-ref") +public class EjbRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "ejb-ref-name", required = true) + protected String ejbRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the ejbRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbRefName() { + return ejbRefName; + } + + /** + * Sets the value of the ejbRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbRefName(String value) { + this.ejbRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/GroupName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/GroupName.java new file mode 100644 index 0000000..f30b4bb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/GroupName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "group-name") +public class GroupName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/JavaMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/JavaMethod.java new file mode 100644 index 0000000..050193c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/JavaMethod.java @@ -0,0 +1,85 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "methodParams" +}) +@XmlRootElement(name = "java-method") +public class JavaMethod implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-params") + protected MethodParams methodParams; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Message.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Message.java new file mode 100644 index 0000000..a0682e7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Message.java @@ -0,0 +1,71 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "javaMethodOrOperationName" +}) +@XmlRootElement(name = "message") +public class Message + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElements({ + @XmlElement(name = "java-method", type = JavaMethod.class), + @XmlElement(name = "operation-name", type = OperationName.class) + }) + protected List javaMethodOrOperationName; + + /** + * Gets the value of the javaMethodOrOperationName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the javaMethodOrOperationName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getJavaMethodOrOperationName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link JavaMethod } + * {@link OperationName } + * + * + */ + public List getJavaMethodOrOperationName() { + if (javaMethodOrOperationName == null) { + javaMethodOrOperationName = new ArrayList(); + } + return this.javaMethodOrOperationName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestination.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestination.java new file mode 100644 index 0000000..8dfb2f3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestination.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationName", + "jndiName" +}) +@XmlRootElement(name = "message-destination") +public class MessageDestination + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-name", required = true) + protected String messageDestinationName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationName() { + return messageDestinationName; + } + + /** + * Sets the value of the messageDestinationName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationName(String value) { + this.messageDestinationName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestinationRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestinationRef.java new file mode 100644 index 0000000..6ee6368 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageDestinationRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationRefName", + "jndiName" +}) +@XmlRootElement(name = "message-destination-ref") +public class MessageDestinationRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-ref-name", required = true) + protected String messageDestinationRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationRefName() { + return messageDestinationRefName; + } + + /** + * Sets the value of the messageDestinationRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationRefName(String value) { + this.messageDestinationRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurity.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurity.java new file mode 100644 index 0000000..59e2c6e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurity.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "message", + "requestProtection", + "responseProtection" +}) +@XmlRootElement(name = "message-security") +public class MessageSecurity + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List message; + @XmlElement(name = "request-protection") + protected RequestProtection requestProtection; + @XmlElement(name = "response-protection") + protected ResponseProtection responseProtection; + + /** + * Gets the value of the message property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the message property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessage().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Message } + * + * + */ + public List getMessage() { + if (message == null) { + message = new ArrayList(); + } + return this.message; + } + + /** + * Gets the value of the requestProtection property. + * + * @return + * possible object is + * {@link RequestProtection } + * + */ + public RequestProtection getRequestProtection() { + return requestProtection; + } + + /** + * Sets the value of the requestProtection property. + * + * @param value + * allowed object is + * {@link RequestProtection } + * + */ + public void setRequestProtection(RequestProtection value) { + this.requestProtection = value; + } + + /** + * Gets the value of the responseProtection property. + * + * @return + * possible object is + * {@link ResponseProtection } + * + */ + public ResponseProtection getResponseProtection() { + return responseProtection; + } + + /** + * Sets the value of the responseProtection property. + * + * @param value + * allowed object is + * {@link ResponseProtection } + * + */ + public void setResponseProtection(ResponseProtection value) { + this.responseProtection = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurityBinding.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurityBinding.java new file mode 100644 index 0000000..4ac9ce0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MessageSecurityBinding.java @@ -0,0 +1,124 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageSecurity" +}) +@XmlRootElement(name = "message-security-binding") +public class MessageSecurityBinding + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-layer", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authLayer; + @XmlAttribute(name = "provider-id") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String providerId; + @XmlElement(name = "message-security") + protected List messageSecurity; + + /** + * Gets the value of the authLayer property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthLayer() { + return authLayer; + } + + /** + * Sets the value of the authLayer property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthLayer(String value) { + this.authLayer = value; + } + + /** + * Gets the value of the providerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProviderId() { + return providerId; + } + + /** + * Sets the value of the providerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProviderId(String value) { + this.providerId = value; + } + + /** + * Gets the value of the messageSecurity property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageSecurity property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageSecurity().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageSecurity } + * + * + */ + public List getMessageSecurity() { + if (messageSecurity == null) { + messageSecurity = new ArrayList(); + } + return this.messageSecurity; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParam.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParam.java new file mode 100644 index 0000000..09f3483 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParam.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "method-param") +public class MethodParam + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParams.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParams.java new file mode 100644 index 0000000..f9ef827 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/MethodParams.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodParam" +}) +@XmlRootElement(name = "method-params") +public class MethodParams + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-param") + protected List methodParam; + + /** + * Gets the value of the methodParam property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the methodParam property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethodParam().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MethodParam } + * + * + */ + public List getMethodParam() { + if (methodParam == null) { + methodParam = new ArrayList(); + } + return this.methodParam; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ObjectFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ObjectFactory.java new file mode 100644 index 0000000..a96b907 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ObjectFactory.java @@ -0,0 +1,247 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import jakarta.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.sun.ts.lib.implementation.sun.javaee.runtime.app package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sun.ts.lib.implementation.sun.javaee.runtime.app + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ServiceRef } + * + */ + public ServiceRef createServiceRef() { + return new ServiceRef(); + } + + /** + * Create an instance of {@link PortInfo } + * + */ + public PortInfo createPortInfo() { + return new PortInfo(); + } + + /** + * Create an instance of {@link CallProperty } + * + */ + public CallProperty createCallProperty() { + return new CallProperty(); + } + + /** + * Create an instance of {@link ServiceQname } + * + */ + public ServiceQname createServiceQname() { + return new ServiceQname(); + } + + /** + * Create an instance of {@link MethodParam } + * + */ + public MethodParam createMethodParam() { + return new MethodParam(); + } + + /** + * Create an instance of {@link RequestProtection } + * + */ + public RequestProtection createRequestProtection() { + return new RequestProtection(); + } + + /** + * Create an instance of {@link EjbRef } + * + */ + public EjbRef createEjbRef() { + return new EjbRef(); + } + + /** + * Create an instance of {@link MessageDestinationRef } + * + */ + public MessageDestinationRef createMessageDestinationRef() { + return new MessageDestinationRef(); + } + + /** + * Create an instance of {@link WsdlPort } + * + */ + public WsdlPort createWsdlPort() { + return new WsdlPort(); + } + + /** + * Create an instance of {@link GroupName } + * + */ + public GroupName createGroupName() { + return new GroupName(); + } + + /** + * Create an instance of {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal createDefaultResourcePrincipal() { + return new DefaultResourcePrincipal(); + } + + /** + * Create an instance of {@link SecurityRoleMapping } + * + */ + public SecurityRoleMapping createSecurityRoleMapping() { + return new SecurityRoleMapping(); + } + + /** + * Create an instance of {@link PrincipalName } + * + */ + public PrincipalName createPrincipalName() { + return new PrincipalName(); + } + + /** + * Create an instance of {@link StubProperty } + * + */ + public StubProperty createStubProperty() { + return new StubProperty(); + } + + /** + * Create an instance of {@link MessageDestination } + * + */ + public MessageDestination createMessageDestination() { + return new MessageDestination(); + } + + /** + * Create an instance of {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding createMessageSecurityBinding() { + return new MessageSecurityBinding(); + } + + /** + * Create an instance of {@link MessageSecurity } + * + */ + public MessageSecurity createMessageSecurity() { + return new MessageSecurity(); + } + + /** + * Create an instance of {@link JavaMethod } + * + */ + public JavaMethod createJavaMethod() { + return new JavaMethod(); + } + + /** + * Create an instance of {@link MethodParams } + * + */ + public MethodParams createMethodParams() { + return new MethodParams(); + } + + /** + * Create an instance of {@link ResponseProtection } + * + */ + public ResponseProtection createResponseProtection() { + return new ResponseProtection(); + } + + /** + * Create an instance of {@link ResourceRef } + * + */ + public ResourceRef createResourceRef() { + return new ResourceRef(); + } + + /** + * Create an instance of {@link Web } + * + */ + public Web createWeb() { + return new Web(); + } + + /** + * Create an instance of {@link SunApplication } + * + */ + public SunApplication createSunApplication() { + return new SunApplication(); + } + + /** + * Create an instance of {@link ResourceEnvRef } + * + */ + public ResourceEnvRef createResourceEnvRef() { + return new ResourceEnvRef(); + } + + /** + * Create an instance of {@link Message } + * + */ + public Message createMessage() { + return new Message(); + } + + /** + * Create an instance of {@link OperationName } + * + */ + public OperationName createOperationName() { + return new OperationName(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/OperationName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/OperationName.java new file mode 100644 index 0000000..f59e15e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/OperationName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "operation-name") +public class OperationName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PortInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PortInfo.java new file mode 100644 index 0000000..f97b400 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PortInfo.java @@ -0,0 +1,179 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceEndpointInterface", + "wsdlPort", + "stubProperty", + "callProperty", + "messageSecurityBinding" +}) +@XmlRootElement(name = "port-info") +public class PortInfo + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-endpoint-interface") + protected String serviceEndpointInterface; + @XmlElement(name = "wsdl-port") + protected WsdlPort wsdlPort; + @XmlElement(name = "stub-property") + protected List stubProperty; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "message-security-binding") + protected MessageSecurityBinding messageSecurityBinding; + + /** + * Gets the value of the serviceEndpointInterface property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceEndpointInterface() { + return serviceEndpointInterface; + } + + /** + * Sets the value of the serviceEndpointInterface property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceEndpointInterface(String value) { + this.serviceEndpointInterface = value; + } + + /** + * Gets the value of the wsdlPort property. + * + * @return + * possible object is + * {@link WsdlPort } + * + */ + public WsdlPort getWsdlPort() { + return wsdlPort; + } + + /** + * Sets the value of the wsdlPort property. + * + * @param value + * allowed object is + * {@link WsdlPort } + * + */ + public void setWsdlPort(WsdlPort value) { + this.wsdlPort = value; + } + + /** + * Gets the value of the stubProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the stubProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getStubProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link StubProperty } + * + * + */ + public List getStubProperty() { + if (stubProperty == null) { + stubProperty = new ArrayList(); + } + return this.stubProperty; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the messageSecurityBinding property. + * + * @return + * possible object is + * {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding getMessageSecurityBinding() { + return messageSecurityBinding; + } + + /** + * Sets the value of the messageSecurityBinding property. + * + * @param value + * allowed object is + * {@link MessageSecurityBinding } + * + */ + public void setMessageSecurityBinding(MessageSecurityBinding value) { + this.messageSecurityBinding = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PrincipalName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PrincipalName.java new file mode 100644 index 0000000..8aec514 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/PrincipalName.java @@ -0,0 +1,88 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "principal-name") +public class PrincipalName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "class-name") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String className; + @XmlValue + protected String value; + + /** + * Gets the value of the className property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClassName() { + return className; + } + + /** + * Sets the value of the className property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClassName(String value) { + this.className = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/RequestProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/RequestProtection.java new file mode 100644 index 0000000..54b4f68 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/RequestProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "request-protection") +public class RequestProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceEnvRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceEnvRef.java new file mode 100644 index 0000000..1062cb9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceEnvRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resourceEnvRefName", + "jndiName" +}) +@XmlRootElement(name = "resource-env-ref") +public class ResourceEnvRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "resource-env-ref-name", required = true) + protected String resourceEnvRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the resourceEnvRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceEnvRefName() { + return resourceEnvRefName; + } + + /** + * Sets the value of the resourceEnvRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceEnvRefName(String value) { + this.resourceEnvRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceRef.java new file mode 100644 index 0000000..962969f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResourceRef.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resRefName", + "jndiName", + "defaultResourcePrincipal" +}) +@XmlRootElement(name = "resource-ref") +public class ResourceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "res-ref-name", required = true) + protected String resRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + + /** + * Gets the value of the resRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResRefName() { + return resRefName; + } + + /** + * Sets the value of the resRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResRefName(String value) { + this.resRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResponseProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResponseProtection.java new file mode 100644 index 0000000..efd5947 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ResponseProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "response-protection") +public class ResponseProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SecurityRoleMapping.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SecurityRoleMapping.java new file mode 100644 index 0000000..2384091 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SecurityRoleMapping.java @@ -0,0 +1,98 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "roleName", + "principalNameOrGroupName" +}) +@XmlRootElement(name = "security-role-mapping") +public class SecurityRoleMapping + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "role-name", required = true) + protected String roleName; + @XmlElements({ + @XmlElement(name = "principal-name", required = true, type = PrincipalName.class), + @XmlElement(name = "group-name", required = true, type = GroupName.class) + }) + protected List principalNameOrGroupName; + + /** + * Gets the value of the roleName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRoleName() { + return roleName; + } + + /** + * Sets the value of the roleName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRoleName(String value) { + this.roleName = value; + } + + /** + * Gets the value of the principalNameOrGroupName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the principalNameOrGroupName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPrincipalNameOrGroupName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PrincipalName } + * {@link GroupName } + * + * + */ + public List getPrincipalNameOrGroupName() { + if (principalNameOrGroupName == null) { + principalNameOrGroupName = new ArrayList(); + } + return this.principalNameOrGroupName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceQname.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceQname.java new file mode 100644 index 0000000..01a05b3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceQname.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "service-qname") +public class ServiceQname + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceRef.java new file mode 100644 index 0000000..4c5a676 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/ServiceRef.java @@ -0,0 +1,206 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceRefName", + "portInfo", + "callProperty", + "wsdlOverride", + "serviceImplClass", + "serviceQname" +}) +@XmlRootElement(name = "service-ref") +public class ServiceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-ref-name", required = true) + protected String serviceRefName; + @XmlElement(name = "port-info") + protected List portInfo; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "wsdl-override") + protected String wsdlOverride; + @XmlElement(name = "service-impl-class") + protected String serviceImplClass; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + + /** + * Gets the value of the serviceRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceRefName() { + return serviceRefName; + } + + /** + * Sets the value of the serviceRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceRefName(String value) { + this.serviceRefName = value; + } + + /** + * Gets the value of the portInfo property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the portInfo property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPortInfo().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PortInfo } + * + * + */ + public List getPortInfo() { + if (portInfo == null) { + portInfo = new ArrayList(); + } + return this.portInfo; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the wsdlOverride property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlOverride() { + return wsdlOverride; + } + + /** + * Sets the value of the wsdlOverride property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlOverride(String value) { + this.wsdlOverride = value; + } + + /** + * Gets the value of the serviceImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceImplClass() { + return serviceImplClass; + } + + /** + * Sets the value of the serviceImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceImplClass(String value) { + this.serviceImplClass = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/StubProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/StubProperty.java new file mode 100644 index 0000000..58aa5cf --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/StubProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "stub-property") +public class StubProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SunApplication.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SunApplication.java new file mode 100644 index 0000000..c85c22a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/SunApplication.java @@ -0,0 +1,422 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "web", + "passByReference", + "uniqueId", + "securityRoleMapping", + "realm", + "ejbRef", + "resourceRef", + "resourceEnvRef", + "serviceRef", + "messageDestinationRef", + "messageDestination", + "archiveName", + "compatibility" +}) +@XmlRootElement(name = "sun-application") +public class SunApplication + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List web; + @XmlElement(name = "pass-by-reference") + protected String passByReference; + @XmlElement(name = "unique-id") + protected String uniqueId; + @XmlElement(name = "security-role-mapping") + protected List securityRoleMapping; + protected String realm; + @XmlElement(name = "ejb-ref") + protected List ejbRef; + @XmlElement(name = "resource-ref") + protected List resourceRef; + @XmlElement(name = "resource-env-ref") + protected List resourceEnvRef; + @XmlElement(name = "service-ref") + protected List serviceRef; + @XmlElement(name = "message-destination-ref") + protected List messageDestinationRef; + @XmlElement(name = "message-destination") + protected List messageDestination; + @XmlElement(name = "archive-name") + protected String archiveName; + protected String compatibility; + + /** + * Gets the value of the web property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the web property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getWeb().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Web } + * + * + */ + public List getWeb() { + if (web == null) { + web = new ArrayList(); + } + return this.web; + } + + /** + * Gets the value of the passByReference property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassByReference() { + return passByReference; + } + + /** + * Sets the value of the passByReference property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassByReference(String value) { + this.passByReference = value; + } + + /** + * Gets the value of the uniqueId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUniqueId() { + return uniqueId; + } + + /** + * Sets the value of the uniqueId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUniqueId(String value) { + this.uniqueId = value; + } + + /** + * Gets the value of the securityRoleMapping property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the securityRoleMapping property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getSecurityRoleMapping().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link SecurityRoleMapping } + * + * + */ + public List getSecurityRoleMapping() { + if (securityRoleMapping == null) { + securityRoleMapping = new ArrayList(); + } + return this.securityRoleMapping; + } + + /** + * Gets the value of the realm property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRealm() { + return realm; + } + + /** + * Sets the value of the realm property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRealm(String value) { + this.realm = value; + } + + /** + * Gets the value of the ejbRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the ejbRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEjbRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link EjbRef } + * + * + */ + public List getEjbRef() { + if (ejbRef == null) { + ejbRef = new ArrayList(); + } + return this.ejbRef; + } + + /** + * Gets the value of the resourceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceRef } + * + * + */ + public List getResourceRef() { + if (resourceRef == null) { + resourceRef = new ArrayList(); + } + return this.resourceRef; + } + + /** + * Gets the value of the resourceEnvRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceEnvRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceEnvRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceEnvRef } + * + * + */ + public List getResourceEnvRef() { + if (resourceEnvRef == null) { + resourceEnvRef = new ArrayList(); + } + return this.resourceEnvRef; + } + + /** + * Gets the value of the serviceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceRef } + * + * + */ + public List getServiceRef() { + if (serviceRef == null) { + serviceRef = new ArrayList(); + } + return this.serviceRef; + } + + /** + * Gets the value of the messageDestinationRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestinationRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestinationRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestinationRef } + * + * + */ + public List getMessageDestinationRef() { + if (messageDestinationRef == null) { + messageDestinationRef = new ArrayList(); + } + return this.messageDestinationRef; + } + + /** + * Gets the value of the messageDestination property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestination property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestination().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestination } + * + * + */ + public List getMessageDestination() { + if (messageDestination == null) { + messageDestination = new ArrayList(); + } + return this.messageDestination; + } + + /** + * Gets the value of the archiveName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getArchiveName() { + return archiveName; + } + + /** + * Sets the value of the archiveName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setArchiveName(String value) { + this.archiveName = value; + } + + /** + * Gets the value of the compatibility property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCompatibility() { + return compatibility; + } + + /** + * Sets the value of the compatibility property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCompatibility(String value) { + this.compatibility = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Web.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Web.java new file mode 100644 index 0000000..5d4facc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/Web.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "webUri", + "contextRoot" +}) +@XmlRootElement(name = "web") +public class Web + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "web-uri", required = true) + protected String webUri; + @XmlElement(name = "context-root", required = true) + protected String contextRoot; + + /** + * Gets the value of the webUri property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWebUri() { + return webUri; + } + + /** + * Sets the value of the webUri property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWebUri(String value) { + this.webUri = value; + } + + /** + * Gets the value of the contextRoot property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContextRoot() { + return contextRoot; + } + + /** + * Sets the value of the contextRoot property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContextRoot(String value) { + this.contextRoot = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/WsdlPort.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/WsdlPort.java new file mode 100644 index 0000000..8e9d5e4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/app/WsdlPort.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:38 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.app; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "wsdl-port") +public class WsdlPort + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/CallProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/CallProperty.java new file mode 100644 index 0000000..410b9a2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/CallProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "call-property") +public class CallProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/DefaultResourcePrincipal.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/DefaultResourcePrincipal.java new file mode 100644 index 0000000..2069b2d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/DefaultResourcePrincipal.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "password" +}) +@XmlRootElement(name = "default-resource-principal") +public class DefaultResourcePrincipal + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String password; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + /** + * Sets the value of the password property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassword(String value) { + this.password = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/EjbRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/EjbRef.java new file mode 100644 index 0000000..a077720 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/EjbRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbRefName", + "jndiName" +}) +@XmlRootElement(name = "ejb-ref") +public class EjbRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "ejb-ref-name", required = true) + protected String ejbRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the ejbRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbRefName() { + return ejbRefName; + } + + /** + * Sets the value of the ejbRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbRefName(String value) { + this.ejbRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaMethod.java new file mode 100644 index 0000000..24cf96a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaMethod.java @@ -0,0 +1,85 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "methodParams" +}) +@XmlRootElement(name = "java-method") +public class JavaMethod implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-params") + protected MethodParams methodParams; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaWebStartAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaWebStartAccess.java new file mode 100644 index 0000000..3eb1db2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JavaWebStartAccess.java @@ -0,0 +1,138 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "contextRoot", + "eligible", + "vendor", + "jnlpDoc" +}) +@XmlRootElement(name = "java-web-start-access") +public class JavaWebStartAccess + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "context-root") + protected String contextRoot; + protected String eligible; + protected String vendor; + @XmlElement(name = "jnlp-doc") + protected JnlpDoc jnlpDoc; + + /** + * Gets the value of the contextRoot property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContextRoot() { + return contextRoot; + } + + /** + * Sets the value of the contextRoot property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContextRoot(String value) { + this.contextRoot = value; + } + + /** + * Gets the value of the eligible property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEligible() { + return eligible; + } + + /** + * Sets the value of the eligible property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEligible(String value) { + this.eligible = value; + } + + /** + * Gets the value of the vendor property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVendor() { + return vendor; + } + + /** + * Sets the value of the vendor property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVendor(String value) { + this.vendor = value; + } + + /** + * Gets the value of the jnlpDoc property. + * + * @return + * possible object is + * {@link JnlpDoc } + * + */ + public JnlpDoc getJnlpDoc() { + return jnlpDoc; + } + + /** + * Sets the value of the jnlpDoc property. + * + * @param value + * allowed object is + * {@link JnlpDoc } + * + */ + public void setJnlpDoc(JnlpDoc value) { + this.jnlpDoc = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JnlpDoc.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JnlpDoc.java new file mode 100644 index 0000000..6183347 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/JnlpDoc.java @@ -0,0 +1,60 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "jnlp-doc") +public class JnlpDoc + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "href", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String href; + + /** + * Gets the value of the href property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHref() { + return href; + } + + /** + * Sets the value of the href property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHref(String value) { + this.href = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/Message.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/Message.java new file mode 100644 index 0000000..171fe7f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/Message.java @@ -0,0 +1,71 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "javaMethodOrOperationName" +}) +@XmlRootElement(name = "message") +public class Message + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElements({ + @XmlElement(name = "java-method", type = JavaMethod.class), + @XmlElement(name = "operation-name", type = OperationName.class) + }) + protected List javaMethodOrOperationName; + + /** + * Gets the value of the javaMethodOrOperationName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the javaMethodOrOperationName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getJavaMethodOrOperationName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link JavaMethod } + * {@link OperationName } + * + * + */ + public List getJavaMethodOrOperationName() { + if (javaMethodOrOperationName == null) { + javaMethodOrOperationName = new ArrayList(); + } + return this.javaMethodOrOperationName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestination.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestination.java new file mode 100644 index 0000000..fe3e502 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestination.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationName", + "jndiName" +}) +@XmlRootElement(name = "message-destination") +public class MessageDestination + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-name", required = true) + protected String messageDestinationName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationName() { + return messageDestinationName; + } + + /** + * Sets the value of the messageDestinationName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationName(String value) { + this.messageDestinationName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestinationRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestinationRef.java new file mode 100644 index 0000000..0a5416b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageDestinationRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationRefName", + "jndiName" +}) +@XmlRootElement(name = "message-destination-ref") +public class MessageDestinationRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-ref-name", required = true) + protected String messageDestinationRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationRefName() { + return messageDestinationRefName; + } + + /** + * Sets the value of the messageDestinationRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationRefName(String value) { + this.messageDestinationRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurity.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurity.java new file mode 100644 index 0000000..ba9c545 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurity.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "message", + "requestProtection", + "responseProtection" +}) +@XmlRootElement(name = "message-security") +public class MessageSecurity + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List message; + @XmlElement(name = "request-protection") + protected RequestProtection requestProtection; + @XmlElement(name = "response-protection") + protected ResponseProtection responseProtection; + + /** + * Gets the value of the message property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the message property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessage().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Message } + * + * + */ + public List getMessage() { + if (message == null) { + message = new ArrayList(); + } + return this.message; + } + + /** + * Gets the value of the requestProtection property. + * + * @return + * possible object is + * {@link RequestProtection } + * + */ + public RequestProtection getRequestProtection() { + return requestProtection; + } + + /** + * Sets the value of the requestProtection property. + * + * @param value + * allowed object is + * {@link RequestProtection } + * + */ + public void setRequestProtection(RequestProtection value) { + this.requestProtection = value; + } + + /** + * Gets the value of the responseProtection property. + * + * @return + * possible object is + * {@link ResponseProtection } + * + */ + public ResponseProtection getResponseProtection() { + return responseProtection; + } + + /** + * Sets the value of the responseProtection property. + * + * @param value + * allowed object is + * {@link ResponseProtection } + * + */ + public void setResponseProtection(ResponseProtection value) { + this.responseProtection = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurityBinding.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurityBinding.java new file mode 100644 index 0000000..ea8d9f5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MessageSecurityBinding.java @@ -0,0 +1,124 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageSecurity" +}) +@XmlRootElement(name = "message-security-binding") +public class MessageSecurityBinding + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-layer", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authLayer; + @XmlAttribute(name = "provider-id") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String providerId; + @XmlElement(name = "message-security") + protected List messageSecurity; + + /** + * Gets the value of the authLayer property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthLayer() { + return authLayer; + } + + /** + * Sets the value of the authLayer property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthLayer(String value) { + this.authLayer = value; + } + + /** + * Gets the value of the providerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProviderId() { + return providerId; + } + + /** + * Sets the value of the providerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProviderId(String value) { + this.providerId = value; + } + + /** + * Gets the value of the messageSecurity property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageSecurity property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageSecurity().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageSecurity } + * + * + */ + public List getMessageSecurity() { + if (messageSecurity == null) { + messageSecurity = new ArrayList(); + } + return this.messageSecurity; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParam.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParam.java new file mode 100644 index 0000000..b0fe4be --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParam.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "method-param") +public class MethodParam + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParams.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParams.java new file mode 100644 index 0000000..5658c72 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/MethodParams.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodParam" +}) +@XmlRootElement(name = "method-params") +public class MethodParams + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-param") + protected List methodParam; + + /** + * Gets the value of the methodParam property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the methodParam property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethodParam().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MethodParam } + * + * + */ + public List getMethodParam() { + if (methodParam == null) { + methodParam = new ArrayList(); + } + return this.methodParam; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ObjectFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ObjectFactory.java new file mode 100644 index 0000000..506c709 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ObjectFactory.java @@ -0,0 +1,231 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import jakarta.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.sun.ts.lib.implementation.sun.javaee.runtime.appclient package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sun.ts.lib.implementation.sun.javaee.runtime.appclient + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal createDefaultResourcePrincipal() { + return new DefaultResourcePrincipal(); + } + + /** + * Create an instance of {@link ServiceRef } + * + */ + public ServiceRef createServiceRef() { + return new ServiceRef(); + } + + /** + * Create an instance of {@link PortInfo } + * + */ + public PortInfo createPortInfo() { + return new PortInfo(); + } + + /** + * Create an instance of {@link CallProperty } + * + */ + public CallProperty createCallProperty() { + return new CallProperty(); + } + + /** + * Create an instance of {@link ServiceQname } + * + */ + public ServiceQname createServiceQname() { + return new ServiceQname(); + } + + /** + * Create an instance of {@link JnlpDoc } + * + */ + public JnlpDoc createJnlpDoc() { + return new JnlpDoc(); + } + + /** + * Create an instance of {@link StubProperty } + * + */ + public StubProperty createStubProperty() { + return new StubProperty(); + } + + /** + * Create an instance of {@link MethodParam } + * + */ + public MethodParam createMethodParam() { + return new MethodParam(); + } + + /** + * Create an instance of {@link MessageDestination } + * + */ + public MessageDestination createMessageDestination() { + return new MessageDestination(); + } + + /** + * Create an instance of {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding createMessageSecurityBinding() { + return new MessageSecurityBinding(); + } + + /** + * Create an instance of {@link MessageSecurity } + * + */ + public MessageSecurity createMessageSecurity() { + return new MessageSecurity(); + } + + /** + * Create an instance of {@link WsdlPort } + * + */ + public WsdlPort createWsdlPort() { + return new WsdlPort(); + } + + /** + * Create an instance of {@link JavaMethod } + * + */ + public JavaMethod createJavaMethod() { + return new JavaMethod(); + } + + /** + * Create an instance of {@link MethodParams } + * + */ + public MethodParams createMethodParams() { + return new MethodParams(); + } + + /** + * Create an instance of {@link RequestProtection } + * + */ + public RequestProtection createRequestProtection() { + return new RequestProtection(); + } + + /** + * Create an instance of {@link ResponseProtection } + * + */ + public ResponseProtection createResponseProtection() { + return new ResponseProtection(); + } + + /** + * Create an instance of {@link EjbRef } + * + */ + public EjbRef createEjbRef() { + return new EjbRef(); + } + + /** + * Create an instance of {@link ResourceRef } + * + */ + public ResourceRef createResourceRef() { + return new ResourceRef(); + } + + /** + * Create an instance of {@link JavaWebStartAccess } + * + */ + public JavaWebStartAccess createJavaWebStartAccess() { + return new JavaWebStartAccess(); + } + + /** + * Create an instance of {@link SunApplicationClient } + * + */ + public SunApplicationClient createSunApplicationClient() { + return new SunApplicationClient(); + } + + /** + * Create an instance of {@link ResourceEnvRef } + * + */ + public ResourceEnvRef createResourceEnvRef() { + return new ResourceEnvRef(); + } + + /** + * Create an instance of {@link MessageDestinationRef } + * + */ + public MessageDestinationRef createMessageDestinationRef() { + return new MessageDestinationRef(); + } + + /** + * Create an instance of {@link Message } + * + */ + public Message createMessage() { + return new Message(); + } + + /** + * Create an instance of {@link OperationName } + * + */ + public OperationName createOperationName() { + return new OperationName(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/OperationName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/OperationName.java new file mode 100644 index 0000000..8ddb715 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/OperationName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "operation-name") +public class OperationName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/PortInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/PortInfo.java new file mode 100644 index 0000000..d8bcd46 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/PortInfo.java @@ -0,0 +1,179 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceEndpointInterface", + "wsdlPort", + "stubProperty", + "callProperty", + "messageSecurityBinding" +}) +@XmlRootElement(name = "port-info") +public class PortInfo + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-endpoint-interface") + protected String serviceEndpointInterface; + @XmlElement(name = "wsdl-port") + protected WsdlPort wsdlPort; + @XmlElement(name = "stub-property") + protected List stubProperty; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "message-security-binding") + protected MessageSecurityBinding messageSecurityBinding; + + /** + * Gets the value of the serviceEndpointInterface property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceEndpointInterface() { + return serviceEndpointInterface; + } + + /** + * Sets the value of the serviceEndpointInterface property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceEndpointInterface(String value) { + this.serviceEndpointInterface = value; + } + + /** + * Gets the value of the wsdlPort property. + * + * @return + * possible object is + * {@link WsdlPort } + * + */ + public WsdlPort getWsdlPort() { + return wsdlPort; + } + + /** + * Sets the value of the wsdlPort property. + * + * @param value + * allowed object is + * {@link WsdlPort } + * + */ + public void setWsdlPort(WsdlPort value) { + this.wsdlPort = value; + } + + /** + * Gets the value of the stubProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the stubProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getStubProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link StubProperty } + * + * + */ + public List getStubProperty() { + if (stubProperty == null) { + stubProperty = new ArrayList(); + } + return this.stubProperty; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the messageSecurityBinding property. + * + * @return + * possible object is + * {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding getMessageSecurityBinding() { + return messageSecurityBinding; + } + + /** + * Sets the value of the messageSecurityBinding property. + * + * @param value + * allowed object is + * {@link MessageSecurityBinding } + * + */ + public void setMessageSecurityBinding(MessageSecurityBinding value) { + this.messageSecurityBinding = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/RequestProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/RequestProtection.java new file mode 100644 index 0000000..c38501c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/RequestProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "request-protection") +public class RequestProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceEnvRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceEnvRef.java new file mode 100644 index 0000000..01eccd7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceEnvRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resourceEnvRefName", + "jndiName" +}) +@XmlRootElement(name = "resource-env-ref") +public class ResourceEnvRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "resource-env-ref-name", required = true) + protected String resourceEnvRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the resourceEnvRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceEnvRefName() { + return resourceEnvRefName; + } + + /** + * Sets the value of the resourceEnvRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceEnvRefName(String value) { + this.resourceEnvRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceRef.java new file mode 100644 index 0000000..4b07f25 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResourceRef.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resRefName", + "jndiName", + "defaultResourcePrincipal" +}) +@XmlRootElement(name = "resource-ref") +public class ResourceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "res-ref-name", required = true) + protected String resRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + + /** + * Gets the value of the resRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResRefName() { + return resRefName; + } + + /** + * Sets the value of the resRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResRefName(String value) { + this.resRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResponseProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResponseProtection.java new file mode 100644 index 0000000..823d250 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ResponseProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "response-protection") +public class ResponseProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceQname.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceQname.java new file mode 100644 index 0000000..7add9c7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceQname.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "service-qname") +public class ServiceQname + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceRef.java new file mode 100644 index 0000000..9d6abcf --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/ServiceRef.java @@ -0,0 +1,206 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceRefName", + "portInfo", + "callProperty", + "wsdlOverride", + "serviceImplClass", + "serviceQname" +}) +@XmlRootElement(name = "service-ref") +public class ServiceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-ref-name", required = true) + protected String serviceRefName; + @XmlElement(name = "port-info") + protected List portInfo; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "wsdl-override") + protected String wsdlOverride; + @XmlElement(name = "service-impl-class") + protected String serviceImplClass; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + + /** + * Gets the value of the serviceRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceRefName() { + return serviceRefName; + } + + /** + * Sets the value of the serviceRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceRefName(String value) { + this.serviceRefName = value; + } + + /** + * Gets the value of the portInfo property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the portInfo property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPortInfo().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PortInfo } + * + * + */ + public List getPortInfo() { + if (portInfo == null) { + portInfo = new ArrayList(); + } + return this.portInfo; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the wsdlOverride property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlOverride() { + return wsdlOverride; + } + + /** + * Sets the value of the wsdlOverride property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlOverride(String value) { + this.wsdlOverride = value; + } + + /** + * Gets the value of the serviceImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceImplClass() { + return serviceImplClass; + } + + /** + * Sets the value of the serviceImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceImplClass(String value) { + this.serviceImplClass = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/StubProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/StubProperty.java new file mode 100644 index 0000000..d26417f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/StubProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "stub-property") +public class StubProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/SunApplicationClient.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/SunApplicationClient.java new file mode 100644 index 0000000..074e635 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/SunApplicationClient.java @@ -0,0 +1,253 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbRef", + "resourceRef", + "resourceEnvRef", + "serviceRef", + "messageDestinationRef", + "messageDestination", + "javaWebStartAccess" +}) +@XmlRootElement(name = "sun-application-client") +public class SunApplicationClient + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "ejb-ref") + protected List ejbRef; + @XmlElement(name = "resource-ref") + protected List resourceRef; + @XmlElement(name = "resource-env-ref") + protected List resourceEnvRef; + @XmlElement(name = "service-ref") + protected List serviceRef; + @XmlElement(name = "message-destination-ref") + protected List messageDestinationRef; + @XmlElement(name = "message-destination") + protected List messageDestination; + @XmlElement(name = "java-web-start-access") + protected JavaWebStartAccess javaWebStartAccess; + + /** + * Gets the value of the ejbRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the ejbRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEjbRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link EjbRef } + * + * + */ + public List getEjbRef() { + if (ejbRef == null) { + ejbRef = new ArrayList(); + } + return this.ejbRef; + } + + /** + * Gets the value of the resourceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceRef } + * + * + */ + public List getResourceRef() { + if (resourceRef == null) { + resourceRef = new ArrayList(); + } + return this.resourceRef; + } + + /** + * Gets the value of the resourceEnvRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceEnvRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceEnvRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceEnvRef } + * + * + */ + public List getResourceEnvRef() { + if (resourceEnvRef == null) { + resourceEnvRef = new ArrayList(); + } + return this.resourceEnvRef; + } + + /** + * Gets the value of the serviceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceRef } + * + * + */ + public List getServiceRef() { + if (serviceRef == null) { + serviceRef = new ArrayList(); + } + return this.serviceRef; + } + + /** + * Gets the value of the messageDestinationRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestinationRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestinationRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestinationRef } + * + * + */ + public List getMessageDestinationRef() { + if (messageDestinationRef == null) { + messageDestinationRef = new ArrayList(); + } + return this.messageDestinationRef; + } + + /** + * Gets the value of the messageDestination property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestination property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestination().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestination } + * + * + */ + public List getMessageDestination() { + if (messageDestination == null) { + messageDestination = new ArrayList(); + } + return this.messageDestination; + } + + /** + * Gets the value of the javaWebStartAccess property. + * + * @return + * possible object is + * {@link JavaWebStartAccess } + * + */ + public JavaWebStartAccess getJavaWebStartAccess() { + return javaWebStartAccess; + } + + /** + * Sets the value of the javaWebStartAccess property. + * + * @param value + * allowed object is + * {@link JavaWebStartAccess } + * + */ + public void setJavaWebStartAccess(JavaWebStartAccess value) { + this.javaWebStartAccess = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/WsdlPort.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/WsdlPort.java new file mode 100644 index 0000000..34b6afd --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/appclient/WsdlPort.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.appclient; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "wsdl-port") +public class WsdlPort + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfig.java new file mode 100644 index 0000000..f37ec6d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfig.java @@ -0,0 +1,92 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "description", + "activationConfigProperty" +}) +@XmlRootElement(name = "activation-config") +public class ActivationConfig + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected String description; + @XmlElement(name = "activation-config-property", required = true) + protected List activationConfigProperty; + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + + /** + * Gets the value of the activationConfigProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the activationConfigProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getActivationConfigProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ActivationConfigProperty } + * + * + */ + public List getActivationConfigProperty() { + if (activationConfigProperty == null) { + activationConfigProperty = new ArrayList(); + } + return this.activationConfigProperty; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfigProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfigProperty.java new file mode 100644 index 0000000..918d014 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ActivationConfigProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "activationConfigPropertyName", + "activationConfigPropertyValue" +}) +@XmlRootElement(name = "activation-config-property") +public class ActivationConfigProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "activation-config-property-name", required = true) + protected String activationConfigPropertyName; + @XmlElement(name = "activation-config-property-value", required = true) + protected String activationConfigPropertyValue; + + /** + * Gets the value of the activationConfigPropertyName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivationConfigPropertyName() { + return activationConfigPropertyName; + } + + /** + * Sets the value of the activationConfigPropertyName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivationConfigPropertyName(String value) { + this.activationConfigPropertyName = value; + } + + /** + * Gets the value of the activationConfigPropertyValue property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivationConfigPropertyValue() { + return activationConfigPropertyValue; + } + + /** + * Sets the value of the activationConfigPropertyValue property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivationConfigPropertyValue(String value) { + this.activationConfigPropertyValue = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/AsContext.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/AsContext.java new file mode 100644 index 0000000..325d748 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/AsContext.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "authMethod", + "realm", + "required" +}) +@XmlRootElement(name = "as-context") +public class AsContext + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "auth-method", required = true) + protected String authMethod; + @XmlElement(required = true) + protected String realm; + @XmlElement(required = true) + protected String required; + + /** + * Gets the value of the authMethod property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthMethod() { + return authMethod; + } + + /** + * Sets the value of the authMethod property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthMethod(String value) { + this.authMethod = value; + } + + /** + * Gets the value of the realm property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRealm() { + return realm; + } + + /** + * Sets the value of the realm property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRealm(String value) { + this.realm = value; + } + + /** + * Gets the value of the required property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequired() { + return required; + } + + /** + * Sets the value of the required property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequired(String value) { + this.required = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanCache.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanCache.java new file mode 100644 index 0000000..967c498 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanCache.java @@ -0,0 +1,194 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "maxCacheSize", + "resizeQuantity", + "isCacheOverflowAllowed", + "cacheIdleTimeoutInSeconds", + "removalTimeoutInSeconds", + "victimSelectionPolicy" +}) +@XmlRootElement(name = "bean-cache") +public class BeanCache + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "max-cache-size") + protected String maxCacheSize; + @XmlElement(name = "resize-quantity") + protected String resizeQuantity; + @XmlElement(name = "is-cache-overflow-allowed") + protected String isCacheOverflowAllowed; + @XmlElement(name = "cache-idle-timeout-in-seconds") + protected String cacheIdleTimeoutInSeconds; + @XmlElement(name = "removal-timeout-in-seconds") + protected String removalTimeoutInSeconds; + @XmlElement(name = "victim-selection-policy") + protected String victimSelectionPolicy; + + /** + * Gets the value of the maxCacheSize property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxCacheSize() { + return maxCacheSize; + } + + /** + * Sets the value of the maxCacheSize property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxCacheSize(String value) { + this.maxCacheSize = value; + } + + /** + * Gets the value of the resizeQuantity property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResizeQuantity() { + return resizeQuantity; + } + + /** + * Sets the value of the resizeQuantity property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResizeQuantity(String value) { + this.resizeQuantity = value; + } + + /** + * Gets the value of the isCacheOverflowAllowed property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIsCacheOverflowAllowed() { + return isCacheOverflowAllowed; + } + + /** + * Sets the value of the isCacheOverflowAllowed property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIsCacheOverflowAllowed(String value) { + this.isCacheOverflowAllowed = value; + } + + /** + * Gets the value of the cacheIdleTimeoutInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCacheIdleTimeoutInSeconds() { + return cacheIdleTimeoutInSeconds; + } + + /** + * Sets the value of the cacheIdleTimeoutInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCacheIdleTimeoutInSeconds(String value) { + this.cacheIdleTimeoutInSeconds = value; + } + + /** + * Gets the value of the removalTimeoutInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRemovalTimeoutInSeconds() { + return removalTimeoutInSeconds; + } + + /** + * Sets the value of the removalTimeoutInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRemovalTimeoutInSeconds(String value) { + this.removalTimeoutInSeconds = value; + } + + /** + * Gets the value of the victimSelectionPolicy property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVictimSelectionPolicy() { + return victimSelectionPolicy; + } + + /** + * Sets the value of the victimSelectionPolicy property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVictimSelectionPolicy(String value) { + this.victimSelectionPolicy = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanPool.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanPool.java new file mode 100644 index 0000000..f77d2e2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/BeanPool.java @@ -0,0 +1,167 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "steadyPoolSize", + "resizeQuantity", + "maxPoolSize", + "poolIdleTimeoutInSeconds", + "maxWaitTimeInMillis" +}) +@XmlRootElement(name = "bean-pool") +public class BeanPool + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "steady-pool-size") + protected String steadyPoolSize; + @XmlElement(name = "resize-quantity") + protected String resizeQuantity; + @XmlElement(name = "max-pool-size") + protected String maxPoolSize; + @XmlElement(name = "pool-idle-timeout-in-seconds") + protected String poolIdleTimeoutInSeconds; + @XmlElement(name = "max-wait-time-in-millis") + protected String maxWaitTimeInMillis; + + /** + * Gets the value of the steadyPoolSize property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSteadyPoolSize() { + return steadyPoolSize; + } + + /** + * Sets the value of the steadyPoolSize property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSteadyPoolSize(String value) { + this.steadyPoolSize = value; + } + + /** + * Gets the value of the resizeQuantity property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResizeQuantity() { + return resizeQuantity; + } + + /** + * Sets the value of the resizeQuantity property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResizeQuantity(String value) { + this.resizeQuantity = value; + } + + /** + * Gets the value of the maxPoolSize property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxPoolSize() { + return maxPoolSize; + } + + /** + * Sets the value of the maxPoolSize property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxPoolSize(String value) { + this.maxPoolSize = value; + } + + /** + * Gets the value of the poolIdleTimeoutInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoolIdleTimeoutInSeconds() { + return poolIdleTimeoutInSeconds; + } + + /** + * Sets the value of the poolIdleTimeoutInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoolIdleTimeoutInSeconds(String value) { + this.poolIdleTimeoutInSeconds = value; + } + + /** + * Gets the value of the maxWaitTimeInMillis property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxWaitTimeInMillis() { + return maxWaitTimeInMillis; + } + + /** + * Sets the value of the maxWaitTimeInMillis property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxWaitTimeInMillis(String value) { + this.maxWaitTimeInMillis = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CallProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CallProperty.java new file mode 100644 index 0000000..e26fc8b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CallProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "call-property") +public class CallProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CheckpointAtEndOfMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CheckpointAtEndOfMethod.java new file mode 100644 index 0000000..dca6593 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CheckpointAtEndOfMethod.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "method" +}) +@XmlRootElement(name = "checkpoint-at-end-of-method") +public class CheckpointAtEndOfMethod + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List method; + + /** + * Gets the value of the method property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the method property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethod().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Method } + * + * + */ + public List getMethod() { + if (method == null) { + method = new ArrayList(); + } + return this.method; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Cmp.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Cmp.java new file mode 100644 index 0000000..8e3837e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Cmp.java @@ -0,0 +1,140 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "mappingProperties", + "isOneOneCmp", + "oneOneFinders", + "prefetchDisabled" +}) +@XmlRootElement(name = "cmp") +public class Cmp + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "mapping-properties") + protected String mappingProperties; + @XmlElement(name = "is-one-one-cmp") + protected String isOneOneCmp; + @XmlElement(name = "one-one-finders") + protected OneOneFinders oneOneFinders; + @XmlElement(name = "prefetch-disabled") + protected PrefetchDisabled prefetchDisabled; + + /** + * Gets the value of the mappingProperties property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMappingProperties() { + return mappingProperties; + } + + /** + * Sets the value of the mappingProperties property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMappingProperties(String value) { + this.mappingProperties = value; + } + + /** + * Gets the value of the isOneOneCmp property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIsOneOneCmp() { + return isOneOneCmp; + } + + /** + * Sets the value of the isOneOneCmp property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIsOneOneCmp(String value) { + this.isOneOneCmp = value; + } + + /** + * Gets the value of the oneOneFinders property. + * + * @return + * possible object is + * {@link OneOneFinders } + * + */ + public OneOneFinders getOneOneFinders() { + return oneOneFinders; + } + + /** + * Sets the value of the oneOneFinders property. + * + * @param value + * allowed object is + * {@link OneOneFinders } + * + */ + public void setOneOneFinders(OneOneFinders value) { + this.oneOneFinders = value; + } + + /** + * Gets the value of the prefetchDisabled property. + * + * @return + * possible object is + * {@link PrefetchDisabled } + * + */ + public PrefetchDisabled getPrefetchDisabled() { + return prefetchDisabled; + } + + /** + * Sets the value of the prefetchDisabled property. + * + * @param value + * allowed object is + * {@link PrefetchDisabled } + * + */ + public void setPrefetchDisabled(PrefetchDisabled value) { + this.prefetchDisabled = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CmpResource.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CmpResource.java new file mode 100644 index 0000000..7453639 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/CmpResource.java @@ -0,0 +1,227 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "jndiName", + "defaultResourcePrincipal", + "property", + "createTablesAtDeploy", + "dropTablesAtUndeploy", + "databaseVendorName", + "schemaGeneratorProperties" +}) +@XmlRootElement(name = "cmp-resource") +public class CmpResource + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + protected List property; + @XmlElement(name = "create-tables-at-deploy") + protected String createTablesAtDeploy; + @XmlElement(name = "drop-tables-at-undeploy") + protected String dropTablesAtUndeploy; + @XmlElement(name = "database-vendor-name") + protected String databaseVendorName; + @XmlElement(name = "schema-generator-properties") + protected SchemaGeneratorProperties schemaGeneratorProperties; + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + + /** + * Gets the value of the createTablesAtDeploy property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCreateTablesAtDeploy() { + return createTablesAtDeploy; + } + + /** + * Sets the value of the createTablesAtDeploy property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCreateTablesAtDeploy(String value) { + this.createTablesAtDeploy = value; + } + + /** + * Gets the value of the dropTablesAtUndeploy property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDropTablesAtUndeploy() { + return dropTablesAtUndeploy; + } + + /** + * Sets the value of the dropTablesAtUndeploy property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDropTablesAtUndeploy(String value) { + this.dropTablesAtUndeploy = value; + } + + /** + * Gets the value of the databaseVendorName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDatabaseVendorName() { + return databaseVendorName; + } + + /** + * Sets the value of the databaseVendorName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDatabaseVendorName(String value) { + this.databaseVendorName = value; + } + + /** + * Gets the value of the schemaGeneratorProperties property. + * + * @return + * possible object is + * {@link SchemaGeneratorProperties } + * + */ + public SchemaGeneratorProperties getSchemaGeneratorProperties() { + return schemaGeneratorProperties; + } + + /** + * Sets the value of the schemaGeneratorProperties property. + * + * @param value + * allowed object is + * {@link SchemaGeneratorProperties } + * + */ + public void setSchemaGeneratorProperties(SchemaGeneratorProperties value) { + this.schemaGeneratorProperties = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/DefaultResourcePrincipal.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/DefaultResourcePrincipal.java new file mode 100644 index 0000000..136be11 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/DefaultResourcePrincipal.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "password" +}) +@XmlRootElement(name = "default-resource-principal") +public class DefaultResourcePrincipal + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String password; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + /** + * Sets the value of the password property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassword(String value) { + this.password = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Ejb.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Ejb.java new file mode 100644 index 0000000..119db58 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Ejb.java @@ -0,0 +1,821 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbName", + "jndiName", + "ejbRef", + "resourceRef", + "resourceEnvRef", + "serviceRef", + "messageDestinationRef", + "passByReference", + "cmp", + "principal", + "mdbConnectionFactory", + "jmsDurableSubscriptionName", + "jmsMaxMessagesLoad", + "iorSecurityConfig", + "isReadOnlyBean", + "refreshPeriodInSeconds", + "commitOption", + "cmtTimeoutInSeconds", + "useThreadPoolId", + "genClasses", + "beanPool", + "beanCache", + "mdbResourceAdapter", + "webserviceEndpoint", + "flushAtEndOfMethod", + "checkpointedMethods", + "checkpointAtEndOfMethod" +}) +@XmlRootElement(name = "ejb") +public class Ejb + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "availability-enabled") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String availabilityEnabled; + @XmlElement(name = "ejb-name", required = true) + protected String ejbName; + @XmlElement(name = "jndi-name") + protected String jndiName; + @XmlElement(name = "ejb-ref") + protected List ejbRef; + @XmlElement(name = "resource-ref") + protected List resourceRef; + @XmlElement(name = "resource-env-ref") + protected List resourceEnvRef; + @XmlElement(name = "service-ref") + protected List serviceRef; + @XmlElement(name = "message-destination-ref") + protected List messageDestinationRef; + @XmlElement(name = "pass-by-reference") + protected String passByReference; + protected Cmp cmp; + protected Principal principal; + @XmlElement(name = "mdb-connection-factory") + protected MdbConnectionFactory mdbConnectionFactory; + @XmlElement(name = "jms-durable-subscription-name") + protected String jmsDurableSubscriptionName; + @XmlElement(name = "jms-max-messages-load") + protected String jmsMaxMessagesLoad; + @XmlElement(name = "ior-security-config") + protected IorSecurityConfig iorSecurityConfig; + @XmlElement(name = "is-read-only-bean") + protected String isReadOnlyBean; + @XmlElement(name = "refresh-period-in-seconds") + protected String refreshPeriodInSeconds; + @XmlElement(name = "commit-option") + protected String commitOption; + @XmlElement(name = "cmt-timeout-in-seconds") + protected String cmtTimeoutInSeconds; + @XmlElement(name = "use-thread-pool-id") + protected String useThreadPoolId; + @XmlElement(name = "gen-classes") + protected GenClasses genClasses; + @XmlElement(name = "bean-pool") + protected BeanPool beanPool; + @XmlElement(name = "bean-cache") + protected BeanCache beanCache; + @XmlElement(name = "mdb-resource-adapter") + protected MdbResourceAdapter mdbResourceAdapter; + @XmlElement(name = "webservice-endpoint") + protected List webserviceEndpoint; + @XmlElement(name = "flush-at-end-of-method") + protected FlushAtEndOfMethod flushAtEndOfMethod; + @XmlElement(name = "checkpointed-methods") + protected String checkpointedMethods; + @XmlElement(name = "checkpoint-at-end-of-method") + protected CheckpointAtEndOfMethod checkpointAtEndOfMethod; + + /** + * Gets the value of the availabilityEnabled property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAvailabilityEnabled() { + return availabilityEnabled; + } + + /** + * Sets the value of the availabilityEnabled property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAvailabilityEnabled(String value) { + this.availabilityEnabled = value; + } + + /** + * Gets the value of the ejbName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbName() { + return ejbName; + } + + /** + * Sets the value of the ejbName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbName(String value) { + this.ejbName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the ejbRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the ejbRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEjbRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link EjbRef } + * + * + */ + public List getEjbRef() { + if (ejbRef == null) { + ejbRef = new ArrayList(); + } + return this.ejbRef; + } + + /** + * Gets the value of the resourceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceRef } + * + * + */ + public List getResourceRef() { + if (resourceRef == null) { + resourceRef = new ArrayList(); + } + return this.resourceRef; + } + + /** + * Gets the value of the resourceEnvRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceEnvRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceEnvRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceEnvRef } + * + * + */ + public List getResourceEnvRef() { + if (resourceEnvRef == null) { + resourceEnvRef = new ArrayList(); + } + return this.resourceEnvRef; + } + + /** + * Gets the value of the serviceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceRef } + * + * + */ + public List getServiceRef() { + if (serviceRef == null) { + serviceRef = new ArrayList(); + } + return this.serviceRef; + } + + /** + * Gets the value of the messageDestinationRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestinationRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestinationRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestinationRef } + * + * + */ + public List getMessageDestinationRef() { + if (messageDestinationRef == null) { + messageDestinationRef = new ArrayList(); + } + return this.messageDestinationRef; + } + + /** + * Gets the value of the passByReference property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassByReference() { + return passByReference; + } + + /** + * Sets the value of the passByReference property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassByReference(String value) { + this.passByReference = value; + } + + /** + * Gets the value of the cmp property. + * + * @return + * possible object is + * {@link Cmp } + * + */ + public Cmp getCmp() { + return cmp; + } + + /** + * Sets the value of the cmp property. + * + * @param value + * allowed object is + * {@link Cmp } + * + */ + public void setCmp(Cmp value) { + this.cmp = value; + } + + /** + * Gets the value of the principal property. + * + * @return + * possible object is + * {@link Principal } + * + */ + public Principal getPrincipal() { + return principal; + } + + /** + * Sets the value of the principal property. + * + * @param value + * allowed object is + * {@link Principal } + * + */ + public void setPrincipal(Principal value) { + this.principal = value; + } + + /** + * Gets the value of the mdbConnectionFactory property. + * + * @return + * possible object is + * {@link MdbConnectionFactory } + * + */ + public MdbConnectionFactory getMdbConnectionFactory() { + return mdbConnectionFactory; + } + + /** + * Sets the value of the mdbConnectionFactory property. + * + * @param value + * allowed object is + * {@link MdbConnectionFactory } + * + */ + public void setMdbConnectionFactory(MdbConnectionFactory value) { + this.mdbConnectionFactory = value; + } + + /** + * Gets the value of the jmsDurableSubscriptionName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJmsDurableSubscriptionName() { + return jmsDurableSubscriptionName; + } + + /** + * Sets the value of the jmsDurableSubscriptionName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJmsDurableSubscriptionName(String value) { + this.jmsDurableSubscriptionName = value; + } + + /** + * Gets the value of the jmsMaxMessagesLoad property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJmsMaxMessagesLoad() { + return jmsMaxMessagesLoad; + } + + /** + * Sets the value of the jmsMaxMessagesLoad property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJmsMaxMessagesLoad(String value) { + this.jmsMaxMessagesLoad = value; + } + + /** + * Gets the value of the iorSecurityConfig property. + * + * @return + * possible object is + * {@link IorSecurityConfig } + * + */ + public IorSecurityConfig getIorSecurityConfig() { + return iorSecurityConfig; + } + + /** + * Sets the value of the iorSecurityConfig property. + * + * @param value + * allowed object is + * {@link IorSecurityConfig } + * + */ + public void setIorSecurityConfig(IorSecurityConfig value) { + this.iorSecurityConfig = value; + } + + /** + * Gets the value of the isReadOnlyBean property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIsReadOnlyBean() { + return isReadOnlyBean; + } + + /** + * Sets the value of the isReadOnlyBean property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIsReadOnlyBean(String value) { + this.isReadOnlyBean = value; + } + + /** + * Gets the value of the refreshPeriodInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRefreshPeriodInSeconds() { + return refreshPeriodInSeconds; + } + + /** + * Sets the value of the refreshPeriodInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRefreshPeriodInSeconds(String value) { + this.refreshPeriodInSeconds = value; + } + + /** + * Gets the value of the commitOption property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCommitOption() { + return commitOption; + } + + /** + * Sets the value of the commitOption property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCommitOption(String value) { + this.commitOption = value; + } + + /** + * Gets the value of the cmtTimeoutInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCmtTimeoutInSeconds() { + return cmtTimeoutInSeconds; + } + + /** + * Sets the value of the cmtTimeoutInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCmtTimeoutInSeconds(String value) { + this.cmtTimeoutInSeconds = value; + } + + /** + * Gets the value of the useThreadPoolId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUseThreadPoolId() { + return useThreadPoolId; + } + + /** + * Sets the value of the useThreadPoolId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUseThreadPoolId(String value) { + this.useThreadPoolId = value; + } + + /** + * Gets the value of the genClasses property. + * + * @return + * possible object is + * {@link GenClasses } + * + */ + public GenClasses getGenClasses() { + return genClasses; + } + + /** + * Sets the value of the genClasses property. + * + * @param value + * allowed object is + * {@link GenClasses } + * + */ + public void setGenClasses(GenClasses value) { + this.genClasses = value; + } + + /** + * Gets the value of the beanPool property. + * + * @return + * possible object is + * {@link BeanPool } + * + */ + public BeanPool getBeanPool() { + return beanPool; + } + + /** + * Sets the value of the beanPool property. + * + * @param value + * allowed object is + * {@link BeanPool } + * + */ + public void setBeanPool(BeanPool value) { + this.beanPool = value; + } + + /** + * Gets the value of the beanCache property. + * + * @return + * possible object is + * {@link BeanCache } + * + */ + public BeanCache getBeanCache() { + return beanCache; + } + + /** + * Sets the value of the beanCache property. + * + * @param value + * allowed object is + * {@link BeanCache } + * + */ + public void setBeanCache(BeanCache value) { + this.beanCache = value; + } + + /** + * Gets the value of the mdbResourceAdapter property. + * + * @return + * possible object is + * {@link MdbResourceAdapter } + * + */ + public MdbResourceAdapter getMdbResourceAdapter() { + return mdbResourceAdapter; + } + + /** + * Sets the value of the mdbResourceAdapter property. + * + * @param value + * allowed object is + * {@link MdbResourceAdapter } + * + */ + public void setMdbResourceAdapter(MdbResourceAdapter value) { + this.mdbResourceAdapter = value; + } + + /** + * Gets the value of the webserviceEndpoint property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the webserviceEndpoint property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getWebserviceEndpoint().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link WebserviceEndpoint } + * + * + */ + public List getWebserviceEndpoint() { + if (webserviceEndpoint == null) { + webserviceEndpoint = new ArrayList(); + } + return this.webserviceEndpoint; + } + + /** + * Gets the value of the flushAtEndOfMethod property. + * + * @return + * possible object is + * {@link FlushAtEndOfMethod } + * + */ + public FlushAtEndOfMethod getFlushAtEndOfMethod() { + return flushAtEndOfMethod; + } + + /** + * Sets the value of the flushAtEndOfMethod property. + * + * @param value + * allowed object is + * {@link FlushAtEndOfMethod } + * + */ + public void setFlushAtEndOfMethod(FlushAtEndOfMethod value) { + this.flushAtEndOfMethod = value; + } + + /** + * Gets the value of the checkpointedMethods property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCheckpointedMethods() { + return checkpointedMethods; + } + + /** + * Sets the value of the checkpointedMethods property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCheckpointedMethods(String value) { + this.checkpointedMethods = value; + } + + /** + * Gets the value of the checkpointAtEndOfMethod property. + * + * @return + * possible object is + * {@link CheckpointAtEndOfMethod } + * + */ + public CheckpointAtEndOfMethod getCheckpointAtEndOfMethod() { + return checkpointAtEndOfMethod; + } + + /** + * Sets the value of the checkpointAtEndOfMethod property. + * + * @param value + * allowed object is + * {@link CheckpointAtEndOfMethod } + * + */ + public void setCheckpointAtEndOfMethod(CheckpointAtEndOfMethod value) { + this.checkpointAtEndOfMethod = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EjbRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EjbRef.java new file mode 100644 index 0000000..a3c9044 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EjbRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbRefName", + "jndiName" +}) +@XmlRootElement(name = "ejb-ref") +public class EjbRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "ejb-ref-name", required = true) + protected String ejbRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the ejbRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbRefName() { + return ejbRefName; + } + + /** + * Sets the value of the ejbRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbRefName(String value) { + this.ejbRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EnterpriseBeans.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EnterpriseBeans.java new file mode 100644 index 0000000..e490afc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/EnterpriseBeans.java @@ -0,0 +1,236 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "uniqueId", + "ejb", + "pmDescriptors", + "cmpResource", + "messageDestination", + "webserviceDescription" +}) +@XmlRootElement(name = "enterprise-beans") +public class EnterpriseBeans + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected String name; + @XmlElement(name = "unique-id") + protected String uniqueId; + protected List ejb; + @XmlElement(name = "pm-descriptors") + protected PmDescriptors pmDescriptors; + @XmlElement(name = "cmp-resource") + protected CmpResource cmpResource; + @XmlElement(name = "message-destination") + protected List messageDestination; + @XmlElement(name = "webservice-description") + protected List webserviceDescription; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the uniqueId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUniqueId() { + return uniqueId; + } + + /** + * Sets the value of the uniqueId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUniqueId(String value) { + this.uniqueId = value; + } + + /** + * Gets the value of the ejb property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the ejb property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEjb().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Ejb } + * + * + */ + public List getEjb() { + if (ejb == null) { + ejb = new ArrayList(); + } + return this.ejb; + } + + /** + * Gets the value of the pmDescriptors property. + * + * @return + * possible object is + * {@link PmDescriptors } + * + */ + public PmDescriptors getPmDescriptors() { + return pmDescriptors; + } + + /** + * Sets the value of the pmDescriptors property. + * + * @param value + * allowed object is + * {@link PmDescriptors } + * + */ + public void setPmDescriptors(PmDescriptors value) { + this.pmDescriptors = value; + } + + /** + * Gets the value of the cmpResource property. + * + * @return + * possible object is + * {@link CmpResource } + * + */ + public CmpResource getCmpResource() { + return cmpResource; + } + + /** + * Sets the value of the cmpResource property. + * + * @param value + * allowed object is + * {@link CmpResource } + * + */ + public void setCmpResource(CmpResource value) { + this.cmpResource = value; + } + + /** + * Gets the value of the messageDestination property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestination property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestination().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestination } + * + * + */ + public List getMessageDestination() { + if (messageDestination == null) { + messageDestination = new ArrayList(); + } + return this.messageDestination; + } + + /** + * Gets the value of the webserviceDescription property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the webserviceDescription property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getWebserviceDescription().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link WebserviceDescription } + * + * + */ + public List getWebserviceDescription() { + if (webserviceDescription == null) { + webserviceDescription = new ArrayList(); + } + return this.webserviceDescription; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Finder.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Finder.java new file mode 100644 index 0000000..6928715 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Finder.java @@ -0,0 +1,167 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "queryParams", + "queryFilter", + "queryVariables", + "queryOrdering" +}) +@XmlRootElement(name = "finder") +public class Finder + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "query-params") + protected String queryParams; + @XmlElement(name = "query-filter") + protected String queryFilter; + @XmlElement(name = "query-variables") + protected String queryVariables; + @XmlElement(name = "query-ordering") + protected String queryOrdering; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the queryParams property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQueryParams() { + return queryParams; + } + + /** + * Sets the value of the queryParams property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQueryParams(String value) { + this.queryParams = value; + } + + /** + * Gets the value of the queryFilter property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQueryFilter() { + return queryFilter; + } + + /** + * Sets the value of the queryFilter property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQueryFilter(String value) { + this.queryFilter = value; + } + + /** + * Gets the value of the queryVariables property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQueryVariables() { + return queryVariables; + } + + /** + * Sets the value of the queryVariables property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQueryVariables(String value) { + this.queryVariables = value; + } + + /** + * Gets the value of the queryOrdering property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQueryOrdering() { + return queryOrdering; + } + + /** + * Sets the value of the queryOrdering property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQueryOrdering(String value) { + this.queryOrdering = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/FlushAtEndOfMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/FlushAtEndOfMethod.java new file mode 100644 index 0000000..accf31c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/FlushAtEndOfMethod.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "method" +}) +@XmlRootElement(name = "flush-at-end-of-method") +public class FlushAtEndOfMethod + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List method; + + /** + * Gets the value of the method property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the method property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethod().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Method } + * + * + */ + public List getMethod() { + if (method == null) { + method = new ArrayList(); + } + return this.method; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GenClasses.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GenClasses.java new file mode 100644 index 0000000..6c2d152 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GenClasses.java @@ -0,0 +1,140 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "remoteImpl", + "localImpl", + "remoteHomeImpl", + "localHomeImpl" +}) +@XmlRootElement(name = "gen-classes") +public class GenClasses + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "remote-impl") + protected String remoteImpl; + @XmlElement(name = "local-impl") + protected String localImpl; + @XmlElement(name = "remote-home-impl") + protected String remoteHomeImpl; + @XmlElement(name = "local-home-impl") + protected String localHomeImpl; + + /** + * Gets the value of the remoteImpl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRemoteImpl() { + return remoteImpl; + } + + /** + * Sets the value of the remoteImpl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRemoteImpl(String value) { + this.remoteImpl = value; + } + + /** + * Gets the value of the localImpl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalImpl() { + return localImpl; + } + + /** + * Sets the value of the localImpl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalImpl(String value) { + this.localImpl = value; + } + + /** + * Gets the value of the remoteHomeImpl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRemoteHomeImpl() { + return remoteHomeImpl; + } + + /** + * Sets the value of the remoteHomeImpl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRemoteHomeImpl(String value) { + this.remoteHomeImpl = value; + } + + /** + * Gets the value of the localHomeImpl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalHomeImpl() { + return localHomeImpl; + } + + /** + * Sets the value of the localHomeImpl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalHomeImpl(String value) { + this.localHomeImpl = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GroupName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GroupName.java new file mode 100644 index 0000000..803f3e1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/GroupName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "group-name") +public class GroupName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/IorSecurityConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/IorSecurityConfig.java new file mode 100644 index 0000000..5525040 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/IorSecurityConfig.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "transportConfig", + "asContext", + "sasContext" +}) +@XmlRootElement(name = "ior-security-config") +public class IorSecurityConfig + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "transport-config") + protected TransportConfig transportConfig; + @XmlElement(name = "as-context") + protected AsContext asContext; + @XmlElement(name = "sas-context") + protected SasContext sasContext; + + /** + * Gets the value of the transportConfig property. + * + * @return + * possible object is + * {@link TransportConfig } + * + */ + public TransportConfig getTransportConfig() { + return transportConfig; + } + + /** + * Sets the value of the transportConfig property. + * + * @param value + * allowed object is + * {@link TransportConfig } + * + */ + public void setTransportConfig(TransportConfig value) { + this.transportConfig = value; + } + + /** + * Gets the value of the asContext property. + * + * @return + * possible object is + * {@link AsContext } + * + */ + public AsContext getAsContext() { + return asContext; + } + + /** + * Sets the value of the asContext property. + * + * @param value + * allowed object is + * {@link AsContext } + * + */ + public void setAsContext(AsContext value) { + this.asContext = value; + } + + /** + * Gets the value of the sasContext property. + * + * @return + * possible object is + * {@link SasContext } + * + */ + public SasContext getSasContext() { + return sasContext; + } + + /** + * Sets the value of the sasContext property. + * + * @param value + * allowed object is + * {@link SasContext } + * + */ + public void setSasContext(SasContext value) { + this.sasContext = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/JavaMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/JavaMethod.java new file mode 100644 index 0000000..0e6cc70 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/JavaMethod.java @@ -0,0 +1,85 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "methodParams" +}) +@XmlRootElement(name = "java-method") +public class JavaMethod implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-params") + protected MethodParams methodParams; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/LoginConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/LoginConfig.java new file mode 100644 index 0000000..c5e6884 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/LoginConfig.java @@ -0,0 +1,84 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "authMethod", + "realm" +}) +@XmlRootElement(name = "login-config") +public class LoginConfig implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "auth-method", required = true) + protected String authMethod; + protected String realm; + + /** + * Gets the value of the authMethod property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthMethod() { + return authMethod; + } + + /** + * Sets the value of the authMethod property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthMethod(String value) { + this.authMethod = value; + } + + /** + * Gets the value of the realm property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRealm() { + return realm; + } + + /** + * Sets the value of the realm property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRealm(String value) { + this.realm = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbConnectionFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbConnectionFactory.java new file mode 100644 index 0000000..bc0b4c2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbConnectionFactory.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "jndiName", + "defaultResourcePrincipal" +}) +@XmlRootElement(name = "mdb-connection-factory") +public class MdbConnectionFactory + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbResourceAdapter.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbResourceAdapter.java new file mode 100644 index 0000000..4d7d6ff --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MdbResourceAdapter.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resourceAdapterMid", + "activationConfig" +}) +@XmlRootElement(name = "mdb-resource-adapter") +public class MdbResourceAdapter + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "resource-adapter-mid", required = true) + protected String resourceAdapterMid; + @XmlElement(name = "activation-config") + protected ActivationConfig activationConfig; + + /** + * Gets the value of the resourceAdapterMid property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceAdapterMid() { + return resourceAdapterMid; + } + + /** + * Sets the value of the resourceAdapterMid property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceAdapterMid(String value) { + this.resourceAdapterMid = value; + } + + /** + * Gets the value of the activationConfig property. + * + * @return + * possible object is + * {@link ActivationConfig } + * + */ + public ActivationConfig getActivationConfig() { + return activationConfig; + } + + /** + * Sets the value of the activationConfig property. + * + * @param value + * allowed object is + * {@link ActivationConfig } + * + */ + public void setActivationConfig(ActivationConfig value) { + this.activationConfig = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Message.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Message.java new file mode 100644 index 0000000..92b53af --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Message.java @@ -0,0 +1,71 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "javaMethodOrOperationName" +}) +@XmlRootElement(name = "message") +public class Message + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElements({ + @XmlElement(name = "java-method", type = JavaMethod.class), + @XmlElement(name = "operation-name", type = OperationName.class) + }) + protected List javaMethodOrOperationName; + + /** + * Gets the value of the javaMethodOrOperationName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the javaMethodOrOperationName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getJavaMethodOrOperationName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link JavaMethod } + * {@link OperationName } + * + * + */ + public List getJavaMethodOrOperationName() { + if (javaMethodOrOperationName == null) { + javaMethodOrOperationName = new ArrayList(); + } + return this.javaMethodOrOperationName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestination.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestination.java new file mode 100644 index 0000000..3e18093 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestination.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationName", + "jndiName" +}) +@XmlRootElement(name = "message-destination") +public class MessageDestination + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-name", required = true) + protected String messageDestinationName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationName() { + return messageDestinationName; + } + + /** + * Sets the value of the messageDestinationName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationName(String value) { + this.messageDestinationName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestinationRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestinationRef.java new file mode 100644 index 0000000..465ae89 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageDestinationRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationRefName", + "jndiName" +}) +@XmlRootElement(name = "message-destination-ref") +public class MessageDestinationRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-ref-name", required = true) + protected String messageDestinationRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationRefName() { + return messageDestinationRefName; + } + + /** + * Sets the value of the messageDestinationRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationRefName(String value) { + this.messageDestinationRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurity.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurity.java new file mode 100644 index 0000000..c9f38e7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurity.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "message", + "requestProtection", + "responseProtection" +}) +@XmlRootElement(name = "message-security") +public class MessageSecurity + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List message; + @XmlElement(name = "request-protection") + protected RequestProtection requestProtection; + @XmlElement(name = "response-protection") + protected ResponseProtection responseProtection; + + /** + * Gets the value of the message property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the message property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessage().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Message } + * + * + */ + public List getMessage() { + if (message == null) { + message = new ArrayList(); + } + return this.message; + } + + /** + * Gets the value of the requestProtection property. + * + * @return + * possible object is + * {@link RequestProtection } + * + */ + public RequestProtection getRequestProtection() { + return requestProtection; + } + + /** + * Sets the value of the requestProtection property. + * + * @param value + * allowed object is + * {@link RequestProtection } + * + */ + public void setRequestProtection(RequestProtection value) { + this.requestProtection = value; + } + + /** + * Gets the value of the responseProtection property. + * + * @return + * possible object is + * {@link ResponseProtection } + * + */ + public ResponseProtection getResponseProtection() { + return responseProtection; + } + + /** + * Sets the value of the responseProtection property. + * + * @param value + * allowed object is + * {@link ResponseProtection } + * + */ + public void setResponseProtection(ResponseProtection value) { + this.responseProtection = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurityBinding.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurityBinding.java new file mode 100644 index 0000000..2e3b168 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MessageSecurityBinding.java @@ -0,0 +1,123 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageSecurity" +}) +@XmlRootElement(name = "message-security-binding") +public class MessageSecurityBinding implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-layer", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authLayer; + @XmlAttribute(name = "provider-id") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String providerId; + @XmlElement(name = "message-security") + protected List messageSecurity; + + /** + * Gets the value of the authLayer property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthLayer() { + return authLayer; + } + + /** + * Sets the value of the authLayer property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthLayer(String value) { + this.authLayer = value; + } + + /** + * Gets the value of the providerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProviderId() { + return providerId; + } + + /** + * Sets the value of the providerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProviderId(String value) { + this.providerId = value; + } + + /** + * Gets the value of the messageSecurity property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageSecurity property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageSecurity().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageSecurity } + * + * + */ + public List getMessageSecurity() { + if (messageSecurity == null) { + messageSecurity = new ArrayList(); + } + return this.messageSecurity; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Method.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Method.java new file mode 100644 index 0000000..7c6a7b9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Method.java @@ -0,0 +1,166 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "description", + "ejbName", + "methodName", + "methodIntf", + "methodParams" +}) +@XmlRootElement(name = "method") +public class Method + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected String description; + @XmlElement(name = "ejb-name") + protected String ejbName; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-intf") + protected String methodIntf; + @XmlElement(name = "method-params") + protected MethodParams methodParams; + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + + /** + * Gets the value of the ejbName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbName() { + return ejbName; + } + + /** + * Sets the value of the ejbName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbName(String value) { + this.ejbName = value; + } + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodIntf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodIntf() { + return methodIntf; + } + + /** + * Sets the value of the methodIntf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodIntf(String value) { + this.methodIntf = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParam.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParam.java new file mode 100644 index 0000000..ff4467d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParam.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "method-param") +public class MethodParam + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParams.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParams.java new file mode 100644 index 0000000..a8f34a2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/MethodParams.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodParam" +}) +@XmlRootElement(name = "method-params") +public class MethodParams + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-param") + protected List methodParam; + + /** + * Gets the value of the methodParam property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the methodParam property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethodParam().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MethodParam } + * + * + */ + public List getMethodParam() { + if (methodParam == null) { + methodParam = new ArrayList(); + } + return this.methodParam; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ObjectFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ObjectFactory.java new file mode 100644 index 0000000..864a6b1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ObjectFactory.java @@ -0,0 +1,487 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import jakarta.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.sun.ts.lib.implementation.sun.javaee.runtime.ejb package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sun.ts.lib.implementation.sun.javaee.runtime.ejb + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MethodParam } + * + */ + public MethodParam createMethodParam() { + return new MethodParam(); + } + + /** + * Create an instance of {@link EjbRef } + * + */ + public EjbRef createEjbRef() { + return new EjbRef(); + } + + /** + * Create an instance of {@link LoginConfig } + * + */ + public LoginConfig createLoginConfig() { + return new LoginConfig(); + } + + /** + * Create an instance of {@link EnterpriseBeans } + * + */ + public EnterpriseBeans createEnterpriseBeans() { + return new EnterpriseBeans(); + } + + /** + * Create an instance of {@link Ejb } + * + */ + public Ejb createEjb() { + return new Ejb(); + } + + /** + * Create an instance of {@link PmDescriptors } + * + */ + public PmDescriptors createPmDescriptors() { + return new PmDescriptors(); + } + + /** + * Create an instance of {@link CmpResource } + * + */ + public CmpResource createCmpResource() { + return new CmpResource(); + } + + /** + * Create an instance of {@link MessageDestination } + * + */ + public MessageDestination createMessageDestination() { + return new MessageDestination(); + } + + /** + * Create an instance of {@link WebserviceDescription } + * + */ + public WebserviceDescription createWebserviceDescription() { + return new WebserviceDescription(); + } + + /** + * Create an instance of {@link Property } + * + */ + public Property createProperty() { + return new Property(); + } + + /** + * Create an instance of {@link ActivationConfig } + * + */ + public ActivationConfig createActivationConfig() { + return new ActivationConfig(); + } + + /** + * Create an instance of {@link ActivationConfigProperty } + * + */ + public ActivationConfigProperty createActivationConfigProperty() { + return new ActivationConfigProperty(); + } + + /** + * Create an instance of {@link WebserviceEndpoint } + * + */ + public WebserviceEndpoint createWebserviceEndpoint() { + return new WebserviceEndpoint(); + } + + /** + * Create an instance of {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding createMessageSecurityBinding() { + return new MessageSecurityBinding(); + } + + /** + * Create an instance of {@link ServiceQname } + * + */ + public ServiceQname createServiceQname() { + return new ServiceQname(); + } + + /** + * Create an instance of {@link PmInuse } + * + */ + public PmInuse createPmInuse() { + return new PmInuse(); + } + + /** + * Create an instance of {@link CallProperty } + * + */ + public CallProperty createCallProperty() { + return new CallProperty(); + } + + /** + * Create an instance of {@link Method } + * + */ + public Method createMethod() { + return new Method(); + } + + /** + * Create an instance of {@link MethodParams } + * + */ + public MethodParams createMethodParams() { + return new MethodParams(); + } + + /** + * Create an instance of {@link Finder } + * + */ + public Finder createFinder() { + return new Finder(); + } + + /** + * Create an instance of {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal createDefaultResourcePrincipal() { + return new DefaultResourcePrincipal(); + } + + /** + * Create an instance of {@link SecurityRoleMapping } + * + */ + public SecurityRoleMapping createSecurityRoleMapping() { + return new SecurityRoleMapping(); + } + + /** + * Create an instance of {@link PrincipalName } + * + */ + public PrincipalName createPrincipalName() { + return new PrincipalName(); + } + + /** + * Create an instance of {@link GroupName } + * + */ + public GroupName createGroupName() { + return new GroupName(); + } + + /** + * Create an instance of {@link Cmp } + * + */ + public Cmp createCmp() { + return new Cmp(); + } + + /** + * Create an instance of {@link OneOneFinders } + * + */ + public OneOneFinders createOneOneFinders() { + return new OneOneFinders(); + } + + /** + * Create an instance of {@link PrefetchDisabled } + * + */ + public PrefetchDisabled createPrefetchDisabled() { + return new PrefetchDisabled(); + } + + /** + * Create an instance of {@link QueryMethod } + * + */ + public QueryMethod createQueryMethod() { + return new QueryMethod(); + } + + /** + * Create an instance of {@link MessageSecurity } + * + */ + public MessageSecurity createMessageSecurity() { + return new MessageSecurity(); + } + + /** + * Create an instance of {@link CheckpointAtEndOfMethod } + * + */ + public CheckpointAtEndOfMethod createCheckpointAtEndOfMethod() { + return new CheckpointAtEndOfMethod(); + } + + /** + * Create an instance of {@link JavaMethod } + * + */ + public JavaMethod createJavaMethod() { + return new JavaMethod(); + } + + /** + * Create an instance of {@link ResponseProtection } + * + */ + public ResponseProtection createResponseProtection() { + return new ResponseProtection(); + } + + /** + * Create an instance of {@link SunEjbJar } + * + */ + public SunEjbJar createSunEjbJar() { + return new SunEjbJar(); + } + + /** + * Create an instance of {@link ResourceRef } + * + */ + public ResourceRef createResourceRef() { + return new ResourceRef(); + } + + /** + * Create an instance of {@link SchemaGeneratorProperties } + * + */ + public SchemaGeneratorProperties createSchemaGeneratorProperties() { + return new SchemaGeneratorProperties(); + } + + /** + * Create an instance of {@link PmDescriptor } + * + */ + public PmDescriptor createPmDescriptor() { + return new PmDescriptor(); + } + + /** + * Create an instance of {@link Message } + * + */ + public Message createMessage() { + return new Message(); + } + + /** + * Create an instance of {@link RequestProtection } + * + */ + public RequestProtection createRequestProtection() { + return new RequestProtection(); + } + + /** + * Create an instance of {@link ResourceEnvRef } + * + */ + public ResourceEnvRef createResourceEnvRef() { + return new ResourceEnvRef(); + } + + /** + * Create an instance of {@link ServiceRef } + * + */ + public ServiceRef createServiceRef() { + return new ServiceRef(); + } + + /** + * Create an instance of {@link MessageDestinationRef } + * + */ + public MessageDestinationRef createMessageDestinationRef() { + return new MessageDestinationRef(); + } + + /** + * Create an instance of {@link Principal } + * + */ + public Principal createPrincipal() { + return new Principal(); + } + + /** + * Create an instance of {@link MdbConnectionFactory } + * + */ + public MdbConnectionFactory createMdbConnectionFactory() { + return new MdbConnectionFactory(); + } + + /** + * Create an instance of {@link IorSecurityConfig } + * + */ + public IorSecurityConfig createIorSecurityConfig() { + return new IorSecurityConfig(); + } + + /** + * Create an instance of {@link GenClasses } + * + */ + public GenClasses createGenClasses() { + return new GenClasses(); + } + + /** + * Create an instance of {@link BeanPool } + * + */ + public BeanPool createBeanPool() { + return new BeanPool(); + } + + /** + * Create an instance of {@link BeanCache } + * + */ + public BeanCache createBeanCache() { + return new BeanCache(); + } + + /** + * Create an instance of {@link MdbResourceAdapter } + * + */ + public MdbResourceAdapter createMdbResourceAdapter() { + return new MdbResourceAdapter(); + } + + /** + * Create an instance of {@link FlushAtEndOfMethod } + * + */ + public FlushAtEndOfMethod createFlushAtEndOfMethod() { + return new FlushAtEndOfMethod(); + } + + /** + * Create an instance of {@link SasContext } + * + */ + public SasContext createSasContext() { + return new SasContext(); + } + + /** + * Create an instance of {@link TransportConfig } + * + */ + public TransportConfig createTransportConfig() { + return new TransportConfig(); + } + + /** + * Create an instance of {@link PortInfo } + * + */ + public PortInfo createPortInfo() { + return new PortInfo(); + } + + /** + * Create an instance of {@link WsdlPort } + * + */ + public WsdlPort createWsdlPort() { + return new WsdlPort(); + } + + /** + * Create an instance of {@link StubProperty } + * + */ + public StubProperty createStubProperty() { + return new StubProperty(); + } + + /** + * Create an instance of {@link AsContext } + * + */ + public AsContext createAsContext() { + return new AsContext(); + } + + /** + * Create an instance of {@link OperationName } + * + */ + public OperationName createOperationName() { + return new OperationName(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OneOneFinders.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OneOneFinders.java new file mode 100644 index 0000000..8f0c874 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OneOneFinders.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "finder" +}) +@XmlRootElement(name = "one-one-finders") +public class OneOneFinders + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List finder; + + /** + * Gets the value of the finder property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the finder property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getFinder().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Finder } + * + * + */ + public List getFinder() { + if (finder == null) { + finder = new ArrayList(); + } + return this.finder; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OperationName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OperationName.java new file mode 100644 index 0000000..32ce190 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/OperationName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "operation-name") +public class OperationName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptor.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptor.java new file mode 100644 index 0000000..6385d80 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptor.java @@ -0,0 +1,167 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "pmIdentifier", + "pmVersion", + "pmConfig", + "pmClassGenerator", + "pmMappingFactory" +}) +@XmlRootElement(name = "pm-descriptor") +public class PmDescriptor + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "pm-identifier", required = true) + protected String pmIdentifier; + @XmlElement(name = "pm-version", required = true) + protected String pmVersion; + @XmlElement(name = "pm-config") + protected String pmConfig; + @XmlElement(name = "pm-class-generator") + protected String pmClassGenerator; + @XmlElement(name = "pm-mapping-factory") + protected String pmMappingFactory; + + /** + * Gets the value of the pmIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmIdentifier() { + return pmIdentifier; + } + + /** + * Sets the value of the pmIdentifier property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmIdentifier(String value) { + this.pmIdentifier = value; + } + + /** + * Gets the value of the pmVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmVersion() { + return pmVersion; + } + + /** + * Sets the value of the pmVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmVersion(String value) { + this.pmVersion = value; + } + + /** + * Gets the value of the pmConfig property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmConfig() { + return pmConfig; + } + + /** + * Sets the value of the pmConfig property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmConfig(String value) { + this.pmConfig = value; + } + + /** + * Gets the value of the pmClassGenerator property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmClassGenerator() { + return pmClassGenerator; + } + + /** + * Sets the value of the pmClassGenerator property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmClassGenerator(String value) { + this.pmClassGenerator = value; + } + + /** + * Gets the value of the pmMappingFactory property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmMappingFactory() { + return pmMappingFactory; + } + + /** + * Sets the value of the pmMappingFactory property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmMappingFactory(String value) { + this.pmMappingFactory = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptors.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptors.java new file mode 100644 index 0000000..b1fbec4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmDescriptors.java @@ -0,0 +1,93 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "pmDescriptor", + "pmInuse" +}) +@XmlRootElement(name = "pm-descriptors") +public class PmDescriptors + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "pm-descriptor", required = true) + protected List pmDescriptor; + @XmlElement(name = "pm-inuse", required = true) + protected PmInuse pmInuse; + + /** + * Gets the value of the pmDescriptor property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the pmDescriptor property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPmDescriptor().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PmDescriptor } + * + * + */ + public List getPmDescriptor() { + if (pmDescriptor == null) { + pmDescriptor = new ArrayList(); + } + return this.pmDescriptor; + } + + /** + * Gets the value of the pmInuse property. + * + * @return + * possible object is + * {@link PmInuse } + * + */ + public PmInuse getPmInuse() { + return pmInuse; + } + + /** + * Sets the value of the pmInuse property. + * + * @param value + * allowed object is + * {@link PmInuse } + * + */ + public void setPmInuse(PmInuse value) { + this.pmInuse = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmInuse.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmInuse.java new file mode 100644 index 0000000..ad1a2d1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PmInuse.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "pmIdentifier", + "pmVersion" +}) +@XmlRootElement(name = "pm-inuse") +public class PmInuse + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "pm-identifier", required = true) + protected String pmIdentifier; + @XmlElement(name = "pm-version", required = true) + protected String pmVersion; + + /** + * Gets the value of the pmIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmIdentifier() { + return pmIdentifier; + } + + /** + * Sets the value of the pmIdentifier property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmIdentifier(String value) { + this.pmIdentifier = value; + } + + /** + * Gets the value of the pmVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPmVersion() { + return pmVersion; + } + + /** + * Sets the value of the pmVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPmVersion(String value) { + this.pmVersion = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PortInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PortInfo.java new file mode 100644 index 0000000..5dd6198 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PortInfo.java @@ -0,0 +1,179 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceEndpointInterface", + "wsdlPort", + "stubProperty", + "callProperty", + "messageSecurityBinding" +}) +@XmlRootElement(name = "port-info") +public class PortInfo + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-endpoint-interface") + protected String serviceEndpointInterface; + @XmlElement(name = "wsdl-port") + protected WsdlPort wsdlPort; + @XmlElement(name = "stub-property") + protected List stubProperty; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "message-security-binding") + protected MessageSecurityBinding messageSecurityBinding; + + /** + * Gets the value of the serviceEndpointInterface property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceEndpointInterface() { + return serviceEndpointInterface; + } + + /** + * Sets the value of the serviceEndpointInterface property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceEndpointInterface(String value) { + this.serviceEndpointInterface = value; + } + + /** + * Gets the value of the wsdlPort property. + * + * @return + * possible object is + * {@link WsdlPort } + * + */ + public WsdlPort getWsdlPort() { + return wsdlPort; + } + + /** + * Sets the value of the wsdlPort property. + * + * @param value + * allowed object is + * {@link WsdlPort } + * + */ + public void setWsdlPort(WsdlPort value) { + this.wsdlPort = value; + } + + /** + * Gets the value of the stubProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the stubProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getStubProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link StubProperty } + * + * + */ + public List getStubProperty() { + if (stubProperty == null) { + stubProperty = new ArrayList(); + } + return this.stubProperty; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the messageSecurityBinding property. + * + * @return + * possible object is + * {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding getMessageSecurityBinding() { + return messageSecurityBinding; + } + + /** + * Sets the value of the messageSecurityBinding property. + * + * @param value + * allowed object is + * {@link MessageSecurityBinding } + * + */ + public void setMessageSecurityBinding(MessageSecurityBinding value) { + this.messageSecurityBinding = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrefetchDisabled.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrefetchDisabled.java new file mode 100644 index 0000000..e7893a9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrefetchDisabled.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "queryMethod" +}) +@XmlRootElement(name = "prefetch-disabled") +public class PrefetchDisabled + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "query-method", required = true) + protected List queryMethod; + + /** + * Gets the value of the queryMethod property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the queryMethod property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getQueryMethod().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link QueryMethod } + * + * + */ + public List getQueryMethod() { + if (queryMethod == null) { + queryMethod = new ArrayList(); + } + return this.queryMethod; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Principal.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Principal.java new file mode 100644 index 0000000..6bad221 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Principal.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name" +}) +@XmlRootElement(name = "principal") +public class Principal + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrincipalName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrincipalName.java new file mode 100644 index 0000000..9f7234a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/PrincipalName.java @@ -0,0 +1,88 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "principal-name") +public class PrincipalName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "class-name") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String className; + @XmlValue + protected String value; + + /** + * Gets the value of the className property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClassName() { + return className; + } + + /** + * Sets the value of the className property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClassName(String value) { + this.className = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Property.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Property.java new file mode 100644 index 0000000..20a9991 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/Property.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "property") +public class Property + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/QueryMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/QueryMethod.java new file mode 100644 index 0000000..d6bde1a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/QueryMethod.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "methodParams" +}) +@XmlRootElement(name = "query-method") +public class QueryMethod + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-params", required = true) + protected MethodParams methodParams; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/RequestProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/RequestProtection.java new file mode 100644 index 0000000..efa63a9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/RequestProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "request-protection") +public class RequestProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceEnvRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceEnvRef.java new file mode 100644 index 0000000..91f721c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceEnvRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resourceEnvRefName", + "jndiName" +}) +@XmlRootElement(name = "resource-env-ref") +public class ResourceEnvRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "resource-env-ref-name", required = true) + protected String resourceEnvRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the resourceEnvRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceEnvRefName() { + return resourceEnvRefName; + } + + /** + * Sets the value of the resourceEnvRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceEnvRefName(String value) { + this.resourceEnvRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceRef.java new file mode 100644 index 0000000..49cb6ca --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResourceRef.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resRefName", + "jndiName", + "defaultResourcePrincipal" +}) +@XmlRootElement(name = "resource-ref") +public class ResourceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "res-ref-name", required = true) + protected String resRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + + /** + * Gets the value of the resRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResRefName() { + return resRefName; + } + + /** + * Sets the value of the resRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResRefName(String value) { + this.resRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResponseProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResponseProtection.java new file mode 100644 index 0000000..b40e93f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ResponseProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "response-protection") +public class ResponseProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SasContext.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SasContext.java new file mode 100644 index 0000000..ddcc4fc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SasContext.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "callerPropagation" +}) +@XmlRootElement(name = "sas-context") +public class SasContext + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "caller-propagation", required = true) + protected String callerPropagation; + + /** + * Gets the value of the callerPropagation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCallerPropagation() { + return callerPropagation; + } + + /** + * Sets the value of the callerPropagation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCallerPropagation(String value) { + this.callerPropagation = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SchemaGeneratorProperties.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SchemaGeneratorProperties.java new file mode 100644 index 0000000..97d888e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SchemaGeneratorProperties.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "schema-generator-properties") +public class SchemaGeneratorProperties + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SecurityRoleMapping.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SecurityRoleMapping.java new file mode 100644 index 0000000..7779da6 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SecurityRoleMapping.java @@ -0,0 +1,98 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "roleName", + "principalNameOrGroupName" +}) +@XmlRootElement(name = "security-role-mapping") +public class SecurityRoleMapping + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "role-name", required = true) + protected String roleName; + @XmlElements({ + @XmlElement(name = "principal-name", required = true, type = PrincipalName.class), + @XmlElement(name = "group-name", required = true, type = GroupName.class) + }) + protected List principalNameOrGroupName; + + /** + * Gets the value of the roleName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRoleName() { + return roleName; + } + + /** + * Sets the value of the roleName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRoleName(String value) { + this.roleName = value; + } + + /** + * Gets the value of the principalNameOrGroupName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the principalNameOrGroupName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPrincipalNameOrGroupName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PrincipalName } + * {@link GroupName } + * + * + */ + public List getPrincipalNameOrGroupName() { + if (principalNameOrGroupName == null) { + principalNameOrGroupName = new ArrayList(); + } + return this.principalNameOrGroupName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceQname.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceQname.java new file mode 100644 index 0000000..d22fa5b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceQname.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "service-qname") +public class ServiceQname + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceRef.java new file mode 100644 index 0000000..a20ca8e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/ServiceRef.java @@ -0,0 +1,206 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceRefName", + "portInfo", + "callProperty", + "wsdlOverride", + "serviceImplClass", + "serviceQname" +}) +@XmlRootElement(name = "service-ref") +public class ServiceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-ref-name", required = true) + protected String serviceRefName; + @XmlElement(name = "port-info") + protected List portInfo; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "wsdl-override") + protected String wsdlOverride; + @XmlElement(name = "service-impl-class") + protected String serviceImplClass; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + + /** + * Gets the value of the serviceRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceRefName() { + return serviceRefName; + } + + /** + * Sets the value of the serviceRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceRefName(String value) { + this.serviceRefName = value; + } + + /** + * Gets the value of the portInfo property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the portInfo property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPortInfo().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PortInfo } + * + * + */ + public List getPortInfo() { + if (portInfo == null) { + portInfo = new ArrayList(); + } + return this.portInfo; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the wsdlOverride property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlOverride() { + return wsdlOverride; + } + + /** + * Sets the value of the wsdlOverride property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlOverride(String value) { + this.wsdlOverride = value; + } + + /** + * Gets the value of the serviceImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceImplClass() { + return serviceImplClass; + } + + /** + * Sets the value of the serviceImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceImplClass(String value) { + this.serviceImplClass = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/StubProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/StubProperty.java new file mode 100644 index 0000000..3646b62 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/StubProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "stub-property") +public class StubProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SunEjbJar.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SunEjbJar.java new file mode 100644 index 0000000..f9199f5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/SunEjbJar.java @@ -0,0 +1,93 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "securityRoleMapping", + "enterpriseBeans" +}) +@XmlRootElement(name = "sun-ejb-jar") +public class SunEjbJar + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "security-role-mapping") + protected List securityRoleMapping; + @XmlElement(name = "enterprise-beans", required = true) + protected EnterpriseBeans enterpriseBeans; + + /** + * Gets the value of the securityRoleMapping property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the securityRoleMapping property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getSecurityRoleMapping().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link SecurityRoleMapping } + * + * + */ + public List getSecurityRoleMapping() { + if (securityRoleMapping == null) { + securityRoleMapping = new ArrayList(); + } + return this.securityRoleMapping; + } + + /** + * Gets the value of the enterpriseBeans property. + * + * @return + * possible object is + * {@link EnterpriseBeans } + * + */ + public EnterpriseBeans getEnterpriseBeans() { + return enterpriseBeans; + } + + /** + * Sets the value of the enterpriseBeans property. + * + * @param value + * allowed object is + * {@link EnterpriseBeans } + * + */ + public void setEnterpriseBeans(EnterpriseBeans value) { + this.enterpriseBeans = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/TransportConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/TransportConfig.java new file mode 100644 index 0000000..d509b97 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/TransportConfig.java @@ -0,0 +1,140 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "integrity", + "confidentiality", + "establishTrustInTarget", + "establishTrustInClient" +}) +@XmlRootElement(name = "transport-config") +public class TransportConfig + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String integrity; + @XmlElement(required = true) + protected String confidentiality; + @XmlElement(name = "establish-trust-in-target", required = true) + protected String establishTrustInTarget; + @XmlElement(name = "establish-trust-in-client", required = true) + protected String establishTrustInClient; + + /** + * Gets the value of the integrity property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIntegrity() { + return integrity; + } + + /** + * Sets the value of the integrity property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIntegrity(String value) { + this.integrity = value; + } + + /** + * Gets the value of the confidentiality property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConfidentiality() { + return confidentiality; + } + + /** + * Sets the value of the confidentiality property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setConfidentiality(String value) { + this.confidentiality = value; + } + + /** + * Gets the value of the establishTrustInTarget property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstablishTrustInTarget() { + return establishTrustInTarget; + } + + /** + * Sets the value of the establishTrustInTarget property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstablishTrustInTarget(String value) { + this.establishTrustInTarget = value; + } + + /** + * Gets the value of the establishTrustInClient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstablishTrustInClient() { + return establishTrustInClient; + } + + /** + * Sets the value of the establishTrustInClient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstablishTrustInClient(String value) { + this.establishTrustInClient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceDescription.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceDescription.java new file mode 100644 index 0000000..57b39aa --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceDescription.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "webserviceDescriptionName", + "wsdlPublishLocation" +}) +@XmlRootElement(name = "webservice-description") +public class WebserviceDescription + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "webservice-description-name", required = true) + protected String webserviceDescriptionName; + @XmlElement(name = "wsdl-publish-location") + protected String wsdlPublishLocation; + + /** + * Gets the value of the webserviceDescriptionName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWebserviceDescriptionName() { + return webserviceDescriptionName; + } + + /** + * Sets the value of the webserviceDescriptionName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWebserviceDescriptionName(String value) { + this.webserviceDescriptionName = value; + } + + /** + * Gets the value of the wsdlPublishLocation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlPublishLocation() { + return wsdlPublishLocation; + } + + /** + * Sets the value of the wsdlPublishLocation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlPublishLocation(String value) { + this.wsdlPublishLocation = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceEndpoint.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceEndpoint.java new file mode 100644 index 0000000..b2b3aab --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WebserviceEndpoint.java @@ -0,0 +1,260 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "portComponentName", + "endpointAddressUri", + "loginConfigOrMessageSecurityBinding", + "transportGuarantee", + "serviceQname", + "tieClass", + "servletImplClass", + "debuggingEnabled" +}) +@XmlRootElement(name = "webservice-endpoint") +public class WebserviceEndpoint + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "port-component-name", required = true) + protected String portComponentName; + @XmlElement(name = "endpoint-address-uri") + protected String endpointAddressUri; + @XmlElements({ + @XmlElement(name = "login-config", type = LoginConfig.class), + @XmlElement(name = "message-security-binding", type = MessageSecurityBinding.class) + }) + protected List loginConfigOrMessageSecurityBinding; + @XmlElement(name = "transport-guarantee") + protected String transportGuarantee; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + @XmlElement(name = "tie-class") + protected String tieClass; + @XmlElement(name = "servlet-impl-class") + protected String servletImplClass; + @XmlElement(name = "debugging-enabled") + protected String debuggingEnabled; + + /** + * Gets the value of the portComponentName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPortComponentName() { + return portComponentName; + } + + /** + * Sets the value of the portComponentName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPortComponentName(String value) { + this.portComponentName = value; + } + + /** + * Gets the value of the endpointAddressUri property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEndpointAddressUri() { + return endpointAddressUri; + } + + /** + * Sets the value of the endpointAddressUri property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEndpointAddressUri(String value) { + this.endpointAddressUri = value; + } + + /** + * Gets the value of the loginConfigOrMessageSecurityBinding property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the loginConfigOrMessageSecurityBinding property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getLoginConfigOrMessageSecurityBinding().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link LoginConfig } + * {@link MessageSecurityBinding } + * + * + */ + public List getLoginConfigOrMessageSecurityBinding() { + if (loginConfigOrMessageSecurityBinding == null) { + loginConfigOrMessageSecurityBinding = new ArrayList(); + } + return this.loginConfigOrMessageSecurityBinding; + } + + /** + * Gets the value of the transportGuarantee property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTransportGuarantee() { + return transportGuarantee; + } + + /** + * Sets the value of the transportGuarantee property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTransportGuarantee(String value) { + this.transportGuarantee = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + + /** + * Gets the value of the tieClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTieClass() { + return tieClass; + } + + /** + * Sets the value of the tieClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTieClass(String value) { + this.tieClass = value; + } + + /** + * Gets the value of the servletImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServletImplClass() { + return servletImplClass; + } + + /** + * Sets the value of the servletImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServletImplClass(String value) { + this.servletImplClass = value; + } + + /** + * Gets the value of the debuggingEnabled property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDebuggingEnabled() { + return debuggingEnabled; + } + + /** + * Sets the value of the debuggingEnabled property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDebuggingEnabled(String value) { + this.debuggingEnabled = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WsdlPort.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WsdlPort.java new file mode 100644 index 0000000..e4ac607 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/ejb/WsdlPort.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:39 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.ejb; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "wsdl-port") +public class WsdlPort + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/jaxb-cust.xml b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/jaxb-cust.xml new file mode 100644 index 0000000..3dcb4c9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/jaxb-cust.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Cache.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Cache.java new file mode 100644 index 0000000..2a667c0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Cache.java @@ -0,0 +1,253 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "cacheHelper", + "defaultHelper", + "property", + "cacheMapping" +}) +@XmlRootElement(name = "cache") +public class Cache + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "max-entries") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String maxEntries; + @XmlAttribute(name = "timeout-in-seconds") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String timeoutInSeconds; + @XmlAttribute(name = "enabled") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String enabled; + @XmlElement(name = "cache-helper") + protected List cacheHelper; + @XmlElement(name = "default-helper") + protected DefaultHelper defaultHelper; + protected List property; + @XmlElement(name = "cache-mapping") + protected List cacheMapping; + + /** + * Gets the value of the maxEntries property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxEntries() { + if (maxEntries == null) { + return "4096"; + } else { + return maxEntries; + } + } + + /** + * Sets the value of the maxEntries property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxEntries(String value) { + this.maxEntries = value; + } + + /** + * Gets the value of the timeoutInSeconds property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTimeoutInSeconds() { + if (timeoutInSeconds == null) { + return "30"; + } else { + return timeoutInSeconds; + } + } + + /** + * Sets the value of the timeoutInSeconds property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTimeoutInSeconds(String value) { + this.timeoutInSeconds = value; + } + + /** + * Gets the value of the enabled property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEnabled() { + if (enabled == null) { + return "true"; + } else { + return enabled; + } + } + + /** + * Sets the value of the enabled property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEnabled(String value) { + this.enabled = value; + } + + /** + * Gets the value of the cacheHelper property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the cacheHelper property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCacheHelper().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CacheHelper } + * + * + */ + public List getCacheHelper() { + if (cacheHelper == null) { + cacheHelper = new ArrayList(); + } + return this.cacheHelper; + } + + /** + * Gets the value of the defaultHelper property. + * + * @return + * possible object is + * {@link DefaultHelper } + * + */ + public DefaultHelper getDefaultHelper() { + return defaultHelper; + } + + /** + * Sets the value of the defaultHelper property. + * + * @param value + * allowed object is + * {@link DefaultHelper } + * + */ + public void setDefaultHelper(DefaultHelper value) { + this.defaultHelper = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + + /** + * Gets the value of the cacheMapping property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the cacheMapping property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCacheMapping().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CacheMapping } + * + * + */ + public List getCacheMapping() { + if (cacheMapping == null) { + cacheMapping = new ArrayList(); + } + return this.cacheMapping; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelper.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelper.java new file mode 100644 index 0000000..6077ac9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelper.java @@ -0,0 +1,121 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "cache-helper") +public class CacheHelper + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "class-name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String className; + protected List property; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the className property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClassName() { + return className; + } + + /** + * Sets the value of the className property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClassName(String value) { + this.className = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelperRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelperRef.java new file mode 100644 index 0000000..f7087bb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheHelperRef.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "cache-helper-ref") +public class CacheHelperRef implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheMapping.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheMapping.java new file mode 100644 index 0000000..499734f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CacheMapping.java @@ -0,0 +1,117 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "servletNameOrUrlPattern", + "cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField" +}) +@XmlRootElement(name = "cache-mapping") +public class CacheMapping + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElements({ + @XmlElement(name = "servlet-name", required = true, type = ServletName.class), + @XmlElement(name = "url-pattern", required = true, type = UrlPattern.class) + }) + protected List servletNameOrUrlPattern; + @XmlElements({ + @XmlElement(name = "cache-helper-ref", type = CacheHelperRef.class), + @XmlElement(name = "dispatcher", type = Dispatcher.class), + @XmlElement(name = "timeout", type = Timeout.class), + @XmlElement(name = "refresh-field", type = RefreshField.class), + @XmlElement(name = "http-method", type = HttpMethod.class), + @XmlElement(name = "key-field", type = KeyField.class), + @XmlElement(name = "constraint-field", type = ConstraintField.class) + }) + protected List cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField; + + /** + * Gets the value of the servletNameOrUrlPattern property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the servletNameOrUrlPattern property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServletNameOrUrlPattern().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServletName } + * {@link UrlPattern } + * + * + */ + public List getServletNameOrUrlPattern() { + if (servletNameOrUrlPattern == null) { + servletNameOrUrlPattern = new ArrayList(); + } + return this.servletNameOrUrlPattern; + } + + /** + * Gets the value of the cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CacheHelperRef } + * {@link Dispatcher } + * {@link Timeout } + * {@link RefreshField } + * {@link HttpMethod } + * {@link KeyField } + * {@link ConstraintField } + * + * + */ + public List getCacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField() { + if (cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField == null) { + cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField = new ArrayList(); + } + return this.cacheHelperRefOrDispatcherOrTimeoutOrRefreshFieldOrHttpMethodOrKeyFieldOrConstraintField; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CallProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CallProperty.java new file mode 100644 index 0000000..3ec69dc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CallProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "call-property") +public class CallProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ClassLoader.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ClassLoader.java new file mode 100644 index 0000000..f3bfdd9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ClassLoader.java @@ -0,0 +1,153 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "class-loader") +public class ClassLoader + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "extra-class-path") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String extraClassPath; + @XmlAttribute(name = "delegate") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String delegate; + @XmlAttribute(name = "dynamic-reload-interval") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String dynamicReloadInterval; + protected List property; + + /** + * Gets the value of the extraClassPath property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getExtraClassPath() { + return extraClassPath; + } + + /** + * Sets the value of the extraClassPath property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setExtraClassPath(String value) { + this.extraClassPath = value; + } + + /** + * Gets the value of the delegate property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDelegate() { + if (delegate == null) { + return "true"; + } else { + return delegate; + } + } + + /** + * Sets the value of the delegate property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDelegate(String value) { + this.delegate = value; + } + + /** + * Gets the value of the dynamicReloadInterval property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDynamicReloadInterval() { + return dynamicReloadInterval; + } + + /** + * Sets the value of the dynamicReloadInterval property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDynamicReloadInterval(String value) { + this.dynamicReloadInterval = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintField.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintField.java new file mode 100644 index 0000000..e09f3fb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintField.java @@ -0,0 +1,189 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "constraintFieldValue" +}) +@XmlRootElement(name = "constraint-field") +public class ConstraintField implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "scope") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String scope; + @XmlAttribute(name = "cache-on-match") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String cacheOnMatch; + @XmlAttribute(name = "cache-on-match-failure") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String cacheOnMatchFailure; + @XmlElement(name = "constraint-field-value") + protected List constraintFieldValue; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the scope property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getScope() { + if (scope == null) { + return "request.parameter"; + } else { + return scope; + } + } + + /** + * Sets the value of the scope property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setScope(String value) { + this.scope = value; + } + + /** + * Gets the value of the cacheOnMatch property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCacheOnMatch() { + if (cacheOnMatch == null) { + return "true"; + } else { + return cacheOnMatch; + } + } + + /** + * Sets the value of the cacheOnMatch property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCacheOnMatch(String value) { + this.cacheOnMatch = value; + } + + /** + * Gets the value of the cacheOnMatchFailure property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCacheOnMatchFailure() { + if (cacheOnMatchFailure == null) { + return "false"; + } else { + return cacheOnMatchFailure; + } + } + + /** + * Sets the value of the cacheOnMatchFailure property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCacheOnMatchFailure(String value) { + this.cacheOnMatchFailure = value; + } + + /** + * Gets the value of the constraintFieldValue property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the constraintFieldValue property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getConstraintFieldValue().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ConstraintFieldValue } + * + * + */ + public List getConstraintFieldValue() { + if (constraintFieldValue == null) { + constraintFieldValue = new ArrayList(); + } + return this.constraintFieldValue; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintFieldValue.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintFieldValue.java new file mode 100644 index 0000000..5b09817 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ConstraintFieldValue.java @@ -0,0 +1,155 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "constraint-field-value") +public class ConstraintFieldValue + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "match-expr") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String matchExpr; + @XmlAttribute(name = "cache-on-match") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String cacheOnMatch; + @XmlAttribute(name = "cache-on-match-failure") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String cacheOnMatchFailure; + @XmlValue + protected String value; + + /** + * Gets the value of the matchExpr property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMatchExpr() { + if (matchExpr == null) { + return "equals"; + } else { + return matchExpr; + } + } + + /** + * Sets the value of the matchExpr property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMatchExpr(String value) { + this.matchExpr = value; + } + + /** + * Gets the value of the cacheOnMatch property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCacheOnMatch() { + if (cacheOnMatch == null) { + return "true"; + } else { + return cacheOnMatch; + } + } + + /** + * Sets the value of the cacheOnMatch property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCacheOnMatch(String value) { + this.cacheOnMatch = value; + } + + /** + * Gets the value of the cacheOnMatchFailure property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCacheOnMatchFailure() { + if (cacheOnMatchFailure == null) { + return "false"; + } else { + return cacheOnMatchFailure; + } + } + + /** + * Sets the value of the cacheOnMatchFailure property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCacheOnMatchFailure(String value) { + this.cacheOnMatchFailure = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CookieProperties.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CookieProperties.java new file mode 100644 index 0000000..5b5328c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/CookieProperties.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "cookie-properties") +public class CookieProperties + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultHelper.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultHelper.java new file mode 100644 index 0000000..6b7ed76 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultHelper.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "default-helper") +public class DefaultHelper + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultResourcePrincipal.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultResourcePrincipal.java new file mode 100644 index 0000000..df72a74 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/DefaultResourcePrincipal.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "password" +}) +@XmlRootElement(name = "default-resource-principal") +public class DefaultResourcePrincipal + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String password; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + /** + * Sets the value of the password property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPassword(String value) { + this.password = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Dispatcher.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Dispatcher.java new file mode 100644 index 0000000..19f20b4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Dispatcher.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "dispatcher") +public class Dispatcher implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/EjbRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/EjbRef.java new file mode 100644 index 0000000..f9726c7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/EjbRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ejbRefName", + "jndiName" +}) +@XmlRootElement(name = "ejb-ref") +public class EjbRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "ejb-ref-name", required = true) + protected String ejbRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the ejbRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEjbRefName() { + return ejbRefName; + } + + /** + * Sets the value of the ejbRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEjbRefName(String value) { + this.ejbRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/GroupName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/GroupName.java new file mode 100644 index 0000000..d2116b0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/GroupName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "group-name") +public class GroupName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/HttpMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/HttpMethod.java new file mode 100644 index 0000000..b0e1853 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/HttpMethod.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "http-method") +public class HttpMethod implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/IdempotentUrlPattern.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/IdempotentUrlPattern.java new file mode 100644 index 0000000..05897b4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/IdempotentUrlPattern.java @@ -0,0 +1,91 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "idempotent-url-pattern") +public class IdempotentUrlPattern + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "url-pattern", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String urlPattern; + @XmlAttribute(name = "num-of-retries") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String numOfRetries; + + /** + * Gets the value of the urlPattern property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUrlPattern() { + return urlPattern; + } + + /** + * Sets the value of the urlPattern property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUrlPattern(String value) { + this.urlPattern = value; + } + + /** + * Gets the value of the numOfRetries property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumOfRetries() { + if (numOfRetries == null) { + return "-1"; + } else { + return numOfRetries; + } + } + + /** + * Sets the value of the numOfRetries property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumOfRetries(String value) { + this.numOfRetries = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JavaMethod.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JavaMethod.java new file mode 100644 index 0000000..91d7bb7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JavaMethod.java @@ -0,0 +1,85 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodName", + "methodParams" +}) +@XmlRootElement(name = "java-method") +public class JavaMethod implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-name", required = true) + protected String methodName; + @XmlElement(name = "method-params") + protected MethodParams methodParams; + + /** + * Gets the value of the methodName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMethodName() { + return methodName; + } + + /** + * Sets the value of the methodName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMethodName(String value) { + this.methodName = value; + } + + /** + * Gets the value of the methodParams property. + * + * @return + * possible object is + * {@link MethodParams } + * + */ + public MethodParams getMethodParams() { + return methodParams; + } + + /** + * Sets the value of the methodParams property. + * + * @param value + * allowed object is + * {@link MethodParams } + * + */ + public void setMethodParams(MethodParams value) { + this.methodParams = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JspConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JspConfig.java new file mode 100644 index 0000000..c2d5561 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/JspConfig.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "jsp-config") +public class JspConfig + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/KeyField.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/KeyField.java new file mode 100644 index 0000000..f93121c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/KeyField.java @@ -0,0 +1,91 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "key-field") +public class KeyField implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "scope") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String scope; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the scope property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getScope() { + if (scope == null) { + return "request.parameter"; + } else { + return scope; + } + } + + /** + * Sets the value of the scope property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setScope(String value) { + this.scope = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetInfo.java new file mode 100644 index 0000000..5ec41e2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetInfo.java @@ -0,0 +1,123 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "localeCharsetMap", + "parameterEncoding" +}) +@XmlRootElement(name = "locale-charset-info") +public class LocaleCharsetInfo + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "default-locale") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String defaultLocale; + @XmlElement(name = "locale-charset-map", required = true) + protected List localeCharsetMap; + @XmlElement(name = "parameter-encoding") + protected ParameterEncoding parameterEncoding; + + /** + * Gets the value of the defaultLocale property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDefaultLocale() { + return defaultLocale; + } + + /** + * Sets the value of the defaultLocale property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDefaultLocale(String value) { + this.defaultLocale = value; + } + + /** + * Gets the value of the localeCharsetMap property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the localeCharsetMap property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getLocaleCharsetMap().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link LocaleCharsetMap } + * + * + */ + public List getLocaleCharsetMap() { + if (localeCharsetMap == null) { + localeCharsetMap = new ArrayList(); + } + return this.localeCharsetMap; + } + + /** + * Gets the value of the parameterEncoding property. + * + * @return + * possible object is + * {@link ParameterEncoding } + * + */ + public ParameterEncoding getParameterEncoding() { + return parameterEncoding; + } + + /** + * Sets the value of the parameterEncoding property. + * + * @param value + * allowed object is + * {@link ParameterEncoding } + * + */ + public void setParameterEncoding(ParameterEncoding value) { + this.parameterEncoding = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetMap.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetMap.java new file mode 100644 index 0000000..cd46f1d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LocaleCharsetMap.java @@ -0,0 +1,141 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "description" +}) +@XmlRootElement(name = "locale-charset-map") +public class LocaleCharsetMap + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "locale", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String locale; + @XmlAttribute(name = "agent") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String agent; + @XmlAttribute(name = "charset", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String charset; + protected String description; + + /** + * Gets the value of the locale property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocale() { + return locale; + } + + /** + * Sets the value of the locale property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocale(String value) { + this.locale = value; + } + + /** + * Gets the value of the agent property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgent() { + return agent; + } + + /** + * Sets the value of the agent property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgent(String value) { + this.agent = value; + } + + /** + * Gets the value of the charset property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCharset() { + return charset; + } + + /** + * Sets the value of the charset property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCharset(String value) { + this.charset = value; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LoginConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LoginConfig.java new file mode 100644 index 0000000..8d78b08 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/LoginConfig.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "authMethod" +}) +@XmlRootElement(name = "login-config") +public class LoginConfig implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "auth-method", required = true) + protected String authMethod; + + /** + * Gets the value of the authMethod property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthMethod() { + return authMethod; + } + + /** + * Sets the value of the authMethod property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthMethod(String value) { + this.authMethod = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ManagerProperties.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ManagerProperties.java new file mode 100644 index 0000000..92aa513 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ManagerProperties.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "manager-properties") +public class ManagerProperties + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Message.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Message.java new file mode 100644 index 0000000..cc6143a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Message.java @@ -0,0 +1,71 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "javaMethodOrOperationName" +}) +@XmlRootElement(name = "message") +public class Message + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElements({ + @XmlElement(name = "java-method", type = JavaMethod.class), + @XmlElement(name = "operation-name", type = OperationName.class) + }) + protected List javaMethodOrOperationName; + + /** + * Gets the value of the javaMethodOrOperationName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the javaMethodOrOperationName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getJavaMethodOrOperationName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link JavaMethod } + * {@link OperationName } + * + * + */ + public List getJavaMethodOrOperationName() { + if (javaMethodOrOperationName == null) { + javaMethodOrOperationName = new ArrayList(); + } + return this.javaMethodOrOperationName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestination.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestination.java new file mode 100644 index 0000000..e7ed7e1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestination.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationName", + "jndiName" +}) +@XmlRootElement(name = "message-destination") +public class MessageDestination + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-name", required = true) + protected String messageDestinationName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationName() { + return messageDestinationName; + } + + /** + * Sets the value of the messageDestinationName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationName(String value) { + this.messageDestinationName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestinationRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestinationRef.java new file mode 100644 index 0000000..1f19d86 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageDestinationRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageDestinationRefName", + "jndiName" +}) +@XmlRootElement(name = "message-destination-ref") +public class MessageDestinationRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "message-destination-ref-name", required = true) + protected String messageDestinationRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the messageDestinationRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageDestinationRefName() { + return messageDestinationRefName; + } + + /** + * Sets the value of the messageDestinationRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageDestinationRefName(String value) { + this.messageDestinationRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurity.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurity.java new file mode 100644 index 0000000..325cabd --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurity.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "message", + "requestProtection", + "responseProtection" +}) +@XmlRootElement(name = "message-security") +public class MessageSecurity + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected List message; + @XmlElement(name = "request-protection") + protected RequestProtection requestProtection; + @XmlElement(name = "response-protection") + protected ResponseProtection responseProtection; + + /** + * Gets the value of the message property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the message property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessage().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Message } + * + * + */ + public List getMessage() { + if (message == null) { + message = new ArrayList(); + } + return this.message; + } + + /** + * Gets the value of the requestProtection property. + * + * @return + * possible object is + * {@link RequestProtection } + * + */ + public RequestProtection getRequestProtection() { + return requestProtection; + } + + /** + * Sets the value of the requestProtection property. + * + * @param value + * allowed object is + * {@link RequestProtection } + * + */ + public void setRequestProtection(RequestProtection value) { + this.requestProtection = value; + } + + /** + * Gets the value of the responseProtection property. + * + * @return + * possible object is + * {@link ResponseProtection } + * + */ + public ResponseProtection getResponseProtection() { + return responseProtection; + } + + /** + * Sets the value of the responseProtection property. + * + * @param value + * allowed object is + * {@link ResponseProtection } + * + */ + public void setResponseProtection(ResponseProtection value) { + this.responseProtection = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurityBinding.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurityBinding.java new file mode 100644 index 0000000..ba1d4f3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MessageSecurityBinding.java @@ -0,0 +1,123 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "messageSecurity" +}) +@XmlRootElement(name = "message-security-binding") +public class MessageSecurityBinding implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-layer", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authLayer; + @XmlAttribute(name = "provider-id") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String providerId; + @XmlElement(name = "message-security") + protected List messageSecurity; + + /** + * Gets the value of the authLayer property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthLayer() { + return authLayer; + } + + /** + * Sets the value of the authLayer property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthLayer(String value) { + this.authLayer = value; + } + + /** + * Gets the value of the providerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProviderId() { + return providerId; + } + + /** + * Sets the value of the providerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProviderId(String value) { + this.providerId = value; + } + + /** + * Gets the value of the messageSecurity property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageSecurity property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageSecurity().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageSecurity } + * + * + */ + public List getMessageSecurity() { + if (messageSecurity == null) { + messageSecurity = new ArrayList(); + } + return this.messageSecurity; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParam.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParam.java new file mode 100644 index 0000000..5fe10b3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParam.java @@ -0,0 +1,59 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "method-param") +public class MethodParam + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParams.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParams.java new file mode 100644 index 0000000..e0f40d8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/MethodParams.java @@ -0,0 +1,66 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "methodParam" +}) +@XmlRootElement(name = "method-params") +public class MethodParams + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "method-param") + protected List methodParam; + + /** + * Gets the value of the methodParam property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the methodParam property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMethodParam().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MethodParam } + * + * + */ + public List getMethodParam() { + if (methodParam == null) { + methodParam = new ArrayList(); + } + return this.methodParam; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ObjectFactory.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ObjectFactory.java new file mode 100644 index 0000000..529c0be --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ObjectFactory.java @@ -0,0 +1,495 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import jakarta.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.sun.ts.lib.implementation.sun.javaee.runtime.web package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sun.ts.lib.implementation.sun.javaee.runtime.web + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link RefreshField } + * + */ + public RefreshField createRefreshField() { + return new RefreshField(); + } + + /** + * Create an instance of {@link SunWebApp } + * + */ + public SunWebApp createSunWebApp() { + return new SunWebApp(); + } + + /** + * Create an instance of {@link SecurityRoleMapping } + * + */ + public SecurityRoleMapping createSecurityRoleMapping() { + return new SecurityRoleMapping(); + } + + /** + * Create an instance of {@link Servlet } + * + */ + public Servlet createServlet() { + return new Servlet(); + } + + /** + * Create an instance of {@link IdempotentUrlPattern } + * + */ + public IdempotentUrlPattern createIdempotentUrlPattern() { + return new IdempotentUrlPattern(); + } + + /** + * Create an instance of {@link SessionConfig } + * + */ + public SessionConfig createSessionConfig() { + return new SessionConfig(); + } + + /** + * Create an instance of {@link EjbRef } + * + */ + public EjbRef createEjbRef() { + return new EjbRef(); + } + + /** + * Create an instance of {@link ResourceRef } + * + */ + public ResourceRef createResourceRef() { + return new ResourceRef(); + } + + /** + * Create an instance of {@link ResourceEnvRef } + * + */ + public ResourceEnvRef createResourceEnvRef() { + return new ResourceEnvRef(); + } + + /** + * Create an instance of {@link ServiceRef } + * + */ + public ServiceRef createServiceRef() { + return new ServiceRef(); + } + + /** + * Create an instance of {@link MessageDestinationRef } + * + */ + public MessageDestinationRef createMessageDestinationRef() { + return new MessageDestinationRef(); + } + + /** + * Create an instance of {@link Cache } + * + */ + public Cache createCache() { + return new Cache(); + } + + /** + * Create an instance of {@link ClassLoader } + * + */ + public ClassLoader createClassLoader() { + return new ClassLoader(); + } + + /** + * Create an instance of {@link JspConfig } + * + */ + public JspConfig createJspConfig() { + return new JspConfig(); + } + + /** + * Create an instance of {@link LocaleCharsetInfo } + * + */ + public LocaleCharsetInfo createLocaleCharsetInfo() { + return new LocaleCharsetInfo(); + } + + /** + * Create an instance of {@link ParameterEncoding } + * + */ + public ParameterEncoding createParameterEncoding() { + return new ParameterEncoding(); + } + + /** + * Create an instance of {@link Property } + * + */ + public Property createProperty() { + return new Property(); + } + + /** + * Create an instance of {@link Valve } + * + */ + public Valve createValve() { + return new Valve(); + } + + /** + * Create an instance of {@link MessageDestination } + * + */ + public MessageDestination createMessageDestination() { + return new MessageDestination(); + } + + /** + * Create an instance of {@link WebserviceDescription } + * + */ + public WebserviceDescription createWebserviceDescription() { + return new WebserviceDescription(); + } + + /** + * Create an instance of {@link CacheHelperRef } + * + */ + public CacheHelperRef createCacheHelperRef() { + return new CacheHelperRef(); + } + + /** + * Create an instance of {@link ServletName } + * + */ + public ServletName createServletName() { + return new ServletName(); + } + + /** + * Create an instance of {@link PrincipalName } + * + */ + public PrincipalName createPrincipalName() { + return new PrincipalName(); + } + + /** + * Create an instance of {@link WebserviceEndpoint } + * + */ + public WebserviceEndpoint createWebserviceEndpoint() { + return new WebserviceEndpoint(); + } + + /** + * Create an instance of {@link PortInfo } + * + */ + public PortInfo createPortInfo() { + return new PortInfo(); + } + + /** + * Create an instance of {@link CallProperty } + * + */ + public CallProperty createCallProperty() { + return new CallProperty(); + } + + /** + * Create an instance of {@link ServiceQname } + * + */ + public ServiceQname createServiceQname() { + return new ServiceQname(); + } + + /** + * Create an instance of {@link ManagerProperties } + * + */ + public ManagerProperties createManagerProperties() { + return new ManagerProperties(); + } + + /** + * Create an instance of {@link MethodParam } + * + */ + public MethodParam createMethodParam() { + return new MethodParam(); + } + + /** + * Create an instance of {@link SessionProperties } + * + */ + public SessionProperties createSessionProperties() { + return new SessionProperties(); + } + + /** + * Create an instance of {@link RequestProtection } + * + */ + public RequestProtection createRequestProtection() { + return new RequestProtection(); + } + + /** + * Create an instance of {@link StoreProperties } + * + */ + public StoreProperties createStoreProperties() { + return new StoreProperties(); + } + + /** + * Create an instance of {@link LoginConfig } + * + */ + public LoginConfig createLoginConfig() { + return new LoginConfig(); + } + + /** + * Create an instance of {@link LocaleCharsetMap } + * + */ + public LocaleCharsetMap createLocaleCharsetMap() { + return new LocaleCharsetMap(); + } + + /** + * Create an instance of {@link ConstraintField } + * + */ + public ConstraintField createConstraintField() { + return new ConstraintField(); + } + + /** + * Create an instance of {@link ConstraintFieldValue } + * + */ + public ConstraintFieldValue createConstraintFieldValue() { + return new ConstraintFieldValue(); + } + + /** + * Create an instance of {@link Dispatcher } + * + */ + public Dispatcher createDispatcher() { + return new Dispatcher(); + } + + /** + * Create an instance of {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding createMessageSecurityBinding() { + return new MessageSecurityBinding(); + } + + /** + * Create an instance of {@link CacheHelper } + * + */ + public CacheHelper createCacheHelper() { + return new CacheHelper(); + } + + /** + * Create an instance of {@link DefaultHelper } + * + */ + public DefaultHelper createDefaultHelper() { + return new DefaultHelper(); + } + + /** + * Create an instance of {@link CacheMapping } + * + */ + public CacheMapping createCacheMapping() { + return new CacheMapping(); + } + + /** + * Create an instance of {@link CookieProperties } + * + */ + public CookieProperties createCookieProperties() { + return new CookieProperties(); + } + + /** + * Create an instance of {@link WsdlPort } + * + */ + public WsdlPort createWsdlPort() { + return new WsdlPort(); + } + + /** + * Create an instance of {@link HttpMethod } + * + */ + public HttpMethod createHttpMethod() { + return new HttpMethod(); + } + + /** + * Create an instance of {@link GroupName } + * + */ + public GroupName createGroupName() { + return new GroupName(); + } + + /** + * Create an instance of {@link UrlPattern } + * + */ + public UrlPattern createUrlPattern() { + return new UrlPattern(); + } + + /** + * Create an instance of {@link Timeout } + * + */ + public Timeout createTimeout() { + return new Timeout(); + } + + /** + * Create an instance of {@link KeyField } + * + */ + public KeyField createKeyField() { + return new KeyField(); + } + + /** + * Create an instance of {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal createDefaultResourcePrincipal() { + return new DefaultResourcePrincipal(); + } + + /** + * Create an instance of {@link StubProperty } + * + */ + public StubProperty createStubProperty() { + return new StubProperty(); + } + + /** + * Create an instance of {@link MessageSecurity } + * + */ + public MessageSecurity createMessageSecurity() { + return new MessageSecurity(); + } + + /** + * Create an instance of {@link JavaMethod } + * + */ + public JavaMethod createJavaMethod() { + return new JavaMethod(); + } + + /** + * Create an instance of {@link MethodParams } + * + */ + public MethodParams createMethodParams() { + return new MethodParams(); + } + + /** + * Create an instance of {@link ResponseProtection } + * + */ + public ResponseProtection createResponseProtection() { + return new ResponseProtection(); + } + + /** + * Create an instance of {@link SessionManager } + * + */ + public SessionManager createSessionManager() { + return new SessionManager(); + } + + /** + * Create an instance of {@link Message } + * + */ + public Message createMessage() { + return new Message(); + } + + /** + * Create an instance of {@link OperationName } + * + */ + public OperationName createOperationName() { + return new OperationName(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/OperationName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/OperationName.java new file mode 100644 index 0000000..9e49da4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/OperationName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "operation-name") +public class OperationName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ParameterEncoding.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ParameterEncoding.java new file mode 100644 index 0000000..5da6073 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ParameterEncoding.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "parameter-encoding") +public class ParameterEncoding + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "form-hint-field") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String formHintField; + @XmlAttribute(name = "default-charset") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String defaultCharset; + + /** + * Gets the value of the formHintField property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormHintField() { + return formHintField; + } + + /** + * Sets the value of the formHintField property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormHintField(String value) { + this.formHintField = value; + } + + /** + * Gets the value of the defaultCharset property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDefaultCharset() { + return defaultCharset; + } + + /** + * Sets the value of the defaultCharset property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDefaultCharset(String value) { + this.defaultCharset = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PortInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PortInfo.java new file mode 100644 index 0000000..eeabbe1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PortInfo.java @@ -0,0 +1,179 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceEndpointInterface", + "wsdlPort", + "stubProperty", + "callProperty", + "messageSecurityBinding" +}) +@XmlRootElement(name = "port-info") +public class PortInfo + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-endpoint-interface") + protected String serviceEndpointInterface; + @XmlElement(name = "wsdl-port") + protected WsdlPort wsdlPort; + @XmlElement(name = "stub-property") + protected List stubProperty; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "message-security-binding") + protected MessageSecurityBinding messageSecurityBinding; + + /** + * Gets the value of the serviceEndpointInterface property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceEndpointInterface() { + return serviceEndpointInterface; + } + + /** + * Sets the value of the serviceEndpointInterface property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceEndpointInterface(String value) { + this.serviceEndpointInterface = value; + } + + /** + * Gets the value of the wsdlPort property. + * + * @return + * possible object is + * {@link WsdlPort } + * + */ + public WsdlPort getWsdlPort() { + return wsdlPort; + } + + /** + * Sets the value of the wsdlPort property. + * + * @param value + * allowed object is + * {@link WsdlPort } + * + */ + public void setWsdlPort(WsdlPort value) { + this.wsdlPort = value; + } + + /** + * Gets the value of the stubProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the stubProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getStubProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link StubProperty } + * + * + */ + public List getStubProperty() { + if (stubProperty == null) { + stubProperty = new ArrayList(); + } + return this.stubProperty; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the messageSecurityBinding property. + * + * @return + * possible object is + * {@link MessageSecurityBinding } + * + */ + public MessageSecurityBinding getMessageSecurityBinding() { + return messageSecurityBinding; + } + + /** + * Sets the value of the messageSecurityBinding property. + * + * @param value + * allowed object is + * {@link MessageSecurityBinding } + * + */ + public void setMessageSecurityBinding(MessageSecurityBinding value) { + this.messageSecurityBinding = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PrincipalName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PrincipalName.java new file mode 100644 index 0000000..7224689 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/PrincipalName.java @@ -0,0 +1,88 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "principal-name") +public class PrincipalName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "class-name") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String className; + @XmlValue + protected String value; + + /** + * Gets the value of the className property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClassName() { + return className; + } + + /** + * Sets the value of the className property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClassName(String value) { + this.className = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Property.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Property.java new file mode 100644 index 0000000..901cbb8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Property.java @@ -0,0 +1,114 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "description" +}) +@XmlRootElement(name = "property") +public class Property + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "value", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String value; + protected String description; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RefreshField.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RefreshField.java new file mode 100644 index 0000000..f7c0403 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RefreshField.java @@ -0,0 +1,91 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "refresh-field") +public class RefreshField implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "scope") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String scope; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the scope property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getScope() { + if (scope == null) { + return "request.parameter"; + } else { + return scope; + } + } + + /** + * Sets the value of the scope property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setScope(String value) { + this.scope = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RequestProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RequestProtection.java new file mode 100644 index 0000000..0ba25ac --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/RequestProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "request-protection") +public class RequestProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceEnvRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceEnvRef.java new file mode 100644 index 0000000..acb9045 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceEnvRef.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resourceEnvRefName", + "jndiName" +}) +@XmlRootElement(name = "resource-env-ref") +public class ResourceEnvRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "resource-env-ref-name", required = true) + protected String resourceEnvRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + + /** + * Gets the value of the resourceEnvRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceEnvRefName() { + return resourceEnvRefName; + } + + /** + * Sets the value of the resourceEnvRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceEnvRefName(String value) { + this.resourceEnvRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceRef.java new file mode 100644 index 0000000..07baa8c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResourceRef.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "resRefName", + "jndiName", + "defaultResourcePrincipal" +}) +@XmlRootElement(name = "resource-ref") +public class ResourceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "res-ref-name", required = true) + protected String resRefName; + @XmlElement(name = "jndi-name", required = true) + protected String jndiName; + @XmlElement(name = "default-resource-principal") + protected DefaultResourcePrincipal defaultResourcePrincipal; + + /** + * Gets the value of the resRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResRefName() { + return resRefName; + } + + /** + * Sets the value of the resRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResRefName(String value) { + this.resRefName = value; + } + + /** + * Gets the value of the jndiName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the value of the jndiName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setJndiName(String value) { + this.jndiName = value; + } + + /** + * Gets the value of the defaultResourcePrincipal property. + * + * @return + * possible object is + * {@link DefaultResourcePrincipal } + * + */ + public DefaultResourcePrincipal getDefaultResourcePrincipal() { + return defaultResourcePrincipal; + } + + /** + * Sets the value of the defaultResourcePrincipal property. + * + * @param value + * allowed object is + * {@link DefaultResourcePrincipal } + * + */ + public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { + this.defaultResourcePrincipal = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResponseProtection.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResponseProtection.java new file mode 100644 index 0000000..e9f5c59 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ResponseProtection.java @@ -0,0 +1,87 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "response-protection") +public class ResponseProtection + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "auth-source") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authSource; + @XmlAttribute(name = "auth-recipient") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String authRecipient; + + /** + * Gets the value of the authSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthSource() { + return authSource; + } + + /** + * Sets the value of the authSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthSource(String value) { + this.authSource = value; + } + + /** + * Gets the value of the authRecipient property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthRecipient() { + return authRecipient; + } + + /** + * Sets the value of the authRecipient property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthRecipient(String value) { + this.authRecipient = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SecurityRoleMapping.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SecurityRoleMapping.java new file mode 100644 index 0000000..c27b2f1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SecurityRoleMapping.java @@ -0,0 +1,98 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "roleName", + "principalNameOrGroupName" +}) +@XmlRootElement(name = "security-role-mapping") +public class SecurityRoleMapping + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "role-name", required = true) + protected String roleName; + @XmlElements({ + @XmlElement(name = "principal-name", required = true, type = PrincipalName.class), + @XmlElement(name = "group-name", required = true, type = GroupName.class) + }) + protected List principalNameOrGroupName; + + /** + * Gets the value of the roleName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRoleName() { + return roleName; + } + + /** + * Sets the value of the roleName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRoleName(String value) { + this.roleName = value; + } + + /** + * Gets the value of the principalNameOrGroupName property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the principalNameOrGroupName property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPrincipalNameOrGroupName().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PrincipalName } + * {@link GroupName } + * + * + */ + public List getPrincipalNameOrGroupName() { + if (principalNameOrGroupName == null) { + principalNameOrGroupName = new ArrayList(); + } + return this.principalNameOrGroupName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceQname.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceQname.java new file mode 100644 index 0000000..85b4d73 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceQname.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "service-qname") +public class ServiceQname + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceRef.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceRef.java new file mode 100644 index 0000000..f5ccaea --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServiceRef.java @@ -0,0 +1,206 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "serviceRefName", + "portInfo", + "callProperty", + "wsdlOverride", + "serviceImplClass", + "serviceQname" +}) +@XmlRootElement(name = "service-ref") +public class ServiceRef + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "service-ref-name", required = true) + protected String serviceRefName; + @XmlElement(name = "port-info") + protected List portInfo; + @XmlElement(name = "call-property") + protected List callProperty; + @XmlElement(name = "wsdl-override") + protected String wsdlOverride; + @XmlElement(name = "service-impl-class") + protected String serviceImplClass; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + + /** + * Gets the value of the serviceRefName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceRefName() { + return serviceRefName; + } + + /** + * Sets the value of the serviceRefName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceRefName(String value) { + this.serviceRefName = value; + } + + /** + * Gets the value of the portInfo property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the portInfo property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getPortInfo().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link PortInfo } + * + * + */ + public List getPortInfo() { + if (portInfo == null) { + portInfo = new ArrayList(); + } + return this.portInfo; + } + + /** + * Gets the value of the callProperty property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the callProperty property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getCallProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CallProperty } + * + * + */ + public List getCallProperty() { + if (callProperty == null) { + callProperty = new ArrayList(); + } + return this.callProperty; + } + + /** + * Gets the value of the wsdlOverride property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlOverride() { + return wsdlOverride; + } + + /** + * Sets the value of the wsdlOverride property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlOverride(String value) { + this.wsdlOverride = value; + } + + /** + * Gets the value of the serviceImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceImplClass() { + return serviceImplClass; + } + + /** + * Sets the value of the serviceImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceImplClass(String value) { + this.serviceImplClass = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Servlet.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Servlet.java new file mode 100644 index 0000000..c80c503 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Servlet.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "servletName", + "principalName", + "webserviceEndpoint" +}) +@XmlRootElement(name = "servlet") +public class Servlet + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "servlet-name", required = true) + protected ServletName servletName; + @XmlElement(name = "principal-name") + protected PrincipalName principalName; + @XmlElement(name = "webservice-endpoint") + protected List webserviceEndpoint; + + /** + * Gets the value of the servletName property. + * + * @return + * possible object is + * {@link ServletName } + * + */ + public ServletName getServletName() { + return servletName; + } + + /** + * Sets the value of the servletName property. + * + * @param value + * allowed object is + * {@link ServletName } + * + */ + public void setServletName(ServletName value) { + this.servletName = value; + } + + /** + * Gets the value of the principalName property. + * + * @return + * possible object is + * {@link PrincipalName } + * + */ + public PrincipalName getPrincipalName() { + return principalName; + } + + /** + * Sets the value of the principalName property. + * + * @param value + * allowed object is + * {@link PrincipalName } + * + */ + public void setPrincipalName(PrincipalName value) { + this.principalName = value; + } + + /** + * Gets the value of the webserviceEndpoint property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the webserviceEndpoint property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getWebserviceEndpoint().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link WebserviceEndpoint } + * + * + */ + public List getWebserviceEndpoint() { + if (webserviceEndpoint == null) { + webserviceEndpoint = new ArrayList(); + } + return this.webserviceEndpoint; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServletName.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServletName.java new file mode 100644 index 0000000..13a3af3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/ServletName.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "servlet-name") +public class ServletName implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionConfig.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionConfig.java new file mode 100644 index 0000000..d5ba8fa --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionConfig.java @@ -0,0 +1,113 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "sessionManager", + "sessionProperties", + "cookieProperties" +}) +@XmlRootElement(name = "session-config") +public class SessionConfig + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "session-manager") + protected SessionManager sessionManager; + @XmlElement(name = "session-properties") + protected SessionProperties sessionProperties; + @XmlElement(name = "cookie-properties") + protected CookieProperties cookieProperties; + + /** + * Gets the value of the sessionManager property. + * + * @return + * possible object is + * {@link SessionManager } + * + */ + public SessionManager getSessionManager() { + return sessionManager; + } + + /** + * Sets the value of the sessionManager property. + * + * @param value + * allowed object is + * {@link SessionManager } + * + */ + public void setSessionManager(SessionManager value) { + this.sessionManager = value; + } + + /** + * Gets the value of the sessionProperties property. + * + * @return + * possible object is + * {@link SessionProperties } + * + */ + public SessionProperties getSessionProperties() { + return sessionProperties; + } + + /** + * Sets the value of the sessionProperties property. + * + * @param value + * allowed object is + * {@link SessionProperties } + * + */ + public void setSessionProperties(SessionProperties value) { + this.sessionProperties = value; + } + + /** + * Gets the value of the cookieProperties property. + * + * @return + * possible object is + * {@link CookieProperties } + * + */ + public CookieProperties getCookieProperties() { + return cookieProperties; + } + + /** + * Sets the value of the cookieProperties property. + * + * @param value + * allowed object is + * {@link CookieProperties } + * + */ + public void setCookieProperties(CookieProperties value) { + this.cookieProperties = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionManager.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionManager.java new file mode 100644 index 0000000..1fb4960 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionManager.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "managerProperties", + "storeProperties" +}) +@XmlRootElement(name = "session-manager") +public class SessionManager + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "persistence-type") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String persistenceType; + @XmlElement(name = "manager-properties") + protected ManagerProperties managerProperties; + @XmlElement(name = "store-properties") + protected StoreProperties storeProperties; + + /** + * Gets the value of the persistenceType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPersistenceType() { + if (persistenceType == null) { + return "memory"; + } else { + return persistenceType; + } + } + + /** + * Sets the value of the persistenceType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPersistenceType(String value) { + this.persistenceType = value; + } + + /** + * Gets the value of the managerProperties property. + * + * @return + * possible object is + * {@link ManagerProperties } + * + */ + public ManagerProperties getManagerProperties() { + return managerProperties; + } + + /** + * Sets the value of the managerProperties property. + * + * @param value + * allowed object is + * {@link ManagerProperties } + * + */ + public void setManagerProperties(ManagerProperties value) { + this.managerProperties = value; + } + + /** + * Gets the value of the storeProperties property. + * + * @return + * possible object is + * {@link StoreProperties } + * + */ + public StoreProperties getStoreProperties() { + return storeProperties; + } + + /** + * Sets the value of the storeProperties property. + * + * @param value + * allowed object is + * {@link StoreProperties } + * + */ + public void setStoreProperties(StoreProperties value) { + this.storeProperties = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionProperties.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionProperties.java new file mode 100644 index 0000000..34445a8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SessionProperties.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "session-properties") +public class SessionProperties + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StoreProperties.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StoreProperties.java new file mode 100644 index 0000000..e6a3371 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StoreProperties.java @@ -0,0 +1,64 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "property" +}) +@XmlRootElement(name = "store-properties") +public class StoreProperties + implements Serializable +{ + + private final static long serialVersionUID = 1L; + protected List property; + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StubProperty.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StubProperty.java new file mode 100644 index 0000000..59e3325 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/StubProperty.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name", + "value" +}) +@XmlRootElement(name = "stub-property") +public class StubProperty + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SunWebApp.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SunWebApp.java new file mode 100644 index 0000000..5fb1cc8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/SunWebApp.java @@ -0,0 +1,664 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "contextRoot", + "securityRoleMapping", + "servlet", + "idempotentUrlPattern", + "sessionConfig", + "ejbRef", + "resourceRef", + "resourceEnvRef", + "serviceRef", + "messageDestinationRef", + "cache", + "classLoader", + "jspConfig", + "localeCharsetInfo", + "parameterEncoding", + "property", + "valve", + "messageDestination", + "webserviceDescription" +}) +@XmlRootElement(name = "sun-web-app") +public class SunWebApp + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "error-url") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String errorUrl; + @XmlAttribute(name = "httpservlet-security-provider") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String httpservletSecurityProvider; + @XmlElement(name = "context-root") + protected String contextRoot; + @XmlElement(name = "security-role-mapping") + protected List securityRoleMapping; + protected List servlet; + @XmlElement(name = "idempotent-url-pattern") + protected List idempotentUrlPattern; + @XmlElement(name = "session-config") + protected SessionConfig sessionConfig; + @XmlElement(name = "ejb-ref") + protected List ejbRef; + @XmlElement(name = "resource-ref") + protected List resourceRef; + @XmlElement(name = "resource-env-ref") + protected List resourceEnvRef; + @XmlElement(name = "service-ref") + protected List serviceRef; + @XmlElement(name = "message-destination-ref") + protected List messageDestinationRef; + protected Cache cache; + @XmlElement(name = "class-loader") + protected ClassLoader classLoader; + @XmlElement(name = "jsp-config") + protected JspConfig jspConfig; + @XmlElement(name = "locale-charset-info") + protected LocaleCharsetInfo localeCharsetInfo; + @XmlElement(name = "parameter-encoding") + protected ParameterEncoding parameterEncoding; + protected List property; + protected List valve; + @XmlElement(name = "message-destination") + protected List messageDestination; + @XmlElement(name = "webservice-description") + protected List webserviceDescription; + + /** + * Gets the value of the errorUrl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorUrl() { + if (errorUrl == null) { + return ""; + } else { + return errorUrl; + } + } + + /** + * Sets the value of the errorUrl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorUrl(String value) { + this.errorUrl = value; + } + + /** + * Gets the value of the httpservletSecurityProvider property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHttpservletSecurityProvider() { + return httpservletSecurityProvider; + } + + /** + * Sets the value of the httpservletSecurityProvider property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHttpservletSecurityProvider(String value) { + this.httpservletSecurityProvider = value; + } + + /** + * Gets the value of the contextRoot property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContextRoot() { + return contextRoot; + } + + /** + * Sets the value of the contextRoot property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContextRoot(String value) { + this.contextRoot = value; + } + + /** + * Gets the value of the securityRoleMapping property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the securityRoleMapping property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getSecurityRoleMapping().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link SecurityRoleMapping } + * + * + */ + public List getSecurityRoleMapping() { + if (securityRoleMapping == null) { + securityRoleMapping = new ArrayList(); + } + return this.securityRoleMapping; + } + + /** + * Gets the value of the servlet property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the servlet property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServlet().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Servlet } + * + * + */ + public List getServlet() { + if (servlet == null) { + servlet = new ArrayList(); + } + return this.servlet; + } + + /** + * Gets the value of the idempotentUrlPattern property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the idempotentUrlPattern property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getIdempotentUrlPattern().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link IdempotentUrlPattern } + * + * + */ + public List getIdempotentUrlPattern() { + if (idempotentUrlPattern == null) { + idempotentUrlPattern = new ArrayList(); + } + return this.idempotentUrlPattern; + } + + /** + * Gets the value of the sessionConfig property. + * + * @return + * possible object is + * {@link SessionConfig } + * + */ + public SessionConfig getSessionConfig() { + return sessionConfig; + } + + /** + * Sets the value of the sessionConfig property. + * + * @param value + * allowed object is + * {@link SessionConfig } + * + */ + public void setSessionConfig(SessionConfig value) { + this.sessionConfig = value; + } + + /** + * Gets the value of the ejbRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the ejbRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEjbRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link EjbRef } + * + * + */ + public List getEjbRef() { + if (ejbRef == null) { + ejbRef = new ArrayList(); + } + return this.ejbRef; + } + + /** + * Gets the value of the resourceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceRef } + * + * + */ + public List getResourceRef() { + if (resourceRef == null) { + resourceRef = new ArrayList(); + } + return this.resourceRef; + } + + /** + * Gets the value of the resourceEnvRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the resourceEnvRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResourceEnvRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ResourceEnvRef } + * + * + */ + public List getResourceEnvRef() { + if (resourceEnvRef == null) { + resourceEnvRef = new ArrayList(); + } + return this.resourceEnvRef; + } + + /** + * Gets the value of the serviceRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceRef } + * + * + */ + public List getServiceRef() { + if (serviceRef == null) { + serviceRef = new ArrayList(); + } + return this.serviceRef; + } + + /** + * Gets the value of the messageDestinationRef property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestinationRef property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestinationRef().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestinationRef } + * + * + */ + public List getMessageDestinationRef() { + if (messageDestinationRef == null) { + messageDestinationRef = new ArrayList(); + } + return this.messageDestinationRef; + } + + /** + * Gets the value of the cache property. + * + * @return + * possible object is + * {@link Cache } + * + */ + public Cache getCache() { + return cache; + } + + /** + * Sets the value of the cache property. + * + * @param value + * allowed object is + * {@link Cache } + * + */ + public void setCache(Cache value) { + this.cache = value; + } + + /** + * Gets the value of the classLoader property. + * + * @return + * possible object is + * {@link ClassLoader } + * + */ + public ClassLoader getClassLoader() { + return classLoader; + } + + /** + * Sets the value of the classLoader property. + * + * @param value + * allowed object is + * {@link ClassLoader } + * + */ + public void setClassLoader(ClassLoader value) { + this.classLoader = value; + } + + /** + * Gets the value of the jspConfig property. + * + * @return + * possible object is + * {@link JspConfig } + * + */ + public JspConfig getJspConfig() { + return jspConfig; + } + + /** + * Sets the value of the jspConfig property. + * + * @param value + * allowed object is + * {@link JspConfig } + * + */ + public void setJspConfig(JspConfig value) { + this.jspConfig = value; + } + + /** + * Gets the value of the localeCharsetInfo property. + * + * @return + * possible object is + * {@link LocaleCharsetInfo } + * + */ + public LocaleCharsetInfo getLocaleCharsetInfo() { + return localeCharsetInfo; + } + + /** + * Sets the value of the localeCharsetInfo property. + * + * @param value + * allowed object is + * {@link LocaleCharsetInfo } + * + */ + public void setLocaleCharsetInfo(LocaleCharsetInfo value) { + this.localeCharsetInfo = value; + } + + /** + * Gets the value of the parameterEncoding property. + * + * @return + * possible object is + * {@link ParameterEncoding } + * + */ + public ParameterEncoding getParameterEncoding() { + return parameterEncoding; + } + + /** + * Sets the value of the parameterEncoding property. + * + * @param value + * allowed object is + * {@link ParameterEncoding } + * + */ + public void setParameterEncoding(ParameterEncoding value) { + this.parameterEncoding = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + + /** + * Gets the value of the valve property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the valve property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getValve().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Valve } + * + * + */ + public List getValve() { + if (valve == null) { + valve = new ArrayList(); + } + return this.valve; + } + + /** + * Gets the value of the messageDestination property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the messageDestination property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getMessageDestination().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link MessageDestination } + * + * + */ + public List getMessageDestination() { + if (messageDestination == null) { + messageDestination = new ArrayList(); + } + return this.messageDestination; + } + + /** + * Gets the value of the webserviceDescription property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the webserviceDescription property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getWebserviceDescription().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link WebserviceDescription } + * + * + */ + public List getWebserviceDescription() { + if (webserviceDescription == null) { + webserviceDescription = new ArrayList(); + } + return this.webserviceDescription; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Timeout.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Timeout.java new file mode 100644 index 0000000..0cdf902 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Timeout.java @@ -0,0 +1,120 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "timeout") +public class Timeout implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "scope") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String scope; + @XmlValue + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the scope property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getScope() { + if (scope == null) { + return "request.attribute"; + } else { + return scope; + } + } + + /** + * Sets the value of the scope property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setScope(String value) { + this.scope = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/UrlPattern.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/UrlPattern.java new file mode 100644 index 0000000..5fe6d5d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/UrlPattern.java @@ -0,0 +1,58 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "value" +}) +@XmlRootElement(name = "url-pattern") +public class UrlPattern implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlValue + protected String value; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getvalue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setvalue(String value) { + this.value = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Valve.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Valve.java new file mode 100644 index 0000000..47552de --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/Valve.java @@ -0,0 +1,147 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "description", + "property" +}) +@XmlRootElement(name = "valve") +public class Valve + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlAttribute(name = "name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String name; + @XmlAttribute(name = "class-name", required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String className; + protected String description; + protected List property; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the className property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClassName() { + return className; + } + + /** + * Sets the value of the className property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClassName(String value) { + this.className = value; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + + /** + * Gets the value of the property property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the property property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getProperty().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Property } + * + * + */ + public List getProperty() { + if (property == null) { + property = new ArrayList(); + } + return this.property; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceDescription.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceDescription.java new file mode 100644 index 0000000..887da01 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceDescription.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "webserviceDescriptionName", + "wsdlPublishLocation" +}) +@XmlRootElement(name = "webservice-description") +public class WebserviceDescription + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "webservice-description-name", required = true) + protected String webserviceDescriptionName; + @XmlElement(name = "wsdl-publish-location") + protected String wsdlPublishLocation; + + /** + * Gets the value of the webserviceDescriptionName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWebserviceDescriptionName() { + return webserviceDescriptionName; + } + + /** + * Sets the value of the webserviceDescriptionName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWebserviceDescriptionName(String value) { + this.webserviceDescriptionName = value; + } + + /** + * Gets the value of the wsdlPublishLocation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWsdlPublishLocation() { + return wsdlPublishLocation; + } + + /** + * Sets the value of the wsdlPublishLocation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWsdlPublishLocation(String value) { + this.wsdlPublishLocation = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceEndpoint.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceEndpoint.java new file mode 100644 index 0000000..836d146 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WebserviceEndpoint.java @@ -0,0 +1,260 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "portComponentName", + "endpointAddressUri", + "loginConfigOrMessageSecurityBinding", + "transportGuarantee", + "serviceQname", + "tieClass", + "servletImplClass", + "debuggingEnabled" +}) +@XmlRootElement(name = "webservice-endpoint") +public class WebserviceEndpoint + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(name = "port-component-name", required = true) + protected String portComponentName; + @XmlElement(name = "endpoint-address-uri") + protected String endpointAddressUri; + @XmlElements({ + @XmlElement(name = "login-config", type = LoginConfig.class), + @XmlElement(name = "message-security-binding", type = MessageSecurityBinding.class) + }) + protected List loginConfigOrMessageSecurityBinding; + @XmlElement(name = "transport-guarantee") + protected String transportGuarantee; + @XmlElement(name = "service-qname") + protected ServiceQname serviceQname; + @XmlElement(name = "tie-class") + protected String tieClass; + @XmlElement(name = "servlet-impl-class") + protected String servletImplClass; + @XmlElement(name = "debugging-enabled") + protected String debuggingEnabled; + + /** + * Gets the value of the portComponentName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPortComponentName() { + return portComponentName; + } + + /** + * Sets the value of the portComponentName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPortComponentName(String value) { + this.portComponentName = value; + } + + /** + * Gets the value of the endpointAddressUri property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEndpointAddressUri() { + return endpointAddressUri; + } + + /** + * Sets the value of the endpointAddressUri property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEndpointAddressUri(String value) { + this.endpointAddressUri = value; + } + + /** + * Gets the value of the loginConfigOrMessageSecurityBinding property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the loginConfigOrMessageSecurityBinding property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getLoginConfigOrMessageSecurityBinding().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link LoginConfig } + * {@link MessageSecurityBinding } + * + * + */ + public List getLoginConfigOrMessageSecurityBinding() { + if (loginConfigOrMessageSecurityBinding == null) { + loginConfigOrMessageSecurityBinding = new ArrayList(); + } + return this.loginConfigOrMessageSecurityBinding; + } + + /** + * Gets the value of the transportGuarantee property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTransportGuarantee() { + return transportGuarantee; + } + + /** + * Sets the value of the transportGuarantee property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTransportGuarantee(String value) { + this.transportGuarantee = value; + } + + /** + * Gets the value of the serviceQname property. + * + * @return + * possible object is + * {@link ServiceQname } + * + */ + public ServiceQname getServiceQname() { + return serviceQname; + } + + /** + * Sets the value of the serviceQname property. + * + * @param value + * allowed object is + * {@link ServiceQname } + * + */ + public void setServiceQname(ServiceQname value) { + this.serviceQname = value; + } + + /** + * Gets the value of the tieClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTieClass() { + return tieClass; + } + + /** + * Sets the value of the tieClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTieClass(String value) { + this.tieClass = value; + } + + /** + * Gets the value of the servletImplClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServletImplClass() { + return servletImplClass; + } + + /** + * Sets the value of the servletImplClass property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServletImplClass(String value) { + this.servletImplClass = value; + } + + /** + * Gets the value of the debuggingEnabled property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDebuggingEnabled() { + return debuggingEnabled; + } + + /** + * Sets the value of the debuggingEnabled property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDebuggingEnabled(String value) { + this.debuggingEnabled = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WsdlPort.java b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WsdlPort.java new file mode 100644 index 0000000..7d82a23 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/implementation/sun/javaee/runtime/web/WsdlPort.java @@ -0,0 +1,86 @@ +// +// This file was generated by the Eclipse Implementation of JAXB, v3.0.0-M3 +// See https://eclipse-ee4j.github.io/jaxb-ri +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2022.04.29 at 09:57:40 PM UTC +// + + +package com.sun.ts.lib.implementation.sun.javaee.runtime.web; + +import java.io.Serializable; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; + + +/** + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "namespaceURI", + "localpart" +}) +@XmlRootElement(name = "wsdl-port") +public class WsdlPort + implements Serializable +{ + + private final static long serialVersionUID = 1L; + @XmlElement(required = true) + protected String namespaceURI; + @XmlElement(required = true) + protected String localpart; + + /** + * Gets the value of the namespaceURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Sets the value of the namespaceURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNamespaceURI(String value) { + this.namespaceURI = value; + } + + /** + * Gets the value of the localpart property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLocalpart() { + return localpart; + } + + /** + * Sets the value of the localpart property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLocalpart(String value) { + this.localpart = value; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSEnvironmentInterview.java b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSEnvironmentInterview.java new file mode 100644 index 0000000..38782cb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSEnvironmentInterview.java @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.javatest; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Iterator; +import com.sun.interview.ErrorQuestion; +import com.sun.interview.ExtensionFileFilter; +import com.sun.interview.FileListQuestion; +import com.sun.interview.FinalQuestion; +import com.sun.interview.Interview; +import com.sun.interview.Question; +import com.sun.interview.StringQuestion; +import com.sun.javatest.InterviewParameters; +import com.sun.javatest.Parameters; +import com.sun.javatest.TestEnvContext; +import com.sun.javatest.TestEnvironment; +import com.sun.javatest.TestFilter; +import com.sun.javatest.TestSuite; +import com.sun.ts.lib.util.TestUtil; + +/** + * This interview collects the environment parameter, by means of environment + * (jte) files and an environment name. It is normally used as one of a series + * of sub-interviews that collect the parameter information for a test run. It + * is suitable for use with legacy test suites that still rely on environments + * being provided with .jte files; more sophisticated interviews should create a + * custom interview that collects the environment data directly. + */ +public class TSEnvironmentInterview extends Interview + implements Parameters.LegacyEnvParameters { + /** + * Create an interview. + * + * @param parent + * The parent interview of which this is a child. + * @throws Interview.Fault + * if there is a problem while creating the interview. + */ + public TSEnvironmentInterview(InterviewParameters parent) + throws Interview.Fault { + super(parent, "environment"); + this.parent = parent; + setResourceBundle("i18n"); + // setHelpSet("/com/sun/javatest/moreInfo/moreInfo.hs"); + setFirstQuestion(qEnvFiles); + } + + /** + * Get the environment files specified in the interview. + * + * @return the list of files specified in the interview + * @see #setEnvFiles + */ + public File[] getEnvFiles() { + return qEnvFiles.getValue(); + } + + public File[] getAbsoluteEnvFiles() { + return getAbsoluteFiles(parent.getTestSuite().getRootDir(), getEnvFiles()); + } + + /** + * Set the environment files for the interview. + * + * @param files + * the environment files for the interview + * @see #getEnvFiles + */ + public void setEnvFiles(File[] files) { + qEnvFiles.setValue(files); + } + + /** + * Get the environment name specified in the interview. + * + * @return the environment name specified in the interview + * @see #setEnvName + */ + public String getEnvName() { + return qEnv.getValue(); + } + + /** + * Set the environment name for the interview. + * + * @param name + * the environment name for the interview + * @see #getEnvName + */ + public void setEnvName(String name) { + qEnv.setValue(name); + } + + /** + * Get the environment specified by the environment files and environment + * name, or null, if it cannot be determined. + * + * @return the environment determined by the interview, or null if it cannot + * be determined. + * @see #getEnvFiles + * @see #getEnvName + */ + public TestEnvironment getEnv() { + updateCachedEnv(); + return cachedEnv; + } + + // ---------------------------------------------------------------------------- + // + // Env files + + private FileListQuestion qEnvFiles = new FileListQuestion(this, "envFiles") { + { // CF 6/17/02 + setFilter(new ExtensionFileFilter(".jte", "Environment File")); + setValue( + new File[] { new File(TSLegacyParameters.TS_HOME, "bin/ts.jte") }); + } + + public File getBaseDirectory() { + TestSuite ts = parent.getTestSuite(); + if (ts == null) + return null; + else { + File r = ts.getRoot(); + return r.isDirectory() ? r : r.getParentFile(); + } + } + + protected Question getNext() { + updateCachedEnvTable(); + if (cachedEnvTableError != null) + return qEnvTableError; + else if (cachedEnvTable == null + || cachedEnvTable.getEnvNames().length == 0) + return qNoEnvs; + else + return qEnv; + } + }; + + private TestEnvContext getEnvTable() { + updateCachedEnvTable(); + return cachedEnvTable; + } + + private void updateCachedEnvTable() { + File[] absFiles = getAbsoluteEnvFiles(); + if (!equal(cachedEnvTable_absFiles, absFiles)) { + try { + cachedEnvTable = new TestEnvContext(absFiles); + cachedEnvTableError = null; + } catch (TestEnvContext.Fault e) { + e.printStackTrace(); + cachedEnvTable = null; + cachedEnvTableError = e.getMessage(); + } + cachedEnvTable_absFiles = absFiles; + } + } + + private TestEnvContext cachedEnvTable; + + private File[] cachedEnvTable_absFiles; + + private String cachedEnvTableError; + + // ---------------------------------------------------------------------------- + // + // No Env + + private ErrorQuestion qNoEnvs = new ErrorQuestion(this, "noEnvs"); + + // ---------------------------------------------------------------------------- + // + // Env Table Error + + private ErrorQuestion qEnvTableError = new ErrorQuestion(this, + "envTableError") { + protected Object[] getTextArgs() { + return new Object[] { cachedEnvTableError }; + } + }; + + // ---------------------------------------------------------------------------- + // + // Env + + private StringQuestion qEnv = new StringQuestion(this, "env") { + { + if (TSLegacyParameters.OS.toUpperCase().startsWith("WIN")) { + setValue("ts_win32"); + } else { + setValue("ts_unix"); + } + } + + public String[] getSuggestions() { + // ensure the choices are up to date with envTable; + // note that setting choices may smash the current value + // if it's not a valid choice in the new set + TestEnvContext envTable = getEnvTable(); + if (envTable != cachedEnvTable) { + String[] envNames; + if (envTable == null) + envNames = TestUtil.EMPTY_STRING_ARRAY; + else { + String[] names = envTable.getEnvMenuNames(); + Arrays.sort(names); + envNames = names; + } + setSuggestions(envNames); + cachedEnvTable = envTable; + } + return super.getSuggestions(); + } + + protected Question getNext() { + if (value == null) + return null; + else { + updateCachedEnv(); + if (cachedEnv == null) + return cachedEnvError; + else + return qEnd; + } + } + + private TestEnvContext cachedEnvTable; + }; + + private void updateCachedEnv() { + TestEnvContext envTable = getEnvTable(); + String envName = getEnvName(); + if (cachedEnv_envTable != envTable || !equal(cachedEnv_envName, envName)) { + try { + if (envTable == null || envName == null || envName.length() == 0) { + cachedEnv = null; + cachedEnvError = null; + } else { + cachedEnv = envTable.getEnv(envName); + if (cachedEnv == null) { + cachedEnvError = qEnvNotFound; + cachedEnvErrorArgs = new Object[] { envName }; + } else { + // verify all entries defined + cachedEnvError = null; + cachedEnvErrorArgs = null; + for (Iterator i = cachedEnv.elements().iterator(); i.hasNext() + && cachedEnvError == null;) { + TestEnvironment.Element entry = (TestEnvironment.Element) (i + .next()); + if (entry.getValue().indexOf("VALUE_NOT_DEFINED") >= 0) { + cachedEnv = null; + String eText = ((entry.getDefinedInEnv() == null ? "" + : "env." + entry.getDefinedInEnv() + ".") + entry.getKey() + + "=" + entry.getValue()); + cachedEnvError = qEnvUndefinedEntry; + cachedEnvErrorArgs = new Object[] { eText, + entry.getDefinedInFile() }; + } + } + } + } + + } catch (TestEnvironment.Fault e) { + cachedEnv = null; + cachedEnvError = qEnvError; + cachedEnvErrorArgs = new Object[] { e.getMessage() }; + } + cachedEnv_envTable = envTable; + cachedEnv_envName = envName; + } + } + + private TestEnvironment cachedEnv; + + private TestEnvContext cachedEnv_envTable; + + private String cachedEnv_envName; + + private Question cachedEnvError; + + private Object[] cachedEnvErrorArgs; + + // ---------------------------------------------------------------------------- + // + // Env Error + + private ErrorQuestion qEnvError = new ErrorQuestion(this, "envError") { + protected Object[] getTextArgs() { + return cachedEnvErrorArgs; + } + }; + + // ---------------------------------------------------------------------------- + // + // Env Not Found + + private ErrorQuestion qEnvNotFound = new ErrorQuestion(this, "envNotFound") { + protected Object[] getTextArgs() { + return cachedEnvErrorArgs; + } + }; + + // ---------------------------------------------------------------------------- + // + // Env Undefined Entry + + private ErrorQuestion qEnvUndefinedEntry = new ErrorQuestion(this, + "envUndefinedEntry") { + protected Object[] getTextArgs() { + return cachedEnvErrorArgs; + } + }; + + // ---------------------------------------------------------------------------- + // + // End + + private Question qEnd = new FinalQuestion(this); + + // --------------------------------------------------------------------- + + private static File[] getAbsoluteFiles(File baseDir, File[] files) { + if (files == null) + return null; + + boolean allAbsolute = true; + for (int i = 0; i < files.length && allAbsolute; i++) + allAbsolute = files[i].isAbsolute(); + + if (allAbsolute) + return files; + + File[] absoluteFiles = new File[files.length]; + for (int i = 0; i < files.length; i++) { + File f = files[i]; + absoluteFiles[i] = (f.isAbsolute() ? f : new File(baseDir, f.getPath())); + } + + return absoluteFiles; + } + + // ---------------------------------------------------------------------------- + + private static boolean equal(File f1, File f2) { + return (f1 == null ? f2 == null : f1.equals(f2)); + } + + private static boolean equal(File[] f1, File[] f2) { + if (f1 == null || f2 == null) + return (f1 == f2); + + if (f1.length != f2.length) + return false; + + for (int i = 0; i < f1.length; i++) { + if (f1[i] != f2[i]) + return false; + } + + return true; + } + + private static boolean equal(String s1, String s2) { + return (s1 == null ? s2 == null : s1.equals(s2)); + } + + // -------------------------------------------------------- + + private InterviewParameters parent; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSExcludeListInterview.java b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSExcludeListInterview.java new file mode 100644 index 0000000..b7953d3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSExcludeListInterview.java @@ -0,0 +1,510 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.javatest; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.util.Vector; +import com.sun.interview.ChoiceQuestion; +import com.sun.interview.ErrorQuestion; +import com.sun.interview.ExtensionFileFilter; +import com.sun.interview.FileQuestion; +import com.sun.interview.FileListQuestion; +import com.sun.interview.FinalQuestion; +import com.sun.interview.Interview; +import com.sun.interview.IntQuestion; +import com.sun.interview.Question; +import com.sun.interview.YesNoQuestion; +import com.sun.javatest.ExcludeList; +import com.sun.javatest.ExcludeListFilter; +import com.sun.javatest.InterviewParameters; +import com.sun.javatest.Parameters; +import com.sun.javatest.TestFilter; +import com.sun.javatest.TestSuite; +import com.sun.javatest.WorkDirectory; +import com.sun.javatest.util.I18NResourceBundle; + +/** + * This interview collects the "exclude list" test filter parameters. It is + * normally used as one of a series of sub-interviews that collect the parameter + * information for a test run. + */ +public class TSExcludeListInterview extends Interview + implements Parameters.MutableExcludeListParameters { + /** + * Create an interview. + * + * @param parent + * The parent interview of which this is a child. + * @throws Interview.Fault + * if there is a problem while creating the interview. + */ + public TSExcludeListInterview(InterviewParameters parent) + throws Interview.Fault { + super(parent, "excludeList"); + this.parent = parent; + setResourceBundle("i18n"); + // setHelpSet("/com/sun/javatest/moreInfo/moreInfo.hs"); + setFirstQuestion(qNeedExcludeLists); + } + + public File[] getExcludeFiles() { + if (qNeedExcludeLists.getValue() == YesNoQuestion.YES) { + String t = qExcludeListType.getValue(); + if (t == initial) { + File f = parent.getTestSuite().getInitialExcludeList(); + if (f == null) + return null; + else + return new File[] { f }; + } else if (t == latest) { + URL u = parent.getTestSuite().getLatestExcludeList(); + if (u == null) + return null; + else { + WorkDirectory wd = parent.getWorkDirectory(); + return new File[] { wd.getSystemFile("latest.jtx") }; + } + } else + return qCustomFiles.getValue(); + } else + return null; + } + + public void setExcludeFiles(File[] files) { + if (files == null || files.length == 0) + setExcludeMode(NO_EXCLUDE_LIST); + else { + setExcludeMode(CUSTOM_EXCLUDE_LIST); + setCustomExcludeFiles(files); + } + } + + public int getExcludeMode() { + if (qNeedExcludeLists.getValue() == YesNoQuestion.YES) { + String t = qExcludeListType.getValue(); + if (t == initial) + return INITIAL_EXCLUDE_LIST; + else if (t == latest) + return LATEST_EXCLUDE_LIST; + else + return CUSTOM_EXCLUDE_LIST; + } else + return NO_EXCLUDE_LIST; + } + + public void setExcludeMode(int mode) { + if (mode == NO_EXCLUDE_LIST) + qNeedExcludeLists.setValue(YesNoQuestion.NO); + else { + qNeedExcludeLists.setValue(YesNoQuestion.YES); + switch (mode) { + case INITIAL_EXCLUDE_LIST: + qExcludeListType.setValue(initial); + break; + case LATEST_EXCLUDE_LIST: + qExcludeListType.setValue(latest); + break; + default: + qExcludeListType.setValue(custom); + break; + } + } + } + + public File[] getCustomExcludeFiles() { + return qCustomFiles.getValue(); + } + + public void setCustomExcludeFiles(File[] files) { + qCustomFiles.setValue(files); + } + + public boolean isLatestExcludeAutoCheckEnabled() { + return (qLatestAutoCheck.getValue() == YesNoQuestion.YES); + } + + public void setLatestExcludeAutoCheckEnabled(boolean b) { + qLatestAutoCheck.setValue(b ? YesNoQuestion.YES : YesNoQuestion.NO); + } + + public int getLatestExcludeAutoCheckMode() { + return (qLatestAutoCheckMode.getValue() == EVERY_X_DAYS ? CHECK_EVERY_X_DAYS + : CHECK_EVERY_RUN); + } + + public void setLatestExcludeAutoCheckMode(int mode) { + if (mode == CHECK_EVERY_X_DAYS) + qLatestAutoCheckMode.setValue(EVERY_X_DAYS); + else + qLatestAutoCheckMode.setValue(EVERY_RUN); + } + + public int getLatestExcludeAutoCheckInterval() { + return qLatestAutoCheckInterval.getValue(); + } + + public void setLatestExcludeAutoCheckInterval(int days) { + qLatestAutoCheckInterval.setValue(days); + } + + /** + * Get the exclude list generated from the exclude list files in the + * interview. + * + * @return the exclude list generated from the exclude list files in the + * interview + * @see #getExcludeFiles + */ + public ExcludeList getExcludeList() { + if (qNeedExcludeLists.getValue() == YesNoQuestion.YES) { + updateCachedExcludeListData(); + return cachedExcludeList; + } else + return new ExcludeList(); + } + + /** + * Get a test filter generated from the exclude list files in the interview. + * + * @return a test filter generated from the exclude list files in the + * interview + * @see #getExcludeFiles + */ + public TestFilter getExcludeFilter() { + if (qNeedExcludeLists.getValue() == YesNoQuestion.YES) { + updateCachedExcludeListData(); + return cachedExcludeListFilter; + } else + return null; + } + + // ---------------------------------------------------------------------------- + // + // Need exclude list + + private YesNoQuestion qNeedExcludeLists = new YesNoQuestion(this, + "needExcludeList") { + { + setValue(YesNoQuestion.YES); // CF 6/17/02 + } + + protected Question getNext() { + if (value == null) + return null; + else if (value == YES) + return qExcludeListType; + else + return qEnd; + } + }; + + // ---------------------------------------------------------------------------- + // + // Type of exclude list + + private static String initial = "initial"; + + private static String latest = "latest"; + + private static String custom = "custom"; + + private ChoiceQuestion qExcludeListType = new ChoiceQuestion(this, + "excludeListType") { + { + // Difficulty here is that these depend on the test suite, which + // will not have been set yet. So, set these full set of choices + // for now, and refine the choices when the test suite gets set. + + try { + I18NResourceBundle rb = I18NResourceBundle.getBundleForClass( + Class.forName("com.sun.ts.lib.javatest.TSExcludeListInterview")); + + initial = rb + .getString("TSExcludeListInterview.excludeList.choice.initial"); + latest = rb + .getString("TSExcludeListInterview.excludeList.choice.latest"); + custom = rb + .getString("TSExcludeListInterview.excludeList.choice.custom"); + } catch (ClassNotFoundException cnfe) { + System.err.println( + "Cannot load the resource bundle for the package containing the class, " + + "com.sun.ts.lib.javatest.TSExcludeListInterview"); + cnfe.printStackTrace(); + } + + setChoices(new String[] { null, initial, latest, custom }, true); + setValue(initial); // CF 6/17/02 + } + + public String[] getChoices() { + if (!initialized && parent.getTestSuite() != null) + init(parent.getTestSuite()); + return super.getChoices(); + } + + public boolean isHidden() { + // getChoices() in next line will eventually force init() + return (getChoices().length == 2); // null and custom + } + + public String getValue() { + // isHidden() in next line will eventually force init() + return (isHidden() ? custom : super.getValue()); + } + + protected Question getNext() { + if (isHidden()) + return qCustomFiles; + else if (value == null || value.length() == 0) + return null; + else if (value.equals(initial)) + return qEnd; + else if (value.equals(latest)) + return qLatestAutoCheck; + else + return qCustomFiles; + } + + private void init(TestSuite ts) { + Vector v = new Vector(4); + v.add(null); // always + if (ts.getInitialExcludeList() != null) + v.add(initial); + if (ts.getLatestExcludeList() != null) + v.add(latest); + v.add(custom); // always + String[] choices = new String[v.size()]; + v.copyInto(choices); + setChoices(choices, true); + initialized = true; + } + + private boolean initialized; + }; + + // ---------------------------------------------------------------------------- + // + // Auto check latest + + private YesNoQuestion qLatestAutoCheck = new YesNoQuestion(this, + "latestAutoCheck") { + { + setValue(YesNoQuestion.NO); + } + + protected Question getNext() { + if (value == null) + return null; + else if (value == YES) + return qLatestAutoCheckMode; + else + return qEnd; + } + }; + + // ---------------------------------------------------------------------------- + // + // Auto check latest mode + + private static final String EVERY_X_DAYS = "everyXDays"; + + private static final String EVERY_RUN = "everyRun"; + + private ChoiceQuestion qLatestAutoCheckMode = new ChoiceQuestion(this, + "latestAutoCheckMode") { + { + setChoices(new String[] { EVERY_X_DAYS, EVERY_RUN }, true); + } + + protected Question getNext() { + if (value == null) + return null; + else if (value.equals(EVERY_X_DAYS)) + return qLatestAutoCheckInterval; + else + return qEnd; + } + }; + + // ---------------------------------------------------------------------------- + // + // Auto check latest interval + + private IntQuestion qLatestAutoCheckInterval = new IntQuestion(this, + "latestAutoCheckInterval") { + { + setBounds(1, 365); + setValue(7); + } + + protected Question getNext() { + return qEnd; + } + }; + + // ---------------------------------------------------------------------------- + // + // Exclude List + + private FileListQuestion qCustomFiles = new FileListQuestion(this, + "customFiles") { + { + // I18N... + setFilter(new ExtensionFileFilter(".jtx", "Exclude List")); + } + + protected Question getNext() { + updateCachedExcludeListData(); + if (cachedExcludeListError != null) + return cachedExcludeListError; + else + return qEnd; + } + + public File getBaseDirectory() { + TestSuite ts = parent.getTestSuite(); + return (ts == null ? null : ts.getRootDir()); + } + }; + + private void updateCachedExcludeListData() { + TestSuite ts = parent.getTestSuite(); + File[] files = getAbsoluteFiles(ts.getRoot(), getExcludeFiles()); + if (!equal(cachedExcludeList_files, files) + || cachedExcludeList_testSuite != ts) { + try { + ExcludeList t; + if (ts == null || files == null || files.length == 0) + t = new ExcludeList(); + else + t = new ExcludeList(files); + cachedExcludeList = t; + cachedExcludeListFilter = new ExcludeListFilter(t); + cachedExcludeListError = null; + } catch (FileNotFoundException e) { + cachedExcludeList = null; + cachedExcludeListFilter = null; + cachedExcludeListError = qExcludeListFileNotFound; + cachedExcludeListErrorArgs = new String[] { e.getMessage() }; + } catch (IOException e) { + cachedExcludeList = null; + cachedExcludeListFilter = null; + cachedExcludeListError = qExcludeListIOError; + cachedExcludeListErrorArgs = new String[] { e.toString() }; + } catch (ExcludeList.Fault e) { + cachedExcludeList = null; + cachedExcludeListFilter = null; + cachedExcludeListError = qExcludeListError; + cachedExcludeListErrorArgs = new String[] { e.getMessage() }; + } + cachedExcludeList_files = files; + } + } + + private ExcludeList cachedExcludeList; + + private ExcludeListFilter cachedExcludeListFilter; + + private Question cachedExcludeListError; + + private Object[] cachedExcludeListErrorArgs; + + private TestSuite cachedExcludeList_testSuite; + + private File[] cachedExcludeList_files; + + // ---------------------------------------------------------------------------- + // + // Exclude List Error + + private ErrorQuestion qExcludeListFileNotFound = new ErrorQuestion(this, + "excludeListFileNotFound") { + protected Object[] getTextArgs() { + return cachedExcludeListErrorArgs; + } + }; + + private ErrorQuestion qExcludeListIOError = new ErrorQuestion(this, + "excludeListIOError") { + protected Object[] getTextArgs() { + return cachedExcludeListErrorArgs; + } + }; + + private ErrorQuestion qExcludeListError = new ErrorQuestion(this, + "excludeListError") { + protected Object[] getTextArgs() { + return cachedExcludeListErrorArgs; + } + }; + + // ---------------------------------------------------------------------------- + // + // End + + private Question qEnd = new FinalQuestion(this); + + // --------------------------------------------------------------------- + + private static File[] getAbsoluteFiles(File baseDir, File[] files) { + if (files == null) + return null; + + boolean allAbsolute = true; + for (int i = 0; i < files.length && allAbsolute; i++) + allAbsolute = files[i].isAbsolute(); + + if (allAbsolute) + return files; + + File[] absoluteFiles = new File[files.length]; + for (int i = 0; i < files.length; i++) { + File f = files[i]; + absoluteFiles[i] = (f.isAbsolute() ? f : new File(baseDir, f.getPath())); + } + + return absoluteFiles; + } + + // ---------------------------------------------------------------------------- + + private static boolean equal(File f1, File f2) { + return (f1 == null ? f2 == null : f1.equals(f2)); + } + + private static boolean equal(File[] f1, File[] f2) { + if (f1 == null || f2 == null) + return (f1 == f2); + + if (f1.length != f2.length) + return false; + + for (int i = 0; i < f1.length; i++) { + if (f1[i] != f2[i]) + return false; + } + + return true; + } + + // -------------------------------------------------------- + + private InterviewParameters parent; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSLegacyParameters.java b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSLegacyParameters.java new file mode 100644 index 0000000..5bc9030 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSLegacyParameters.java @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.javatest; + +import java.util.*; +import java.text.MessageFormat; +import com.sun.javatest.util.*; +import com.sun.interview.*; +import com.sun.javatest.*; +import com.sun.javatest.interview.*; + +public class TSLegacyParameters extends BasicInterviewParameters { + public static final String TS_HOME = System.getProperty("TS_HOME", ""); + + public static final String OS = System.getProperty("os.name", "") + .toLowerCase(); + + private static I18NResourceBundle i18n = I18NResourceBundle + .getBundleForClass(TSLegacyParameters.class); + + private TSEnvironmentInterview iEnvironment; + + private TestSuite testSuite; + + private WorkDirectory workDir; + + private TSTestsInterview iTests; + + private TSExcludeListInterview iExcludeList; + + private KeywordsInterview iKeywords; + + private PriorStatusInterview iPriorStatus; + + private ConcurrencyInterview iConcurrency; + + private TimeoutFactorInterview iTimeoutFactor; + // private TSReportInterview iReport; + + public TSLegacyParameters() throws Fault { + super("jtwiz"); + setResourceBundle("i18n"); + iEnvironment = new TSEnvironmentInterview(this); + iTests = new TSTestsInterview(this); + iExcludeList = new TSExcludeListInterview(this); + iKeywords = new KeywordsInterview(this); + iPriorStatus = new PriorStatusInterview(this); + iConcurrency = new ConcurrencyInterview(this); + iTimeoutFactor = new TimeoutFactorInterview(this); + // iReport = new TSReportInterview(this); + setFirstQuestion(qProlog); + } + + public TSLegacyParameters(TestSuite testSuite) throws Fault { + this(); + setTestSuite(testSuite); + } + + public TestSuite getTestSuite() { + return testSuite; + } + + public void setTestSuite(TestSuite ts) { + if (ts == null) + throw new NullPointerException(); + if (testSuite != null && testSuite != ts) + throw new IllegalStateException(); + testSuite = ts; + } + + public WorkDirectory getWorkDirectory() { + return workDir; + } + + public void setWorkDirectory(WorkDirectory wd) { + if (wd == null) + throw new NullPointerException(); + if (workDir != null && workDir != wd) + throw new IllegalStateException(); + workDir = wd; + } + + // -------------------------------------------------------------------------- + public Parameters.TestsParameters getTestsParameters() { + return iTests; + } + + protected Question getTestsFirstQuestion() { + return callInterview(iTests, getTestsSuccessorQuestion()); + } + + // -------------------------------------------------------------------------- + public Parameters.ExcludeListParameters getExcludeListParameters() { + return iExcludeList; + } + + protected Question getExcludeListFirstQuestion() { + return callInterview(iExcludeList, getExcludeListSuccessorQuestion()); + } + + // -------------------------------------------------------------------------- + public Parameters.KeywordsParameters getKeywordsParameters() { + return iKeywords; + } + + protected Question getKeywordsFirstQuestion() { + return callInterview(iKeywords, getKeywordsSuccessorQuestion()); + } + + // -------------------------------------------------------------------------- + public Parameters.PriorStatusParameters getPriorStatusParameters() { + return iPriorStatus; + } + + protected Question getPriorStatusFirstQuestion() { + return callInterview(iPriorStatus, getPriorStatusSuccessorQuestion()); + } + + // -------------------------------------------------------------------------- + public Parameters.ConcurrencyParameters getConcurrencyParameters() { + return iConcurrency; + } + + protected Question getConcurrencyFirstQuestion() { + return callInterview(iConcurrency, getConcurrencySuccessorQuestion()); + } + + // -------------------------------------------------------------------------- + public Parameters.TimeoutFactorParameters getTimeoutFactorParameters() { + return iTimeoutFactor; + } + + protected Question getTimeoutFactorFirstQuestion() { + return callInterview(iTimeoutFactor, getTimeoutFactorSuccessorQuestion()); + } + + /* + * //------------------------------------------------------------------------- + * - public Parameters.ReportParameters getReportParameters () { return + * iReport; } + * + * protected Question getReportFirstQuestion () { return + * callInterview(iReport, getReportSuccessorQuestion()); } + */ + // -------------------------------------------------------------------------- + protected Question getEpilogFirstQuestion() { + return qEpilog; + } + + // -------------------------------------------------------------------------- + protected String getResourceString(String key) { + try { + return i18n.getString(key); + } catch (MissingResourceException e) { + return key; + } + } + + private NullQuestion qProlog = new NullQuestion(this, "prolog2") { + + public Question getNext() { + return getPrologSuccessorQuestion(); + } + }; + + private FinalQuestion qEpilog = new FinalQuestion(this, "epilog2") { + + public String getSummary() { + if (summary == null) + summary = getResourceString("TSLegacyParameters.epilog2.smry"); + return summary; + } + + public String getText() { + if (text == null) + text = getResourceString("TSLegacyParameters.epilog2.text"); + return MessageFormat.format(text, getTextArgs()); + } + + private String summary; + + private String text; + }; + + // ---------- added portion (not copied from DefaultInterviewParameters + public Parameters.EnvParameters getEnvParameters() { + return iEnvironment; + } + + protected Question getEnvFirstQuestion() { + return callInterview(iEnvironment, getEnvSuccessorQuestion()); + } + + protected Question getEnvSuccessorQuestion() { + return getTestsFirstQuestion(); + } + + protected Question getTestsSuccessorQuestion() { + return getExcludeListFirstQuestion(); + } + + protected Question getExcludeListSuccessorQuestion() { + // return getReportFirstQuestion(); + return getEpilogFirstQuestion(); + } + /* + * protected Question getReportSuccessorQuestion () { return + * getEpilogFirstQuestion(); } + */ +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSTestsInterview.java b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSTestsInterview.java new file mode 100644 index 0000000..11429d6 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/TSTestsInterview.java @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.javatest; + +import com.sun.interview.ErrorQuestion; +import com.sun.interview.FinalQuestion; +import com.sun.interview.Interview; +import com.sun.interview.Question; +import com.sun.interview.TreeQuestion; +import com.sun.interview.YesNoQuestion; +import com.sun.javatest.InterviewParameters; +import com.sun.javatest.Parameters; +import com.sun.javatest.TestResult; +import com.sun.javatest.TestResultTable; +import com.sun.javatest.TestSuite; +import com.sun.javatest.WorkDirectory; + +/** + * This interview collects the "initial files" parameter. It is normally used as + * one of a series of sub-interviews that collect the parameter information for + * a test run. + */ +public class TSTestsInterview extends Interview + implements Parameters.MutableTestsParameters { + /** + * Create an interview. + * + * @param parent + * The parent interview of which this is a child. + * @throws Interview.Fault + * if there is a problem while creating the interview. + */ + public TSTestsInterview(InterviewParameters parent) throws Interview.Fault { + super(parent, "tests"); + this.parent = parent; + setResourceBundle("i18n"); + // setHelpSet("/com/sun/javatest/moreInfo/moreInfo.hs"); + setFirstQuestion(qNeedTests); + } + + /** + * Get the initial files from the interview. + * + * @return a list of initial files to be read, to determine the tests to be + * selected + * @see #setTests + */ + public String[] getTests() { + if (qNeedTests.getValue() == YesNoQuestion.YES) { + return qTests.getValue(); + } else + return null; + } + + public void setTests(String[] tests) { + if (tests == null) + setTestsMode(ALL_TESTS); + else { + setTestsMode(SPECIFIED_TESTS); + setSpecifiedTests(tests); + } + } + + public int getTestsMode() { + return (qNeedTests.getValue() == YesNoQuestion.YES ? SPECIFIED_TESTS + : ALL_TESTS); + } + + public void setTestsMode(int mode) { + switch (mode) { + case ALL_TESTS: + qNeedTests.setValue(YesNoQuestion.NO); + break; + + case SPECIFIED_TESTS: + qNeedTests.setValue(YesNoQuestion.YES); + break; + + default: + throw new IllegalArgumentException(); + } + } + + public String[] getSpecifiedTests() { + return qTests.getValue(); + } + + public void setSpecifiedTests(String[] tests) { + qTests.setValue(tests); + } + + // ---------------------------------------------------------------------------- + // + // Need tests + + private YesNoQuestion qNeedTests = new YesNoQuestion(this, "needTests") { + { + setValue(YesNoQuestion.NO); + } + + protected Question getNext() { + if (value == null) + return null; + else if (value == YES) + return qTests; + else + return qEnd; + } + }; + + // ---------------------------------------------------------------------------- + // + // Tests + + private TreeQuestion.Model model = new TreeQuestion.Model() { + public Object getRoot() { + return parent.getWorkDirectory().getTestResultTable().getRoot(); + } + + public int getChildCount(Object node) { + if (node == null) + throw new NullPointerException(); + else if (node instanceof TestResultTable.TreeNode) + return ((TestResultTable.TreeNode) node).getChildCount(); + else if (node instanceof TestResult) + return 0; + else + throw new IllegalArgumentException(); + } + + public Object getChild(Object node, int index) { + if (node == null) + throw new NullPointerException(); + else if (node instanceof TestResultTable.TreeNode) + return ((TestResultTable.TreeNode) node).getChild(index); + else if (node instanceof TestResult) + return null; + else + throw new IllegalArgumentException(); + } + + public String getName(Object node) { + if (node == null) + throw new NullPointerException(); + else if (node instanceof TestResultTable.TreeNode) + return ((TestResultTable.TreeNode) node).getName(); + else if (node instanceof TestResult) { + TestResult tr = (TestResult) node; + String fullName = tr.getTestName(); + int lastSlash = fullName.lastIndexOf("/"); + return (lastSlash == -1 ? fullName : fullName.substring(lastSlash + 1)); + + } else + throw new IllegalArgumentException(); + } + + public String getPath(Object node) { + if (node == null) + throw new NullPointerException(); + else if (node instanceof TestResult) + return ((TestResult) node).getTestName(); + else if (node instanceof TestResultTable.TreeNode) { + TestResultTable.TreeNode tn = (TestResultTable.TreeNode) node; + if (tn.isRoot()) + return tn.getName(); + else + return getPath(tn.getParent() + "/" + tn.getName()); + } else + throw new IllegalArgumentException(); + } + + public boolean isLeaf(Object node) { + if (node == null) + throw new NullPointerException(); + else if (node instanceof TestResult) + return true; + else if (node instanceof TestResultTable.TreeNode) + return false; + else + throw new IllegalArgumentException(); + } + }; + + private TreeQuestion qTests = new TreeQuestion(this, "tests", model) { + + protected Question getNext() { + validateTests(); + + // value of null currently means everything; + // this is a corollary of having an anonymous + // test suite root; to fix, we would have to use + // a pseudo-name in the saved value for "ALL" + /* + * if (value == null || value.length == 0) return null; else + */if (cachedTestsError != null) + return cachedTestsError; + else + return qEnd; + } + }; + + private void validateTests() { + String[] tests = qTests.getValue(); + if (equal(tests, cachedTestsValue)) + return; + + cachedTestsValue = tests; + cachedTestsError = null; // default + + WorkDirectory wd = parent.getWorkDirectory(); + if (wd == null) + return; + + TestResultTable trt = wd.getTestResultTable(); + if (tests == null || tests.length == 0) { + // currently, empty selection means everything + // as a corollary that the path of the root node + // is saved as an empty string. + // cachedTestsError = qNoTestsError; + return; + } else { + for (int i = 0; i < tests.length; i++) { + if (!trt.validatePath(tests[i])) { + cachedTestsError = qBadTestsError; + cachedTestsErrorArgs = new Object[] { tests[i] }; + return; + } + } + } + } + + private Question qNoTestsError = new ErrorQuestion(this, "noTests"); + + private ErrorQuestion qBadTestsError = new ErrorQuestion(this, "badTests") { + protected Object[] getTextArgs() { + return cachedTestsErrorArgs; + } + }; + + private String[] cachedTestsValue; + + private Question cachedTestsError; + + private Object[] cachedTestsErrorArgs; + + // ---------------------------------------------------------------------------- + // + // End + + private Question qEnd = new FinalQuestion(this); + + // ---------------------------------------------------------------------------- + + private static boolean equal(String[] s1, String[] s2) { + if (s1 == null || s2 == null) + return (s1 == s2); + + if (s1.length != s2.length) + return false; + + for (int i = 0; i < s1.length; i++) { + if (s1[i] != s2[i]) + return false; + } + + return true; + } + + // -------------------------------------------------------- + + private InterviewParameters parent; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/build.xml b/tck/old-tck/source/src/com/sun/ts/lib/javatest/build.xml new file mode 100644 index 0000000..e134ae8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/build.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/javatest/i18n.properties b/tck/old-tck/source/src/com/sun/ts/lib/javatest/i18n.properties new file mode 100644 index 0000000..421afed --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/javatest/i18n.properties @@ -0,0 +1,114 @@ +# +# Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +title=TCK Configuration Editor + +ConcurrencyInterview.concurrency.smry=Concurrency +ConcurrencyInterview.concurrency.text=JavaTest can run tests concurrently. Specify the maximum number of tests that should be run concurrently: + +TSLegacyParameters.prolog2.smry=Welcome! +TSLegacyParameters.prolog2.text=Welcome to the TCK Configuration Editor!\n\nThe following questions ask you questions about how you want to run the test suite.\n\nPlease verify default answers and make necessary modifications: + +TSLegacyParameters.epilog2.smry=Congratulations! +TSLegacyParameters.epilog2.text=Congratulations!\n\nThis completes the configuration interview.\n\nClick the "Done" button below to save your answers and dismiss the editor.\n\nTo run the test suite choose:\n\n Run Tests > Start + +TSEnvironmentInterview.env.smry=Test Environment +TSEnvironmentInterview.env.text=Choose one of the following test environments. As a general rule, choose ts_unix if you are running tests on Unix and ts_win32 if on Windows: + +TSEnvironmentInterview.envError.smry=Test Environment Error +TSEnvironmentInterview.envError.text=The test environment you specified contains an error. The error reported was:\n{0} + +TSEnvironmentInterview.envFiles.smry=Environment Files +TSEnvironmentInterview.envFiles.text=Specify one or more files that contain a test environment to use in the test run: + +TSEnvironmentInterview.envNotFound.smry=Test Environment Not Found +TSEnvironmentInterview.envNotFound.text=The test environment `{0}'' was not found in the environment files you specified. Check that you entered the name correctly, and that the test environment contains at least one of the following entries: `description'', `inherits'', `menu'', `finder'', `script'', or `testsuite''. + +TSEnvironmentInterview.envTableError.smry=Environment File Error +TSEnvironmentInterview.envTableError.text=The test environment file(s) you specified contains an error. The error reported was:\n{0} + +TSEnvironmentInterview.envUndefinedEntry.smry=Undefined Entry in Test Environment +TSEnvironmentInterview.envUndefinedEntry.text=The test environment you specified contains undefined values.\nThe first such entry is \n `{0}''\nwhich was found in {1}.\nYou must correct this value (and any others like it in this test environment) before you can use this test environment. + +TSEnvironmentInterview.noEnvs.smry=No environments found +TSEnvironmentInterview.noEnvs.text=The environment files you specified did not contain any JavaTest environments for you to select. Valid test environments must contain at least one of the following entries: `description'', `inherits'', `menu'', `finder'', `script'', or `testsuite''. + +TSExcludeListInterview.excludeList.smry=Exclude List +TSExcludeListInterview.excludeList.text=Specify exclude lists: + +TSExcludeListInterview.excludeList.choice.initial=initial +TSExcludeListInterview.excludeList.choice.latest=latest +TSExcludeListInterview.excludeList.choice.custom=custom + +TSExcludeListInterview.customFiles.smry=Which Exclude List? +TSExcludeListInterview.customFiles.text=Please specify the custom exclude list that you would like to use. + +TSExcludeListInterview.excludeListType.smry=Which Exclude List? +TSExcludeListInterview.excludeListType.text=Which exclude list do you wish to use? + +TSExcludeListInterview.excludeListError.smry=Exclude List Error +TSExcludeListInterview.excludeListError.text=The exclude list(s) you specified contains an error. The error reported was:\n{0} + +TSExcludeListInterview.excludeListFileNotFound.smry=Exclude List File Not Found +TSExcludeListInterview.excludeListFileNotFound.text=One of the files you specified was not found. The error reported was:\n{0} + +TSExcludeListInterview.excludeListIOError.smry=Exclude List Error +TSExcludeListInterview.excludeListIOError.text=The exclude list(s) you specified contains an error. The error reported was:\n{0} + +TSExcludeListInterview.needExcludeList.smry=Specify an Exclude List? +TSExcludeListInterview.needExcludeList.text=Do you wish to specify an exclude list? + +PriorStatusInterview.needStatus.smry=Specify Status? +PriorStatusInterview.needStatus.text=Do you wish to select tests to run based on their result in a previous run? + +PriorStatusInterview.status.smry=Status +PriorStatusInterview.status.text=Specify the prior result status to use to select tests: + +TSReportInterview.createReportDir.smry=Create Report Directory +TSReportInterview.createReportDir.text=The report directory that you specified\n {0}\ndoes not exist.\nDo you wish to create it? + +TSReportInterview.reportDir.smry=Report Directory +TSReportInterview.reportDir.text=Specify a report directory: + +TSReportInterview.reportDirErr.smry=Report Directory Error +TSReportInterview.reportDirErr.text=There was an error accessing the report directory you specified. (It may be that it was not really a directory, or it was not readable.) Please fix the problem or go back and choose another directory to be used. + +TSReportInterview.reportDirNotFound.smry=Report Directory Not Found +TSReportInterview.reportDirNotFound.text=The report directory you specified does not exist. Please go back and create it, or choose one that does exist. + +TSLegacyParameters.desc.smry=Description +TSLegacyParameters.desc.text=Please provide a short description to identify the configuration you are creating here. + +TSLegacyParameters.envEnd.smry=Parameters... +TSLegacyParameters.envEnd.text=The remaining questions ask about which tests in the test suite you want to run, and where you want to put the test results. + +TSLegacyParameters.name.smry=Configuration Name +TSLegacyParameters.name.text=Please provide a short identifier to name the configuration you are creating here. + +TSTestsInterview.badTests.smry=Invalid path +TSTestsInterview.badTests.text=The following path does not identify a valid test or folder of tests:\n{0} + +TSTestsInterview.noTests.smry=No paths +TSTestsInterview.noTests.text=No paths for tests or folders of tests have been specified. + +TSTestsInterview.tests.smry=Tests to Run +TSTestsInterview.tests.text=Specify the sections of the test suite you wish to run: + +TSTestsInterview.needTests.smry=Specify Tests to Run? +TSTestsInterview.needTests.text=Do you wish to run only selected sections of the test suite? + +TSTimeoutFactorInterview.timeout.smry=Time Factor +TSTimeoutFactorInterview.timeout.text=Specify a time factor that is applied to each test''s default timeout. For example, specifying "2" doubles the time for each test (the default is 1): diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/DeploymentInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/DeploymentInfo.java new file mode 100644 index 0000000..626a0a4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/DeploymentInfo.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import com.sun.ts.lib.deliverable.PropertyManagerInterface; +import com.sun.ts.lib.deliverable.DeliverableFactory; +import java.io.*; +import java.util.*; + +/** + * Provides all information required to deploy an application on a server. Much + * of this information is extracted from runtime xml files. The following + * information is provided: + *
    + *
  • EJB Jar info
  • + *
  • Web Resources - Display name, context root, resource references and ejb + * references for each web resource in this ear.
  • + *
  • EJB Resources - Name, JNDI name, resource references, ejb references, and + * CMP information for each ejb resource in this ear.
  • + *
  • Resource References - For each resource reference, the JNDI name, default + * resource principal name and password, and any mail configuration information + * is provided.
  • + *
  • EJB References - For each EJB reference, the EJB name and its + * corresponding JNDI name is provided.
  • + *
+ *

+ * See: javaee.home.ri/lib/dtds/sun-application_5_0-0.dtd + * javaee.home.ri/lib/dtds/sun-application-client_5_0-0.dtd + * javaee.home.ri/lib/dtds/sun-ejb-jar_3_0-0.dtd + * javaee.home.ri/lib/dtds/sun-web-app_2_5-0.dtd for more and updated + * information. + * + */ + +public interface DeploymentInfo extends java.io.Serializable { + /** + * Sets the value of the given property. This method should be temporary, + * until all important information can be provided by the API. + */ + public void setProperty(String key, String value); + + /** + * Returns the value of the given property. This method should be temporary, + * until all important information can be provided by the API. + */ + public String getProperty(String key); + + /** + * Sets/gets an array of deploymentInfo objects from previously deployed apps + * in the currrent directory along with all common apps + */ + public void setPreviousInfos(DeploymentInfo[] infos); + + public DeploymentInfo[] getPreviousInfos(); + + /** + * Returns the ear file to deploy + */ + public String getEarFile(); + + /** + * Returns the list of runtime files to be deployed + */ + public String[] getRuntimeFiles(); + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the com.sun.ts.lib.porting.ejb.SunEjbJar + * interface. + */ + public Map getEjbRuntimeData(); + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the com.sun.ts.lib.porting.web.SunWebApp + * interface. + */ + public Map getWebRuntimeData(); + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the com.sun.ts.lib.porting.app.SunApplication + * interface. + */ + public Map getAppRuntimeData(); + + /** + * Returns a Map that maps runtimne deployment descriptor filename Strings to + * concrete implementations of the + * com.sun.ts.lib.porting.appclient.SunApplicationClient interface. + */ + public Map getAppClientRuntimeData(); + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.porting.appclient.SunApplicationClient interface. + */ + public List getAppClientRuntimeDDs(); + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.porting.app.SunApplication interface. + */ + public List getAppRuntimeDDs(); + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.porting.web.SunWebApp interface. + */ + public List getWebRuntimeDDs(); + + /** + * Returns a List of concrete implementations of the + * com.sun.ts.lib.porting.ejb.SunEjbJar interface. + */ + public List getEjbRuntimeDDs(); + + /** + * Returns a String that conatains the contents of all the runtime XML files. + */ + public String getContentAsXml(); + + /** + * Exception thrown if an error occured parsing the XML + */ + public class ParseException extends Exception implements Serializable { + public ParseException(String message) { + super(message); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/README b/tck/old-tck/source/src/com/sun/ts/lib/porting/README new file mode 100644 index 0000000..c9d9aa2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/README @@ -0,0 +1,58 @@ +/* + Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + + This program and the accompanying materials are made available under the + terms of the Eclipse Public License v. 2.0, which is available at + http://www.eclipse.org/legal/epl-2.0. + + This Source Code may also be made available under the following Secondary + Licenses when the conditions for such availability set forth in the + Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + version 2 with the GNU Classpath Exception, which is available at + https://www.gnu.org/software/classpath/license.html. + + SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + +*/ + +Porting Package Directory README +-------------------------------- + +This directory contains classes that abstract any implementation-specific +code. The current implementations of these classes use the semantics of +Sun's Java EE Reference Implementation. Licensees can modify and rebuild these +classes to work with their particular implementation of the Java EE platform. + +Please see the "Porting Package" section of the TS User's Guide (section 9.2) +for more information. + +Files +----- +TSDeployment.java + An implementation of the TSDeploymentInterface that enables automatic + deployment for the Java EE Reference Implementation. + +TSDeployment.java.manual + An implementation of the TSDeploymentInterface that prompts the user + to deploy and undeploy applications at the appropriate times during + testing. This class demonstrates the use of the DeploymentInfo class. + It has no dependencies on platform-specific features. Use this as + a template for building your own automatic deployer / undeployer. + + To use this file, swap TSDeployment.java and TSDeployment.java.manual + and run gmake from the $TS_HOME/src/common/ directory. + +TSLauncher.java + Provides implementation-specific code for launching applications for + interactive tests and other needs. Platforms that support Runtime.exec + most likely need not modify this file. + +TSLoginContext.java + Provides implementation-specific code for allowing a program to + login as a specific user. + +TSNamingContext.java + Provides implementation-specific code for obtaining the initial + naming context and for looking up remote objects. + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeployment.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeployment.java new file mode 100644 index 0000000..b03aa03 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeployment.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.io.*; +import com.sun.ts.lib.deliverable.*; + +/** + * This is a factory class for creating instances of TSDeploymentInterface. The + * implementation classes used are determined by the values of the porting + * package properties in TS_HOME/bin/ts.jte. + * + * @author Kyle Grucci + */ +public class TSDeployment { + private static PropertyManagerInterface propMgr = null; + + public static int iPortingSet = 1; + + public static TSDeploymentInterface getDeploymentInstance(PrintWriter writer, + String sClassName) throws Exception { + return createInstance(sClassName, writer); + } + + private static TSDeploymentInterface createInstance(String sClassName, + PrintWriter writer) throws Exception { + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + + // create and initialize a new instance of the Deployment class + Class c = Class.forName(propMgr.getProperty(sClassName)); + TSDeploymentInterface ctsDep1 = (TSDeploymentInterface) c.newInstance(); + + // set static prop so porting impls in the same VM can look it up + iPortingSet = Integer + .parseInt(sClassName.substring(sClassName.lastIndexOf(".") + 1)); + + // tell this 88 class which porting set of props we are using + // (1 or 2) + // if(ctsDep1 instanceof + // com.sun.ts.lib.deliverable.cts.deploy.StandardDeployment14) + // { + // ((com.sun.ts.lib.deliverable.cts.deploy.StandardDeployment14)ctsDep1).setFirstLevelPortingSet(Integer.parseInt(sClassName.substring(sClassName.lastIndexOf(".")+1))); + // } + + ctsDep1.init(writer); + + return ctsDep1; + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentException.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentException.java new file mode 100644 index 0000000..f95e936 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentException.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +public class TSDeploymentException extends java.lang.Exception { + public TSDeploymentException() { + super(); + } + + public TSDeploymentException(String s) { + super(s); + } + + public TSDeploymentException(String s, Throwable e) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentInterface.java new file mode 100644 index 0000000..aca79c4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSDeploymentInterface.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.net.URL; +import java.util.*; +import java.io.*; + +/** + * An implementation of the TSDeploymentInterface can be provided by a Jakarta EE + * implementation, to support their own deploy/undeploy semantics. + * + * Jakarta EE implementations that previously depended on Pruned Jakarta Deployment, + * should also use TSDeploymentInterface instead of com.sun.ts.lib.porting.TSDeploymentInterface2. + * + * @author Kyle Grucci + */ +public interface TSDeploymentInterface { + /** + * Initializes a new TSDeployment instance. All output should be printed to + * this PrintWriter. All properties in the ts.jte file are accessible to this + * porting implementation class only via the TSPropertyManager class. Please + * see Sun's implementation of this method for an example. + * + * @param writer + * The PrintWriter that should be used to log output. + */ + public void init(PrintWriter writer); + + /** + * This method is called by the test harness to deploy an .ear file into your + * Java EE implementation. We extract such info as the app earfile from the + * provided deployment information. The following properties are available for + * this method's use: + *

+ * generateSQL - "true" if SQL is to be generated for CMP beans + *

+ *

+ * deployment_host - the host where this app is to be deployed + *

+ * + * All additional information is queryable from the DeploymentInfo interface. + * + * @param info + * Object containing necessary deployment info. + * @return This method should return a string which is formatted such that it + * can be appended to the classpath. your Java EE implementation + * returns the fully qualified path to a jar file, which contains the + * generated ejb stub classes, which are used by any appclient tests + * (tests whose client directly uses an ejb). + */ + public String deploy(DeploymentInfo info) throws TSDeploymentException; + + /** + * This method is called by test harness to undeploy an .ear file from your + * Java EE implementation. We extract such info as host and app from these + * props. The following properties are available for this method 's use: + * + * ear_file - the fully qualified application (.ear file) deployment_host - + * the host to undeploy this app from + * + * @param p + * Properties specific to the currently running test + */ + public void undeploy(Properties p) throws TSDeploymentException; + + /** + * This method is called by the test harness to check whether or not an + * application ear is deployed. This information is used to determine whether + * or not the harness needs to undeploy it. The following properties are + * available for this method's use: + * + * ear_file - the fully qualified application (.ear file) deployment_host - + * the host where this app is deployed + * + * @param p + * Properties specific to the currently running test + * @return True if the app is deployed. False if not. + */ + public boolean isDeployed(Properties p) throws TSDeploymentException; + + /** + * This method is called to deploy a connector (.rar file) to your Java EE + * implementation. We extract such info as deployment_host and rar_file from + * these props. The following properties are available for this method's use: + * + * rar_file - the fully qualified connector file (.rar file) deployment_host - + * the host name of the machine to deploy it to + * + * @param p + * Properties specific to the currently running test + */ + public void deployConnector(Properties p) throws TSDeploymentException; + + /** + * This method is called to undeploy a connector (.rar file) from your Java EE + * implementation. We extract such info as deployment_host and rar_file from + * these props. The following properties are available for this method's use: + * + * rar_file - the fully qualified connector file (.rar file) deployment_host - + * the host name of the machine to undeploy it from + * + * @param p + * Properties specific to the currently running test + */ + public void undeployConnector(Properties p) throws TSDeploymentException; + + /** + * This method is called to check to see if a given connector (.rar file) is + * deployed on your Java EE implementation. We extract such info as + * deployment_host and rar_file from these props. The following properties are + * available for this method's use: + * + * rar_file - the fully qualified connector file (.rar file) deployment_host - + * the host name of the machine to deploy it to + * + * @param p + * Properties specific to the currently running test + * @return True if the app is deployed. False if not. + */ + public boolean isConnectorDeployed(Properties p) throws TSDeploymentException; + + /** + * This method is called by the test harness to get any additional test + * specific arguments that must be passed to the application client container + * class, which is specified in the ts.jte file in the given environment + * (command.testExecuteAppClient property). The additional args should be + * appended to the value of (p.getProperty("executeArgs");), and returned. The + * following properties are available for this method's use: + * + * executeArgs - the current executeArgs as specified in the jte file + * + * @param p + * Properties specific to the currently running test + * @return This method should return a string which represents all executeArgs + * to be used. + */ + public String getAppClientArgs(Properties p); + + /** + * This method is called by the test harness to get the corba JNDI names to + * use in an interop scenario. This method should return a hashtable of + * mappings for any EJB references in the array of DeploymentInfo objects + * where: + * + * key = original corbaname JNDI name in the RI format value = vendor + * corbaname JNDI name in the Vendor format + * + * @param infoArray + * Array of DeploymentInfo objects for the ear files associated with + * a particular directory + * @return Hashtable This method should return a Hashtable of mappings (see + * above) + */ + public Hashtable getInteropJNDINames(DeploymentInfo[] infoArray); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnection.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnection.java new file mode 100644 index 0000000..238a26f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnection.java @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +/* + * @(#)TSHttpsURLConnection.java 1.7 02/06/17 + */ + +package com.sun.ts.lib.porting; + +import com.sun.ts.lib.util.*; +import java.io.*; +import java.net.*; + +/** + * TSHttpsURLConnection provides the HTTPS specific featurs + * + */ +public class TSHttpsURLConnection implements TSHttpsURLConnectionInterface { + private TSHttpsURLConnectionInterface tsHttpsURLConnection = null; + + private String sClass = "porting.ts.HttpsURLConnection.class.1"; + + /** + * Instantiates the class defined in porting.ts.HttpsURLConnection.class.1 + */ + public TSHttpsURLConnection() { + + if (tsHttpsURLConnection == null) { + try { + + Class c = Class.forName(TestUtil.getProperty(sClass)); + + tsHttpsURLConnection = (TSHttpsURLConnectionInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * Instantiates the class defined by sClass + * + * @param sClass + * - this class is used to instantiate implementation specific + * HttpsURLConnection class + */ + public TSHttpsURLConnection(String sClass) { + + if (tsHttpsURLConnection == null) { + try { + + Class c = Class.forName(TestUtil.getProperty(sClass)); + + tsHttpsURLConnection = (TSHttpsURLConnectionInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + /** + * Sets the value of the doInput field for this Connection + * + * @param doInput + * - the new value (the default is false) + */ + public void setDoInput(boolean doInput) { + tsHttpsURLConnection.setDoInput(doInput); + } + + /** + * Sets the value of the doOutput field for this Connection + * + * @param doOutput + * - the new value (the default is false) + */ + public void setDoOutput(boolean doOutput) { + tsHttpsURLConnection.setDoOutput(doOutput); + } + + /** + * Sets the value of the useCaches field for this Connection If the UseCaches + * flag on the connection is true, the connection is allowed to use whatever + * caches it can. If false, caches are to be ignored. The default value is set + * to true + * + * @param usecaches + * - the new value (the default is true) + */ + public void setUseCaches(boolean usecaches) { + tsHttpsURLConnection.setUseCaches(usecaches); + } + + /** + * Sets the general request property. If a property with the key already + * exists, overwrite its value with the new value. + * + * @param key + * - the keyword by which the request is known + * @param value + * - the value associated with it + */ + public void setRequestProperty(String key, String value) { + tsHttpsURLConnection.setRequestProperty(key, value); + } + + /** + * Returns the value of the named header field. If called on a connection that + * sets the same header multiple times only the last value is returned. + * + * @param name + * - the name of the header field. + * @return String - the value of the named header field, or null if there is + * no such field in the header. + */ + public String getHeaderField(String name) { + return tsHttpsURLConnection.getHeaderField(name); + } + + /** + * Returns the value for the nth header field. It returns null if there are + * fewer than n fields + * + * @param num + * - Integer num + * @return String - returns the value of the nth header field + */ + public String getHeaderField(int num) { + return tsHttpsURLConnection.getHeaderField(num); + } + + /** + * Disconnect connection + */ + public void disconnect() { + tsHttpsURLConnection.disconnect(); + } + + /** + * Returns an input stream that reads from the open connection + * + * @return InputStream - inputStream + */ + public InputStream getInputStream() throws IOException { + return tsHttpsURLConnection.getInputStream(); + } + + /** + * Returns an Output stream that writes to the open connection + * + * @return OutputStream - outputStream + */ + public OutputStream getOutputStream() throws IOException { + return tsHttpsURLConnection.getOutputStream(); + } + + /** + * Initializes HttpsURLConnection + * + * @param url + * url used to open HttpsURLConnection + */ + public void init(URL url) throws IOException { + tsHttpsURLConnection.init(url); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnectionInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnectionInterface.java new file mode 100644 index 0000000..a9ae622 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSHttpsURLConnectionInterface.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.porting; + +import java.io.*; +import java.net.*; + +/** + * This is the TSHttpsURLConnectionInterface. An implementation of this + * interface must be provided by each Java EE implementation, to support https + * url connection. + * + */ +public interface TSHttpsURLConnectionInterface { + /** + * Sets the value of the doInput field for this URLConnection to the specified + * value. + * + * A URL connection can be used for input and/or output. Set the DoInput flag + * to true if you intend to use the URL connection for input, false if not. + * The default is true. + * + * + * @param doInput + * a boolean indicating whether the URL connection is used for input + * or not + */ + public void setDoInput(boolean doInput); + + /** + * Sets the value of the doOutput field for this URLConnection to the + * specified value. + * + * A URL connection can be used for input and/or output. Set the DoOutput flag + * to true if you intend to use the URL connection for output, false if not. + * The default is false. + * + * @param doOutput + * a boolean indicating whether the URL connection is used for output + * or not + */ + public void setDoOutput(boolean doOutput); + + /** + * Sets the value of the useCaches field of this URLConnection to the + * specified value. + * + * Some protocols do caching of documents. Occasionally, it is important to be + * able to "tunnel through" and ignore the caches (e.g., the "reload" button + * in a browser). If the UseCaches flag on a connection is true, the + * connection is allowed to use whatever caches it can. If false, caches are + * to be ignored. The default value is true + * + * @param usecaches + * a boolean indicating whether or not to allow caching + */ + public void setUseCaches(boolean usecaches); + + /** + * Sets the general request property. If a property with the key already + * exists, overwrite its value with the new value. + * + * @param key + * the keyword by which the request is known + * @param value + * the value associated with it + */ + public void setRequestProperty(String key, String value); + + /** + * Returns the value of the named header field. If called on a connection that + * sets the same header multiple times only the last value is returned. + * + * @param name + * the name of the header field. + * @return String the value of the named header field, or null if there is no + * such field in the header. + */ + public String getHeaderField(String name); + + /** + * Returns the value for the nth header field. It returns null if there are + * fewer than n fields + * + * @param num + * Integer num + * @return String returns the value of the nth header field + */ + public String getHeaderField(int num); + + /** + * Disconnects connection + */ + public void disconnect(); + + /** + * Returns an input stream that reads from the open connection + * + * @return InputStream inputStream + */ + public InputStream getInputStream() throws IOException; + + /** + * Returns an Output stream that writes to the open connection + * + * @return OutputStream - OutputStream + */ + public OutputStream getOutputStream() throws IOException; + + /** + * Initializes HttpsURLConnection + * + * @param url + * url used to open HttpsURLConnection + */ + public void init(URL url) throws IOException; + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdmin.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdmin.java new file mode 100644 index 0000000..f4a782d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdmin.java @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.util.*; +import java.io.*; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.deliverable.*; + +/** + * This class acts as a Factory object for creating an implementation specific + * instance of the TSJMSAdminInterface based on the value of the ts.jte + * property, porting.ts.jms.class.1 + * + * @author Kyle Grucci + */ +public class TSJMSAdmin { + private static PropertyManagerInterface propMgr = null; + + private static Hashtable htQueues1 = null; + + private static Hashtable htTopics1 = null; + + private static Hashtable htQueues2 = null; + + private static Hashtable htTopics2 = null; + + private static Hashtable htTopicConnectionFactories1 = null; + + private static Hashtable htQueueConnectionFactories1 = null; + + private static Hashtable htConnectionFactories1 = null; + + private static Hashtable htTopicConnectionFactories2 = null; + + private static Hashtable htQueueConnectionFactories2 = null; + + private static Hashtable htConnectionFactories2 = null; + + /* List of prefixes for test directories using JMS factories */ + private static String factTestPrefixes[] = { "jms", "ejb", "ejb30", + "jsp" + File.separator + "spec" + File.separator + "tagext" + + File.separator + "resource", + "appclient" + File.separator + "deploy" + File.separator + "resref", + "servlet" + File.separator + "spec" + File.separator + "annotation", + "servlet" + File.separator + "platform" + File.separator + "deploy" + + File.separator + "resref", + "webservices" + File.separator + "handler" + File.separator + "localtx", + "webservices" + File.separator + "handlerEjb" + File.separator + + "localtx", }; + + public static TSJMSAdminInterface getTSJMSAdminInstance(PrintWriter writer, + String sClassName) throws Exception { + return createInstance(sClassName, writer); + } + + private static TSJMSAdminInterface createInstance(String sClassName, + PrintWriter writer) throws Exception { + try { + propMgr = DeliverableFactory.getDeliverableInstance() + .getPropertyManager(); + // create and initialize a new instance of the Deployment class + Class c = Class.forName(propMgr.getProperty(sClassName)); + TSJMSAdminInterface ctsJMS = (TSJMSAdminInterface) c.newInstance(); + ctsJMS.init(writer); + return ctsJMS; + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + /** + * Return true if a run of test directory 'sDir' requires preliminary creation + * of JMS factories. + */ + public static boolean requiresJmsFactories(String sDir) { + String prefix = "tests" + File.separator; + for (int i = 0; i < factTestPrefixes.length; i++) { + if (-1 != sDir.indexOf(prefix + factTestPrefixes[i])) { + return true; + } + } + return false; + } + + public static Hashtable getQueueConnectionFactories(int iServer) { + if (iServer == 2) + return htQueueConnectionFactories2; + else + return htQueueConnectionFactories1; + } + + public static Hashtable getTopicConnectionFactories(int iServer) { + if (iServer == 2) + return htTopicConnectionFactories2; + else + return htTopicConnectionFactories1; + } + + public static Hashtable getConnectionFactories(int iServer) { + if (iServer == 2) + return htConnectionFactories2; + else + return htConnectionFactories1; + } + + public static String[] getQueues(String sPath, int iServer) { + Hashtable htQueues = htQueues1; + String sRelativeTestPath = convertSlashesToDashes(sPath); + String[] sVal2 = null; + String sRelativeTestPathCopy = sRelativeTestPath; + TestUtil.logHarnessDebug("getQueues: iServer = " + iServer); + if (iServer == 2) + htQueues = htQueues2; + do { + // get overridden vehicles property if it exists, otherwise + // return null + TestUtil + .logHarnessDebug("getQueues: going to check sRelativeTestPathCopy = " + + sRelativeTestPathCopy); + sVal2 = (String[]) htQueues.get(sRelativeTestPathCopy); + TestUtil.logHarnessDebug("getQueues: sVal2 = " + sVal2); + if (sVal2 == null) { + // do nothing + } else { + for (int ii = 0; ii < sVal2.length; ii++) { + TestUtil.logHarnessDebug( + "getQueuesToCreate: " + "vehicle[" + ii + "] = " + sVal2[ii]); + } + } + } while ((sRelativeTestPathCopy = getNextLevelUp( + sRelativeTestPathCopy)) != null && sVal2 == null); + TestUtil.logHarnessDebug("getQueues: returning sVal2 = " + sVal2); + return sVal2; + } + + public static String[] getTopics(String sPath, int iServer) { + Hashtable htTopics = htTopics1; + String sRelativeTestPath = convertSlashesToDashes(sPath); + String[] sVal2 = null; + String sRelativeTestPathCopy = sRelativeTestPath; + TestUtil.logHarnessDebug("getTopics: iServer = " + iServer); + if (iServer == 2) + htTopics = htTopics2; + do { + // get overridden vehicles property if it exists, otherwise + // return null + TestUtil + .logHarnessDebug("getTopics: going to check sRelativeTestPathCopy = " + + sRelativeTestPathCopy); + sVal2 = (String[]) htTopics.get(sRelativeTestPathCopy); + TestUtil.logHarnessDebug("getTopics: sVal2 = " + sVal2); + if (sVal2 == null) { + // do nothing + } else { + for (int ii = 0; ii < sVal2.length; ii++) { + TestUtil.logHarnessDebug( + "getQueuesToCreate: " + "vehicle[" + ii + "] = " + sVal2[ii]); + } + } + } while ((sRelativeTestPathCopy = getNextLevelUp( + sRelativeTestPathCopy)) != null && sVal2 == null); + TestUtil.logHarnessDebug("getTopics: returning sVal2 = " + sVal2); + return sVal2; + } + + private static String getNextLevelUp(String sDottedPath) { + int index = 0; + String sNewPath = null; + index = sDottedPath.lastIndexOf("-"); + if (index != -1) + sNewPath = sDottedPath.substring(0, index); + return sNewPath; + } + + private static String convertSlashesToDashes(String sTestDir) { + String sRelativeTestPath = ""; + TestUtil.logHarnessDebug("sTestDir = " + sTestDir); + sRelativeTestPath = (sTestDir.substring(sTestDir.indexOf( + File.separator + "ts" + File.separator + "tests" + File.separator) + 4)) + .replace(File.separatorChar, '-'); + TestUtil.logHarnessDebug("sRelativeTestPath = " + sRelativeTestPath); + return sRelativeTestPath; + } + + static { + // for server 1 + htQueues1 = new Hashtable(); + htTopics1 = new Hashtable(); + htTopicConnectionFactories1 = new Hashtable(); + htQueueConnectionFactories1 = new Hashtable(); + htConnectionFactories1 = new Hashtable(); + // for server 2 + htQueues2 = new Hashtable(); + htTopics2 = new Hashtable(); + htTopicConnectionFactories2 = new Hashtable(); + htQueueConnectionFactories2 = new Hashtable(); + htConnectionFactories2 = new Hashtable(); + // connection factories and associated properties to create + htTopicConnectionFactories1.put("jms/TopicConnectionFactory", ""); + htTopicConnectionFactories1.put("jms/DURABLE_SUB_CONNECTION_FACTORY", + "clientId=cts"); + htTopicConnectionFactories1.put("jms/MDBTACCESSTEST_FACTORY", + "clientId=cts1"); + htTopicConnectionFactories1.put("jms/DURABLE_BMT_CONNECTION_FACTORY", + "clientId=cts2"); + htTopicConnectionFactories1.put("jms/DURABLE_CMT_CONNECTION_FACTORY", + "clientId=cts3"); + htTopicConnectionFactories1.put("jms/DURABLE_BMT_XCONNECTION_FACTORY", + "clientId=cts4"); + htTopicConnectionFactories1.put("jms/DURABLE_CMT_XCONNECTION_FACTORY", + "clientId=cts5"); + htTopicConnectionFactories1.put("jms/DURABLE_CMT_TXNS_XCONNECTION_FACTORY", + "clientId=cts6"); + htQueueConnectionFactories1.put("jms/QueueConnectionFactory", ""); + htConnectionFactories1.put("jms/ConnectionFactory", ""); + // add default values + htQueues1.put("tests-jms-ee-mdb", + new String[] { "MDB_QUEUE_REPLY", "MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-xa", new String[] { "MDB_QUEUE_REPLY", + "jms_ee_mdb_xa_MDB_QUEUE_CMT", "jms_ee_mdb_xa_MDB_QUEUE_BMT" }); + htQueues1.put("tests-jms-ee-mdb-mdb_msgHdrQ", + new String[] { "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_msgHdrQ_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_msgPropsQ", new String[] { + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_msgPropsQ_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_msgTypesQ1", new String[] { + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_msgTypesQ1_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_msgTypesQ2", new String[] { + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_msgTypesQ2_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_msgTypesQ3", new String[] { + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_msgTypesQ3_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_rec", + new String[] { "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_rec_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_sndQ", + new String[] { "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_sndQ_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_sndToQueue", new String[] { + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_sndToQueue_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_synchrec", new String[] { "MDB_QUEUE", + "MDB_QUEUE_REPLY", "jms_ee_mdb_mdb_synchrec_MDB_QUEUE" }); + htQueues1.put("tests-jms-ee-mdb-mdb_exceptQ", + new String[] { "MDB_QUEUE_REPLY", + "jms_ee_mdb_mdb_exceptQ_MDB_QUEUE_CMT", + "jms_ee_mdb_mdb_exceptQ_MDB_QUEUE_BMT", + "jms_ee_mdb_mdb_exceptQ_MDB_QUEUETXNS_CMT" }); + htQueues1.put("tests-jms-ee-mdb-mdb_exceptT", + new String[] { "MDB_QUEUE_REPLY", + "jms_ee_mdb_mdb_exceptT_MDB_QUEUE_CMT", + "jms_ee_mdb_mdb_exceptT_MDB_QUEUE_BMT", + "jms_ee_mdb_mdb_exceptT_MDB_QUEUETXNS_CMT" }); + htQueues1.put("tests-jms-core", new String[] { "MY_QUEUE", "MY_QUEUE2" }); + htQueues1.put("tests-jms-core20", new String[] { "MY_QUEUE", "MY_QUEUE2" }); + htQueues1.put("tests-jms-ee-ejb", new String[] { "MY_QUEUE" }); + htQueues1.put("tests-jms-ee-ejbweb-xa", new String[] { "QUEUE_BMT" }); + htQueues1.put("tests-jms-ee-appclient", new String[] { "MY_QUEUE" }); + htQueues1.put("tests-jms-ee-appclient-queuetests", new String[] { + "MY_QUEUE", "testQueue2", "testQ0", "testQ1", "testQ2" }); + htQueues1.put("tests-jms-ee-appclient-txqueuetests", + new String[] { "MY_QUEUE", "Q2" }); + // local access tests + htQueues1.put("tests-ejb-ee-bb-localaccess-mdbqaccesstest", new String[] { + "ejb_ee_bb_localaccess_mdbqaccesstest_MDB_QUEUE", "MDB_QUEUE_REPLY" }); + htQueues1.put("tests-ejb-ee-bb-localaccess-mdbtaccesstest", + new String[] { "MDB_QUEUE_REPLY" }); + htQueues1.put("tests-ejb-ee-sec-stateful-mdb", new String[] { + "MDB_QUEUE_REPLY", "ejb_ee_sec_stateful_mdb_MDB_QUEUE" }); + htQueues1.put("tests-ejb-ee-sec-mdb", new String[] { "MDB_QUEUE_REPLY", + "ejb_sec_mdb_MDB_QUEUE_BMT", "ejb_sec_mdb_MDB_QUEUE_CMT" }); + + /* + * Queues for ejb/ee/timer sub-tree + */ + htQueues1.put("tests-ejb-ee-timer", + new String[] { "MY_QUEUE", "ejb_ee_timer_mdb_MsgBean" }); + + /* + * Queues for ejb/ee/deploy sub-tree + */ + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-single", + new String[] { "ejb_ee_deploy_mdb_enventry_single_AllBean", + "ejb_ee_deploy_mdb_enventry_single_StringBean", + "ejb_ee_deploy_mdb_enventry_single_BooleanBean", + "ejb_ee_deploy_mdb_enventry_single_ByteBean", + "ejb_ee_deploy_mdb_enventry_single_ShortBean", + "ejb_ee_deploy_mdb_enventry_single_IntegerBean", + "ejb_ee_deploy_mdb_enventry_single_LongBean", + "ejb_ee_deploy_mdb_enventry_single_FloatBean", + "ejb_ee_deploy_mdb_enventry_single_DoubleBean", + "ejb_ee_deploy_mdb_enventry_single_AllBeanBMT", + "ejb_ee_deploy_mdb_enventry_single_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-scope", + new String[] { "ejb_ee_deploy_mdb_enventry_scope_Bean1_SameJar", + "ejb_ee_deploy_mdb_enventry_scope_Bean2_SameJar", + "ejb_ee_deploy_mdb_enventry_scope_Bean1_MultiJar", + "ejb_ee_deploy_mdb_enventry_scope_Bean2_MultiJar", + "ejb_ee_deploy_mdb_enventry_scope_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-casesens", + new String[] { "ejb_ee_deploy_mdb_enventry_casesens_CaseBean", + "ejb_ee_deploy_mdb_enventry_casesens_CaseBeanBMT", + "ejb_ee_deploy_mdb_enventry_casesens_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-single", + new String[] { "ejb_ee_deploy_mdb_ejbref_single_TestBean", + "ejb_ee_deploy_mdb_ejbref_single_TestBeanBMT", + "ejb_ee_deploy_mdb_ejbref_single_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-scope", + new String[] { "ejb_ee_deploy_mdb_ejbref_scope_Romeo", + "ejb_ee_deploy_mdb_ejbref_scope_Tristan", + "ejb_ee_deploy_mdb_ejbref_scope_Cyrano", + "ejb_ee_deploy_mdb_ejbref_scope_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-casesens", + new String[] { "ejb_ee_deploy_mdb_ejbref_casesens_TestBean", + "ejb_ee_deploy_mdb_ejbref_casesens_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-single", + new String[] { "ejb_ee_deploy_mdb_ejblink_single_TestBean", + "ejb_ee_deploy_mdb_ejblink_single_TestBeanBMT", + "ejb_ee_deploy_mdb_ejblink_single_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-scope", + new String[] { "ejb_ee_deploy_mdb_ejblink_scope_TestBean", + "ejb_ee_deploy_mdb_ejblink_scope_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-casesens", + new String[] { "ejb_ee_deploy_mdb_ejblink_casesens_TestBean", + "ejb_ee_deploy_mdb_ejblink_casesens_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-resref-single", + new String[] { "ejb_ee_deploy_mdb_resref_single_TestBean", + "ejb_ee_deploy_mdb_resref_single_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-singleT", + new String[] { "ejb_ee_deploy_mdb_enventry_singleT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-scopeT", + new String[] { "ejb_ee_deploy_mdb_enventry_scopeT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-enventry-casesensT", + new String[] { "ejb_ee_deploy_mdb_enventry_casesensT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-singleT", + new String[] { "ejb_ee_deploy_mdb_ejbref_singleT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-scopeT", + new String[] { "ejb_ee_deploy_mdb_ejbref_scopeT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejbref-casesensT", + new String[] { "ejb_ee_deploy_mdb_ejbref_casesensT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-singleT", + new String[] { "ejb_ee_deploy_mdb_ejblink_singleT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-scopeT", + new String[] { "ejb_ee_deploy_mdb_ejblink_scopeT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-ejblink-casesensT", + new String[] { "ejb_ee_deploy_mdb_ejblink_casesensT_ReplyQueue" }); + htQueues1.put("tests-ejb-ee-deploy-mdb-resref-singleT", + new String[] { "ejb_ee_deploy_mdb_resref_singleT_ReplyQueue" }); + + /* + * Queues for ejb30 sub-tree + */ + htQueues1.put("tests-ejb30-bb-session-stateless-annotation", + new String[] { "MY_QUEUE" }); + htQueues1.put("tests-ejb30-bb-mdb", + new String[] { "MDB_QUEUE_REPLY", "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-tx-mdb", + new String[] { "MDB_QUEUE_REPLY", "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-bb-localaccess-mdbclient", + new String[] { "MDB_QUEUE_REPLY", "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-timer-basic-mdb", + new String[] { "MDB_QUEUE_REPLY", "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-zombie", new String[] { "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-assembly-appres", + new String[] { "MDB_QUEUE_REPLY" }); + htQueues1.put("tests-ejb30-timer-interceptor-business-mdb", + new String[] { "MDB_QUEUE" }); + htQueues1.put("tests-ejb30-timer-schedule-auto-attr-mdb", + new String[] { "MDB_QUEUE" }); + + /* + * Queue for servlet sub-tree + */ + htQueues1.put("tests-servlet-spec-annotation", new String[] { "MY_QUEUE" }); + + /* + * Queues for jsp sub-tree + */ + htQueues1.put("tests-jsp-spec-tagext-resource", + new String[] { "MY_QUEUE" }); + + /* + * Queues for webservices sub-tree + */ + htQueues1.put("tests-webservices-handler-localtx", + new String[] { "MY_QUEUE" }); + htQueues1.put("tests-webservices-handlerEjb-localtx", + new String[] { "MY_QUEUE" }); + + // add default values + htTopics1.put("tests-jms-ee-mdb-mdb_sndToTopic", + new String[] { "jms_ee_mdb_mdb_sndToTopic_MDB_TOPIC_REPLY", + "jms_ee_mdb_mdb_sndToTopic_MDB_TOPIC" }); + htTopics1.put("tests-jms-core", new String[] { "MY_TOPIC", "MY_TOPIC2" }); + htTopics1.put("tests-jms-core20", new String[] { "MY_TOPIC", "MY_TOPIC2" }); + htTopics1.put("tests-jms-ee-ejb", new String[] { "MY_TOPIC" }); + htTopics1.put("tests-jms-ee-ejbweb-xa", new String[] { "TOPIC_BMT" }); + htTopics1.put("tests-jms-ee-appclient", new String[] { "MY_TOPIC" }); + htTopics1.put("tests-jms-ee-appclient-topictests", + new String[] { "MY_TOPIC", "MY_TOPIC2" }); + htTopics1.put("tests-jms-ee-appclient-txtopictests", + new String[] { "MY_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-xa", new String[] { + "jms_ee_mdb_xa_MDB_DURABLE_BMT", "jms_ee_mdb_xa_MDB_DURABLE_CMT" }); + htTopics1.put("tests-jms-ee-mdb-mdb_exceptT", + new String[] { "jms_ee_mdb_mdb_exceptT_MDB_DURABLE_BMT", + "jms_ee_mdb_mdb_exceptT_MDB_DURABLE_CMT", + "jms_ee_mdb_mdb_exceptT_MDB_DURABLETXNS_CMT" }); + htTopics1.put("tests-jms-ee-mdb-mdb_msgHdrT", + new String[] { "jms_ee_mdb_mdb_msgHdrT_MDB_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-mdb_msgPropsT", + new String[] { "jms_ee_mdb_mdb_msgPropsT_MDB_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-mdb_msgTypesT1", + new String[] { "jms_ee_mdb_mdb_msgTypesT1_MDB_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-mdb_msgTypesT2", + new String[] { "jms_ee_mdb_mdb_msgTypesT2_MDB_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-mdb_msgTypesT3", + new String[] { "jms_ee_mdb_mdb_msgTypesT3_MDB_TOPIC" }); + htTopics1.put("tests-jms-ee-mdb-mdb_rec", + new String[] { "jms_ee_mdb_mdb_rec_MDB_TOPIC" }); + // local access tests + htTopics1.put("tests-ejb-ee-bb-localaccess-mdbtaccesstest", + new String[] { "ejb_ee_bb_localaccess_mdbtaccesstest_MDB_TOPIC" }); + /* + * Topics for ejb/ee/deploy sub-tree + */ + htTopics1.put("tests-ejb-ee-deploy-mdb-enventry-singleT", + new String[] { "ejb_ee_deploy_mdb_enventry_singleT_AllBean", + "ejb_ee_deploy_mdb_enventry_singleT_StringBean", + "ejb_ee_deploy_mdb_enventry_singleT_BooleanBean", + "ejb_ee_deploy_mdb_enventry_singleT_ByteBean", + "ejb_ee_deploy_mdb_enventry_singleT_ShortBean", + "ejb_ee_deploy_mdb_enventry_singleT_IntegerBean", + "ejb_ee_deploy_mdb_enventry_singleT_LongBean", + "ejb_ee_deploy_mdb_enventry_singleT_FloatBean", + "ejb_ee_deploy_mdb_enventry_singleT_DoubleBean", + "ejb_ee_deploy_mdb_enventry_singleT_AllBeanBMT" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-enventry-scopeT", + new String[] { "ejb_ee_deploy_mdb_enventry_scopeT_Bean1_SameJar", + "ejb_ee_deploy_mdb_enventry_scopeT_Bean2_SameJar", + "ejb_ee_deploy_mdb_enventry_scopeT_Bean1_MultiJar", + "ejb_ee_deploy_mdb_enventry_scopeT_Bean2_MultiJar" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-enventry-casesensT", + new String[] { "ejb_ee_deploy_mdb_enventry_casesensT_CaseBean", + "ejb_ee_deploy_mdb_enventry_casesensT_CaseBeanBMT" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejbref-singleT", + new String[] { "ejb_ee_deploy_mdb_ejbref_singleT_TestBean", + "ejb_ee_deploy_mdb_ejbref_singleT_TestBeanBMT" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejbref-scopeT", + new String[] { "ejb_ee_deploy_mdb_ejbref_scopeT_Romeo", + "ejb_ee_deploy_mdb_ejbref_scopeT_Tristan", + "ejb_ee_deploy_mdb_ejbref_scopeT_Cyrano" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejbref-casesensT", + new String[] { "ejb_ee_deploy_mdb_ejbref_casesensT_TestBean" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejblink-singleT", + new String[] { "ejb_ee_deploy_mdb_ejblink_singleT_TestBean", + "ejb_ee_deploy_mdb_ejblink_singleT_TestBeanBMT" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejblink-scopeT", + new String[] { "ejb_ee_deploy_mdb_ejblink_scopeT_TestBean" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-ejblink-casesensT", + new String[] { "ejb_ee_deploy_mdb_ejblink_casesensT_TestBean" }); + htTopics1.put("tests-ejb-ee-deploy-mdb-resref-singleT", + new String[] { "ejb_ee_deploy_mdb_resref_singleT_TestBean" }); + + /* + * Topics for ejb30 sub-tree + */ + htTopics1.put("tests-ejb30-bb-session-stateless-annotation", + new String[] { "MY_TOPIC" }); + htTopics1.put("tests-ejb30-bb-mdb-dest-topic", new String[] { "MY_TOPIC" }); + htTopics1.put( + "tests-ejb30-bb-mdb-activationconfig-topic-selectordupsnondurable", + new String[] { "MY_TOPIC" }); + + /* + * Topics for servlet sub-tree + */ + htTopics1.put("tests-servlet-spec-annotation", new String[] { "MY_TOPIC" }); + + /* + * Topics for jsp sub-tree + */ + htTopics1.put("tests-jsp-spec-tagext-resource", + new String[] { "MY_TOPIC" }); + + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminException.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminException.java new file mode 100644 index 0000000..35c45bf --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminException.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +public class TSJMSAdminException extends java.lang.Exception { + public TSJMSAdminException() { + super(); + } + + public TSJMSAdminException(String s) { + super(s); + System.out.println(s); + } + + public TSJMSAdminException(String s, Throwable e) { + super(s); + System.out.println(s); + e.printStackTrace(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminInterface.java new file mode 100644 index 0000000..eea3005 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSAdminInterface.java @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.io.*; + +/** + * This is the TSJMSAdminInterface. An implementation of this interface must be + * provided by each Java EE implementation, to support their own + * creation/deletion semantics of topic/queue and + * QueueConnectionFactory/TopicConnectionFactory/ ConnectionFactory. + * + * @author Kyle Grucci + */ + +public interface TSJMSAdminInterface { + /** + * The init method is a logging mechanism for diagnostics. The writer + * parameter specifies the PrinterWriter that is used to log output. + * + * Initializes a new TSJMSAdminInterface instance. All output should be + * printed to this PrintWriter. All properties in the ts.jte file are + * accessible to this porting implementation class only via the + * TSPropertyManager class. + * + * @param writer + * The PrintWriter that is used to log output. + */ + public void init(PrintWriter writer); + + /** + * The createQueues method creates queues in a Java EE implementation. The + * queues parameter specifies the queue destination objects to create. + * + * @param queues + * Queues to create + * + */ + public void createQueues(String[] queues) throws TSJMSAdminException; + + /** + * The createTopics method creates topics in a Java EE implementation. The + * topics parameter specifies the topic destination objects to create. + * + * @param topics + * Topics to create + * + */ + public void createTopics(String[] topics) throws TSJMSAdminException; + + /** + * The removeQueues method removes queues in a Java EE implementation. The + * queues parameter specifies the queue destination objects to remove. + * + * @param queues + * Queues to remove + * + */ + public void removeQueues(String[] queues) throws TSJMSAdminException; + + /** + * The removeTopics method remove topics in a Java EE implementation. The + * topics parameter specifies the topic destination objects to remove. + * + * @param topics + * Topics to remove + * + */ + public void removeTopics(String[] topics) throws TSJMSAdminException; + + /** + * This method creates QueueConnectionFactorys in a Java EE implementation. + * + * Two String array parameters are passed when createQueueConnectionFactories + * is called, where the first array specifies QueueConnectionFactorys to + * create and the second array specifies properties associated with the + * QueueConnectionFactory. + * + * Arguments passed as queueConnectionFactories[n],props[n] where props[i] + * consists all properties that associated to QueueConnectionFactory + * queueConnectionFactories[i]. + * + * Each element in the Properties array consists of a String name value pair + * that defines the properties for the factory connection. Some of the + * connection factories set up by the Java EE TCK require a property for the + * clientID. The name value pair in this case would be "clientId=cts". If more + * than one property needs to be specified by a single QueueConnectionFactory, + * the properties should be space separated in the props string. If no + * property is being specified, the name value pair would be an empty String + * "". + * + * @param queueConnectionFactories + * queueConnectionFactories to create + * @param props + * properties for the connection, if any + */ + + public void createQueueConnectionFactories(String[] queueConnectionFactories, + String[] props) throws TSJMSAdminException; + + /** + * This method creates TopicConnectionFactorys in a Java EE implementation. + * + * Two String array parameters are passed when createTopicConnectionFactories + * is called, where the first array specifies TopicConnectionFactorys to + * create and the second array specifies properties associated with the + * TopicConnectionFactory. + * + * Arguments passed as topicConnectionFactories[n],props[n] where props[i] + * consists all properties that associated to TopicConnectionFactory + * topicConnectionFactories[i]. + * + * Each element in the Properties array consists of a String name value pair + * that defines the properties for the factory connection. Some of the + * connection factories set up by the Java EE TCK require a property for the + * clientID. The name value pair in this case would be "clientId=cts". If more + * than one property needs to be specified by a single TopicConnectionFactory, + * the properties should be space separated in the props string. If no + * property is being specified, the name value pair would be an empty String + * "". + * + * @param topicConnectionFactories + * topicConnectionFactories to create + * @param props + * properties for the connection, if any + */ + public void createTopicConnectionFactories(String[] topicConnectionFactories, + String[] props) throws TSJMSAdminException; + + /** + * This method creates ConnectionFactorys in a Java EE implementation. + * + * Two String array parameters are passed when createConnectionFactories is + * called, where the first array specifies ConnectionFactorys to create and + * the second array specifies properties associated with the + * ConnectionFactory. + * + * Arguments passed as connectionFactories[n],props[n] where props[i] consists + * all properties that associated to ConnectionFactory connectionFactories[i]. + * + * Each element in the Properties array consists of a String name value pair + * that defines the properties for the factory connection. If more than one + * property needs to be specified by a single ConnectionFactory, the + * properties should be space separated in the props string. If no property is + * being specified, the name value pair would be an empty String "". + * + * @param connectionFactories + * connectionFactories to create + * @param props + * properties for the connection, if any + */ + public void createConnectionFactories(String[] connectionFactories, + String[] props) throws TSJMSAdminException; + + /** + * This method removes ConnectionFactories from a Java EE implementation. + * + * @param jmsConnectionFactoryNames + * JmsConnectionFactoryNames to remove + * + */ + public void removeJmsConnectionFactories(String[] jmsConnectionFactoryNames) + throws TSJMSAdminException; + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjects.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjects.java new file mode 100644 index 0000000..3f662ba --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjects.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import com.sun.ts.lib.util.*; + +/** + * This is a factory class for creating instances of TSJMSObjectsInterface. The + * implementation classes used are determined by the values of the porting + * package properties in TS_HOME/bin/ts.jte. + * + */ +public class TSJMSObjects { + + private static final String DEFAULT_PORTING_CLASS = "com.sun.ts.lib.implementation.sun.jms.SunRIJMSObjects"; + + private static String portingPropName = "porting.ts.jmsObjects.class.1"; + + private static String portingClass = null; + + private static TSJMSObjectsInterface tsJmsObjects = null; + + public static TSJMSObjectsInterface getJMSObjectsInstance() throws Exception { + try { + // Create instance of the TSJMSObjectsInterface implementation + // class + TestUtil.logMsg("TSJMSObjects.getJMSObjectsInstance()"); + portingClass = TestUtil.getProperty(portingPropName); + if (portingClass == null) { + portingClass = DEFAULT_PORTING_CLASS; + TestUtil.logMsg("Property " + portingPropName + " not set. " + + "Using default porting class. "); + } + TestUtil.logMsg("Porting implementation class=" + portingClass); + if (tsJmsObjects == null) { + Class c = Class.forName(portingClass); + tsJmsObjects = (TSJMSObjectsInterface) c.newInstance(); + } + return tsJmsObjects; + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjectsInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjectsInterface.java new file mode 100644 index 0000000..3a9a787 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSJMSObjectsInterface.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import jakarta.jms.*; + +/** + * This is the TSJMSObjectsInterface. An implementation of this interface must + * be provided by each JMS implementation to support their own implementation of + * getting administered objects. + * + */ +public interface TSJMSObjectsInterface { + /** + * This method allows JMS implementation to get Queue + */ + + public Queue getQueue(String name) throws Exception; + + /** + * This method allows JMS implementation to get Topic + */ + + public Topic getTopic(String name) throws Exception; + + /** + * This method allows JMS implementation to get TopicConnectionFactory + */ + + public TopicConnectionFactory getTopicConnectionFactory(String name) + throws Exception; + + /** + * This method allows JMS implementation to get QueueConnectionFactory + */ + + public QueueConnectionFactory getQueueConnectionFactory(String name) + throws Exception; + + /** + * This method allows JMS implementation to get ConnectionFactory + */ + + public ConnectionFactory getConnectionFactory(String name) throws Exception; + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContext.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContext.java new file mode 100644 index 0000000..3018ffb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContext.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ +package com.sun.ts.lib.porting; + +import com.sun.ts.lib.util.*; + +/** + * TSLoginContext provides the implementation specific code for allowing a + * program to login as a specific user. This class is implemented as a wrapper + * class around Sun's login implementation code. + */ +public class TSLoginContext implements TSLoginContextInterface { + private TSLoginContextInterface ctsLogin = null; + + private String sClass = "porting.ts.login.class.1"; + + /** + * Provides the LoginContext needed to perform a login. + */ + public TSLoginContext() throws Exception { + // move initialization to login method, to make sure that TestUtil's + // properties are already initialized + } + + /** + * Provides the LoginContext needed to perform a login. + */ + public TSLoginContext(String sClassName) throws Exception { + sClass = sClassName; + } + + /** + * Performs the login functionality. + * + * @param usr + * the username to login + * @param pwd + * the password of user + */ + public void login(String usr, String pwd) throws Exception { + if (ctsLogin == null) { + init(); + } + ctsLogin.login(usr, pwd); + } + + /** + * This login method is used for certificate based login + * + * Note: This method also uses keystore and keystore password from the TS + * configuration file + * + * @param useralias + * - alias is used to pick up the certificate from keystore + */ + + public void login(String useralias) throws Exception { + if (ctsLogin == null) { + init(); + } + ctsLogin.login(useralias); + } + + /** + * This login method is used for certificate based login + * + * @param useralias + * - alias used to pickup the certificate from keystore + * @param keystore + * - keystore file + * @param keyPass + * - keystore password + */ + + public void login(String useralias, String keystore, String keyPass) + throws Exception { + if (ctsLogin == null) { + init(); + } + ctsLogin.login(useralias, keystore, keyPass); + } + + /** + * Performs logout. + */ + public Boolean logout() { + if (ctsLogin == null) { + init(); + } + return ctsLogin.logout(); + } + + private void init() { + try { + // create and initialize a new instance of the Login class + Class c = Class.forName(TestUtil.getProperty(sClass)); + ctsLogin = (TSLoginContextInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + // throw e; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContextInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContextInterface.java new file mode 100644 index 0000000..e86c5ab --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSLoginContextInterface.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +/** + * TSLoginContextInterface provides the interface that must be implemented to + * provide the implementation specific login code to login as a specified user. + */ +public interface TSLoginContextInterface { + /** + * This method is used for login with username and password. + * + * @param usr + * - string username + * @param pwd + * - string password + */ + public void login(String usr, String pwd) throws Exception; + + /** + * This login method is used for Certificate based login + * + * Note: This method also uses keystore and keystore password from the TS + * configuration file + * + * @param alias + * - alias is used to pick up the certificate from keystore + */ + public void login(String alias) throws Exception; + + /** + * This login method is used for Certificate based login + * + * @param alias + * - alias is used to pick up the certificate from keystore + * @param keystore + * - keystore file + * @param keyPass + * - keystore password + */ + public void login(String alias, String keystore, String keyPass) + throws Exception; + + /** + * This method is used for logout + */ + public Boolean logout(); + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURL.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURL.java new file mode 100644 index 0000000..533fbde --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURL.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.net.*; +import java.io.Serializable; +import com.sun.ts.lib.util.*; + +/** + * This is a Java EE Reference specific implementation of the TSURLInterface + * which is to be used for Java EE TCK testing. TS tests use this interface to + * obtain the URL String to use to access a given web component. If a given Java + * EE Server implmentation requires that URLs be created in a different manner, + * then this implementation can be replaced. + * + * @author Kyle Grucci + */ +public class TSURL implements TSURLInterface, Serializable { + private TSURLInterface ctsURL = null; + + private String sClass = "porting.ts.url.class.1"; + + public TSURL() { + // we'll initialize the impl when the individual method is called + // this constructor assumes sClass = "porting.ts.url.class.1". + } + + public TSURL(String sClassName) { + sClass = sClassName; + } + + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL object. + */ + public URL getURL(String protocol, String host, int port, String file) + throws MalformedURLException { + if (ctsURL == null) { + try { + // create and initialize a new instance of TSURLInterface + Class c = Class.forName(TestUtil.getProperty(sClass)); + ctsURL = (TSURLInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return ctsURL.getURL(protocol, host, port, file); + } + + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL as a String. + */ + public String getURLString(String protocol, String host, int port, + String file) { + if (ctsURL == null) { + try { + // create and initialize a new instance of TSURLInterface + Class c = Class.forName(TestUtil.getProperty(sClass)); + ctsURL = (TSURLInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return ctsURL.getURLString(protocol, host, port, file); + } + + /** + * This method is called by TS tests to get the request string to use to + * access a given web component. + * + * @param request + * - the request file. + * @return a valid String object. + */ + public String getRequest(String request) { + if (ctsURL == null) { + try { + // create and initialize a new instance of TSURLInterface + Class c = Class.forName(TestUtil.getProperty(sClass)); + ctsURL = (TSURLInterface) c.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return ctsURL.getRequest(request); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURLInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURLInterface.java new file mode 100644 index 0000000..792af9f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/TSURLInterface.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.porting; + +import java.net.*; + +/** + * An implementation of the TSURLInterface is to be used for Java EE TCK + * testing. TS tests use this interface to obtain the URL String to use to + * access a given web component. If a given Java EE Server implmentation + * requires that URLs be created in a different manner, then this implementation + * can be replaced. + * + * @author Kyle Grucci + */ +public interface TSURLInterface { + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL object. + */ + public URL getURL(String protocol, String host, int port, String file) + throws MalformedURLException; + + /** + * This method is called by TS tests to get the URL to use to access a given + * web component. + * + * @param protocol + * - the name of the protocol. + * @param host + * - the name of the host. + * @param port + * - the port number. + * @param file + * - the host file. + * @return a valid URL as a String. + */ + public String getURLString(String protocol, String host, int port, + String file); + + /** + * This method is called by TS tests to get the request to use to access a + * given web component. + * + * @param request + * - the request file. + * @return a valid String object. + */ + public String getRequest(String request); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/porting/build.xml b/tck/old-tck/source/src/com/sun/ts/lib/porting/build.xml new file mode 100644 index 0000000..16463cb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/porting/build.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/AssertionMapper.java b/tck/old-tck/source/src/com/sun/ts/lib/util/AssertionMapper.java new file mode 100644 index 0000000..b1c9fb5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/AssertionMapper.java @@ -0,0 +1,553 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.*; +import java.util.*; +import javax.xml.parsers.*; +import org.xml.sax.helpers.*; +import org.xml.sax.*; +import org.apache.tools.ant.taskdefs.*; +import org.apache.tools.ant.types.*; +import org.apache.tools.ant.*; +import com.sun.ts.lib.util.*; +import com.sun.ts.lib.harness.*; + +public final class AssertionMapper { + private static final String NO_DESC = "See assertion html documents."; + + private static final String INVALID = "WARN: invalid assertion_id: "; + + public final static String NL = System.getProperty("line.separator"); + + public final static String NL2 = NL; + + private static boolean debug; + + private static boolean showRetrievedAssertions; + + protected static String assertionDir; + + private static String[] assertionFiles; + + private static Map fileName2Map = new HashMap(); + + private static Map aMap = new HashMap(); + + // xmlFileNames that parser has failed to load, and thus will not load it + // again. + private static Set unloadable = new HashSet(); + + static { + debug = Boolean.getBoolean("AssertionMapper.debug"); + showRetrievedAssertions = Boolean.getBoolean("show.retrieved.assertions"); + assertionDir = System.getProperty("assertion.dir"); + if (assertionDir == null) + assertionDir = TSTestFinder.TS_HOME + File.separator + "internal" + + File.separator + "docs"; + + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(assertionDir); + ds.addDefaultExcludes(); + ds.setCaseSensitive(false); + ds.setIncludes(new String[] { "**/*Assertions.xml" }); + ds.scan(); + assertionFiles = ds.getIncludedFiles(); + System.out.println( + assertionFiles.length + " assertion files under " + assertionDir); + for (int i = 0; i < assertionFiles.length; i++) { + System.out.println(assertionFiles[i]); + } + } + + private AssertionMapper() { + } + + /** + * main program to test AssertionComparator, the nested class. + */ + public static void main(String[] args) { + String[] s = { "JMS:SPEC:130.3", "EJB:JAVADOC:27", "JMS:SPEC:130.19", + "JSP:SPEC:130", "JMS:SPEC:130.9.5", "JMS:SPEC:130.9" }; + Arrays.sort(s, AssertionComparator.getInstance()); + System.out.println("After sorting"); + for (int i = 0; i < s.length; i++) { + System.out.println(s[i]); + } + + } + + public static void log(String s) { + System.out.println(s); + } + + /* + * Retrieves assertion descriptions for assertion_ids. + * + * @param assertionIds separated by ; + * + * @param file test source file that contains the assertion ids. For debug + * purpose. + * + * @return a single string containing all assertion descriptions separated by + * new line. + * + */ + public static String getAssertionDescriptions(String assertionIds, + File file) { + String filePath = file.getPath(); + if (assertionIds == null || assertionIds.length() == 0) { + System.out.println("WARN: no value for assertion_ids (" + filePath + ")"); + return NO_DESC; + } + StringTokenizer st = new StringTokenizer(assertionIds, ";,\n\r\f\t"); + int countId = st.countTokens(); + String[] idArray = new String[countId]; + for (int i = 0; i < idArray.length; i++) { + idArray[i] = st.nextToken().trim(); + } + Arrays.sort(idArray, AssertionComparator.getInstance()); + Set addedAssertions = new HashSet(); // avoid one assertion to be added + // multiple times + StringBuffer retval = new StringBuffer(); + for (int i = 0; i < idArray.length; i++) { + String aDescription = getDescription0(idArray[i], filePath, + addedAssertions); + if (aDescription != null && aDescription.length() > 0) { + retval.append(aDescription).append(NL2); + } + } + return retval.toString().trim(); + }// getAssertionDescription + + /** + * @param token + * a token in assertion_ids. It has not beenn validated or split. + * @param filePath + * the full path to the test source code that contained the assertion + * ids. For example, + * /files/ts/src/com/sun/ts/tests/jsp/syntax/Client.java. + * @param addedAssertion + * set to keep track of assertions that have been added to the + * result. + * @return a complete description of this assertion id. If it's not a valid + * assertion, null or empty string is returned. A complete description + * includes description of all of its ancestors, its own description, + * and that of all of its descendents. + */ + private static String getDescription0(String token, String filePath, + Set addedAssertions) { + String aDescription = null; // assertion description for token(id) + int pos1 = token.indexOf(":"); + if (pos1 == -1) { + System.out.println(INVALID + token + " (" + filePath + ")"); + return null; + } + String first = token.substring(0, pos1); + int pos2 = token.indexOf(":", pos1 + 1); + if (pos2 == -1) { + System.out.println(INVALID + token + " (" + filePath + ")"); + return null; + } + String second = token.substring(pos1 + 1, pos2); + String third = token.substring(pos2 + 1); // the number, e.g., 14 + + // for example, first=JMS, second=SPEC, third=14.1 + StringBuffer xmlFileName = new StringBuffer(); + xmlFileName.append(first); + xmlFileName.append(Character.toUpperCase(second.charAt(0))); + xmlFileName.append(second.substring(1).toLowerCase()); + xmlFileName.append("Assertions.xml"); + + // some old assertion doc use 8, instead of JMS:SPEC:8 + String fn = xmlFileName.toString(); + Map assertionMap = (Map) fileName2Map.get(fn); + if (assertionMap == null) { // has not been read, or has failed to load + if (!unloadable.contains(fn)) { + new HelpHandler().load(fn, first); + } + } + assertionMap = (Map) fileName2Map.get(fn); + StringBuffer resultBuffer = new StringBuffer(); + if (assertionMap == null) { // failed to read xml file + resultBuffer.append(token).append(" ").append(NO_DESC); + return resultBuffer.toString(); + } + + // get description of all ancestors. Assume ancestors and descendants are + // in the same map. + int dotPosition = token.indexOf(".", pos2); + while (dotPosition != -1) { + String upperId = token.substring(0, dotPosition); + if (!addedAssertions.contains(upperId)) { + String upperDesc = (String) assertionMap.get(upperId); + if (upperDesc == null || upperDesc.length() == 0) { + System.out.println( + "WARN: no description for " + upperId + " in " + filePath); + upperDesc = NO_DESC; + } + resultBuffer.append(upperId).append(" ").append(upperDesc).append(NL2); + addedAssertions.add(upperId); + } + dotPosition = token.indexOf(".", dotPosition + 1); + } + + // get description for itself and all descendants + if (!addedAssertions.contains(token)) { + String thisDescription = (String) assertionMap.get(token); + if (thisDescription == null) { + thisDescription = NO_DESC; + System.out + .println("WARN: no description for " + token + " in " + filePath); + } + resultBuffer.append(token).append(" ").append(thisDescription) + .append(NL2); + addedAssertions.add(token); + } + + List keyList = new ArrayList(); + String tokenDot = token + '.'; + for (Iterator i = assertionMap.keySet().iterator(); i.hasNext();) { + String key = (String) i.next(); + if (key.startsWith(tokenDot) && !addedAssertions.contains(key)) { + keyList.add(key); + } + } + Collections.sort(keyList, AssertionComparator.getInstance()); + for (int i = 0, n = keyList.size(); i < n; i++) { + String k = (String) keyList.get(i); + resultBuffer.append(k).append(" ").append(assertionMap.get(k)) + .append(NL2); + addedAssertions.add(k); + } + return resultBuffer.toString().trim(); + // TODO: remove from assertion description + } + + // ------------------------ static nested class --------------------------- + public static class AssertionComparator implements Comparator { + private static AssertionComparator instance = new AssertionComparator(); + + private AssertionComparator() { + } + + public static AssertionComparator getInstance() { + return instance; + } + + public int compare(Object o1, Object o2) { + String s1 = (String) o1; + String s2 = (String) o2; + int pos1 = s1.lastIndexOf(":"); + int pos2 = s2.lastIndexOf(":"); + String word1 = null; + String word2 = null; + if (pos1 != -1) { + word1 = s1.substring(0, pos1); + } + if (pos2 != -1) { + word2 = s2.substring(0, pos2); + } + + String numPart1 = null; + String numPart2 = null; + // to handle invalid ids like 145, 234. + if (pos1 == -1 && pos2 == -1) { + numPart1 = s1; + numPart2 = s2; + } else { + // one is null, but not both + if (word1 == null || word2 == null) { + return -1; + } + // both have wordpart + int wordCompare = word1.compareTo(word2); + if (wordCompare != 0) { + return wordCompare; + } + // continue to compare number part. pos1 and pos2 are not -1 now. + numPart1 = s1.substring(pos1 + 1); + numPart2 = s2.substring(pos2 + 1); // for example, 1.1.4.5 + } + + StringTokenizer st1 = new StringTokenizer(numPart1, "."); + StringTokenizer st2 = new StringTokenizer(numPart2, "."); + int size1 = st1.countTokens(); + int size2 = st2.countTokens(); + int biggerSize = (size1 == size2) ? size1 + : (size1 > size2) ? size1 : size2; + + int[] int1 = new int[biggerSize]; + int[] int2 = new int[biggerSize]; + fillIntArray(st1, int1); + fillIntArray(st2, int2); + + for (int i = 0; i < biggerSize; i++) { + int diff = int1[i] - int2[i]; + if (diff != 0) { + return diff; + } + // both are zero, or the same positive number + if (int1[i] == 0) { + return -1; + } + } + return -1; + } + + /** + * @param int1 + * bigger of the two. equal to bigger than number of tokens. + */ + private void fillIntArray(StringTokenizer st, int[] int1) { + for (int i = 0; i < int1.length && st.hasMoreTokens(); i++) { + try { + int1[i] = Integer.parseInt(st.nextToken()); + } catch (NumberFormatException exp) { + break; // stop once we hit a non-number. Unitializaed part will be 0. + } + } + } + } + + // ------------------------------------------------------------------------ + /** + * sax2 event handler is too slow. So stick to HandlerBase. + */ + public static class HelpHandler + // extends DefaultHandler { + extends HandlerBase { + private String xmlFileName; + + private boolean b_assertions; + + private boolean b_assertion; + + private boolean b_id; + + private boolean b_description; + + private boolean b_technology; + + private String currentId; + + private String currentDescription; + + private String techType; // JMS:SPEC, JSP:JAVADOC, etc + + private String specOrJavadoc; // spec, or javadoc + + private Map aFileMap; + + private boolean alreadyPut; + + private String parentDir; + + public HelpHandler() { + } + + public void load(String xmlFileName, String technologyName) { + String fn = null; + for (int i = 0; i < assertionFiles.length; i++) { + int index = assertionFiles[i].lastIndexOf(File.separator) + 1; + String fName = assertionFiles[i].substring(index); + if (fName.equalsIgnoreCase(xmlFileName)) { + fn = assertionFiles[i]; + break; + } + } + if (fn == null) { + System.out.println("WARN: failed to find file " + xmlFileName + + " under " + assertionDir + ", verify the technology name [" + + technologyName + "] is spelled correcting in the test clients"); + return; + } + this.xmlFileName = xmlFileName; + try { + // Store the parent directory of this file for the resolver to use + System.err.println("%%%%%%%%%% Parsing file \"" + fn + "\" %%%%%%%%%"); + File fileFN = new File(fn); + parentDir = fileFN.getParent(); + System.err.println("%%%%%%%%%% parentDir set to (resolver uses this) \"" + + parentDir + "\" %%%%%%%%%"); + + InputSource is = new InputSource( + new FileInputStream(new File(assertionDir, fn))); + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setValidating(false); + SAXParser saxParser = factory.newSAXParser(); + saxParser.parse(is, this); + } catch (SAXException se) { + se.printStackTrace(); + unloadable.add(xmlFileName); + System.out.println("Will skip all assertions in " + xmlFileName); + } catch (IOException fe) { + fe.printStackTrace(); + unloadable.add(xmlFileName); + System.out.println("Will skip all assertions in " + xmlFileName); + } catch (ParserConfigurationException pe) { + pe.printStackTrace(); + unloadable.add(xmlFileName); + System.out.println("Will skip all assertions in " + xmlFileName); + } + } + + /* + * Implementation of the entity resolver interface. This allows CTS + * developers to use entity declarations in their assertion docs provided + * the assertion doc (the referencing doc) and the referenced docs are in + * the same directory. + */ + public InputSource resolveEntity(String publicId, String systemId) { + System.err.println("publicId \"" + publicId + "\""); + System.err.println("systemId \"" + systemId + "\""); + String result = null; + String fileName = systemId.substring(systemId.lastIndexOf("/") + 1); + String possibleLocation = assertionDir + File.separator + parentDir + + File.separator + fileName; + File possibleFile = new File(possibleLocation); + if (possibleFile.isFile()) { + result = possibleLocation; + } else { + System.err.println( + "%%%%%%% Error could not resolve file \"" + fileName + "\""); + result = systemId; + } + System.err + .println("%%%%%%%% Entity Resolver returning \"" + result + "\""); + return new InputSource(result); + } + + public void startElement(String localName, AttributeList attrs) + throws SAXException { + // public void startElement(String uri, + // String localName, + // String qName, + // Attributes attributes) + // throws SAXException { + if (localName.equalsIgnoreCase("assertions")) { + b_assertions = true; + aFileMap = new HashMap(); + } else if (localName.equalsIgnoreCase("assertion") && b_assertions) { + b_assertion = true; + } else if (localName.equalsIgnoreCase("id") && b_assertions + && b_assertion) { + b_id = true; + } else if (localName.equalsIgnoreCase("description") && b_assertions + && b_assertion) { + b_description = true; + } else if (localName.equalsIgnoreCase("sub-assertions") && b_assertions + && b_assertion) { + putIdAndDescription(); + } else if (localName.equalsIgnoreCase("spec") + || localName.equalsIgnoreCase("javadoc")) { + specOrJavadoc = localName; + } else if (localName.equalsIgnoreCase("technology")) { + b_technology = true; + } + } + + public void endElement(String localName) throws SAXException { + // public void endElement(String uri, + // String localName, + // String qName) + // throws SAXException { + if (localName.equalsIgnoreCase("assertions")) { + fileName2Map.put(this.xmlFileName, aFileMap); + b_assertions = false; + return; + } else if (localName.equalsIgnoreCase("assertion")) { + putIdAndDescription(); + b_assertion = false; + b_id = false; + b_description = false; + } else if (localName.equalsIgnoreCase("id") && b_assertions + && b_assertion) { + b_id = false; + } else if (localName.equalsIgnoreCase("description") && b_assertions + && b_assertion) { + b_description = false; + } else if (localName.equalsIgnoreCase("technology")) { + b_technology = false; + } + } + + public void characters(char[] ch, int start, int length) + throws SAXException { + if (b_id && b_description) { + System.out.println( + "WARN: invalid state: in both id and description element."); + } + if (b_id) { + currentId = new String(ch, start, length); + alreadyPut = false; + } else if (b_description) { + String content = new String(ch, start, length); + if (currentDescription == null) { + currentDescription = content; + } else { // some descriptions have formatting elements , + // ,which + // may be treated as nested elements of description by the parser + currentDescription += " " + content; + } + alreadyPut = false; + } else if (b_technology) { + if (specOrJavadoc == null) { + System.out + .println("Should have encountered javadoc or spec element!"); + } else { + String tech = new String(ch, start, length).trim(); + techType = (tech + ':' + specOrJavadoc).toUpperCase(); + } + } + } // characters + + /** + * need to put at end of assertion, or start of sub-assertion + */ + private void putIdAndDescription() { + if (alreadyPut) { + return; + } + if (currentId == null || currentId.length() == 0) { + System.out.println("WARN: null id in " + xmlFileName); + return; + } + currentId = currentId.trim(); + // some id may be like 14, while it really should be like JMS:SPEC:14 + if (techType != null && !currentId.startsWith(techType)) { + currentId = techType + ':' + currentId; + } + if (currentDescription == null || currentDescription.length() == 0) { + System.out.println("WARN: for id:[" + currentId + + "] null description in " + xmlFileName); + currentDescription = NO_DESC; + } else { + currentDescription = currentDescription.trim(); + } + if (showRetrievedAssertions) { + System.out.println(currentId + " " + currentDescription); + } + aFileMap.put(currentId, currentDescription); + alreadyPut = true; + currentId = null; + currentDescription = null; + } + + } // nested class + +}// main class diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Decoder.java b/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Decoder.java new file mode 100644 index 0000000..ecb540d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Decoder.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.OutputStream; +import java.io.PushbackInputStream; +import java.io.PrintStream; + +/** + * This class implements a BASE64 Character decoder as specified in RFC1521. + * + * This RFC is part of the MIME specification which is published by the Internet + * Engineering Task Force (IETF). Unlike some other encoding schemes there is + * nothing in this encoding that tells the decoder where a buffer starts or + * stops, so to use it you will need to isolate your encoded data into a single + * chunk and then feed them this decoder. The simplest way to do that is to read + * all of the encoded data into a string and then use: + * + *

+ * byte mydata[];
+ * BASE64Decoder base64 = new BASE64Decoder();
+ *
+ * mydata = base64.decodeBuffer(bufferString);
+ * 
+ * + * This will decode the String in bufferString and give you an array of + * bytes in the array myData. + * + * On errors, this class throws a CEFormatException with the following detail + * strings: + * + *
+ * "BASE64Decoder: Not enough bytes for an atom."
+ * 
+ * + * @author Chuck McManis + * @see CharacterEncoder + * @see BASE64Decoder + */ + +public class BASE64Decoder extends CharacterDecoder { + + /** This class has 4 bytes per atom */ + protected int bytesPerAtom() { + return (4); + } + + /** Any multiple of 4 will do, 72 might be common */ + protected int bytesPerLine() { + return (72); + } + + /** + * This character array provides the character to value map based on RFC1521. + */ + private final static char pem_array[] = { + // 0 1 2 3 4 5 6 7 + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 1 + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 2 + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 3 + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 4 + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 5 + 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 6 + '4', '5', '6', '7', '8', '9', '+', '/' // 7 + }; + + private final static byte pem_convert_array[] = new byte[256]; + + static { + for (int i = 0; i < 255; i++) { + pem_convert_array[i] = -1; + } + for (int i = 0; i < pem_array.length; i++) { + pem_convert_array[pem_array[i]] = (byte) i; + } + } + + byte decode_buffer[] = new byte[4]; + + /** + * Decode one BASE64 atom into 1, 2, or 3 bytes of data. + */ + protected void decodeAtom(PushbackInputStream inStream, + OutputStream outStream, int rem) throws java.io.IOException { + int i; + byte a = -1, b = -1, c = -1, d = -1; + + if (rem < 2) { + throw new CEFormatException( + "BASE64Decoder: Not enough bytes for an atom."); + } + do { + i = inStream.read(); + if (i == -1) { + throw new CEStreamExhausted(); + } + } while (i == '\n' || i == '\r'); + decode_buffer[0] = (byte) i; + + i = readFully(inStream, decode_buffer, 1, rem - 1); + if (i == -1) { + throw new CEStreamExhausted(); + } + + if (rem > 3 && decode_buffer[3] == '=') { + rem = 3; + } + if (rem > 2 && decode_buffer[2] == '=') { + rem = 2; + } + switch (rem) { + case 4: + d = pem_convert_array[decode_buffer[3] & 0xff]; + // NOBREAK + case 3: + c = pem_convert_array[decode_buffer[2] & 0xff]; + // NOBREAK + case 2: + b = pem_convert_array[decode_buffer[1] & 0xff]; + a = pem_convert_array[decode_buffer[0] & 0xff]; + break; + } + + switch (rem) { + case 2: + outStream.write((byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3))); + break; + case 3: + outStream.write((byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3))); + outStream.write((byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf))); + break; + case 4: + outStream.write((byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3))); + outStream.write((byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf))); + outStream.write((byte) (((c << 6) & 0xc0) | (d & 0x3f))); + break; + } + return; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Encoder.java b/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Encoder.java new file mode 100644 index 0000000..da7cce7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/BASE64Encoder.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.OutputStream; +import java.io.InputStream; +import java.io.PrintStream; +import java.io.IOException; + +/** + * This class implements a BASE64 Character encoder as specified in RFC1521. + * This RFC is part of the MIME specification as published by the Internet + * Engineering Task Force (IETF). Unlike some other encoding schemes there is + * nothing in this encoding that indicates where a buffer starts or ends. + * + * This means that the encoded text will simply start with the first line of + * encoded text and end with the last line of encoded text. + * + * @version 1.23, 11/17/05 + * @author Chuck McManis + * @see CharacterEncoder + * @see BASE64Decoder + */ + +public class BASE64Encoder extends CharacterEncoder { + + /** this class encodes three bytes per atom. */ + protected int bytesPerAtom() { + return (3); + } + + /** + * this class encodes 57 bytes per line. This results in a maximum of 57/3 * 4 + * or 76 characters per output line. Not counting the line termination. + */ + protected int bytesPerLine() { + return (57); + } + + /** This array maps the characters to their 6 bit values */ + private final static char pem_array[] = { + // 0 1 2 3 4 5 6 7 + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 1 + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 2 + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 3 + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 4 + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 5 + 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 6 + '4', '5', '6', '7', '8', '9', '+', '/' // 7 + }; + + /** + * encodeAtom - Take three bytes of input and encode it as 4 printable + * characters. Note that if the length in len is less than three is encodes + * either one or two '=' signs to indicate padding characters. + */ + protected void encodeAtom(OutputStream outStream, byte data[], int offset, + int len) throws IOException { + byte a, b, c; + + if (len == 1) { + a = data[offset]; + b = 0; + c = 0; + outStream.write(pem_array[(a >>> 2) & 0x3F]); + outStream.write(pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]); + outStream.write('='); + outStream.write('='); + } else if (len == 2) { + a = data[offset]; + b = data[offset + 1]; + c = 0; + outStream.write(pem_array[(a >>> 2) & 0x3F]); + outStream.write(pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]); + outStream.write(pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]); + outStream.write('='); + } else { + a = data[offset]; + b = data[offset + 1]; + c = data[offset + 2]; + outStream.write(pem_array[(a >>> 2) & 0x3F]); + outStream.write(pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]); + outStream.write(pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]); + outStream.write(pem_array[c & 0x3F]); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/CEFormatException.java b/tck/old-tck/source/src/com/sun/ts/lib/util/CEFormatException.java new file mode 100644 index 0000000..fab3c35 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/CEFormatException.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.IOException; + +public class CEFormatException extends IOException { + public CEFormatException(String s) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/CEStreamExhausted.java b/tck/old-tck/source/src/com/sun/ts/lib/util/CEStreamExhausted.java new file mode 100644 index 0000000..1b5ffcc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/CEStreamExhausted.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.IOException; + +/** This exception is thrown when EOF is reached */ +public class CEStreamExhausted extends IOException { +}; diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterDecoder.java b/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterDecoder.java new file mode 100644 index 0000000..a80ff7c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterDecoder.java @@ -0,0 +1,223 @@ +/* + * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.OutputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.PushbackInputStream; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.nio.ByteBuffer; + +/** + * This class defines the decoding half of character encoders. A character + * decoder is an algorithim for transforming 8 bit binary data that has been + * encoded into text by a character encoder, back into original binary form. + * + * The character encoders, in general, have been structured around a central + * theme that binary data can be encoded into text that has the form: + * + *
+ *      [Buffer Prefix]
+ *      [Line Prefix][encoded data atoms][Line Suffix]
+ *      [Buffer Suffix]
+ * 
+ * + * Of course in the simplest encoding schemes, the buffer has no distinct prefix + * of suffix, however all have some fixed relationship between the text in an + * 'atom' and the binary data itself. + * + * In the CharacterEncoder and CharacterDecoder classes, one complete chunk of + * data is referred to as a buffer. Encoded buffers are all text, and + * decoded buffers (sometimes just referred to as buffers) are binary octets. + * + * To create a custom decoder, you must, at a minimum, overide three abstract + * methods in this class. + *
+ *
bytesPerAtom which tells the decoder how many bytes to expect from + * decodeAtom + *
decodeAtom which decodes the bytes sent to it as text. + *
bytesPerLine which tells the encoder the maximum number of bytes per + * line. + *
+ * + * In general, the character decoders return error in the form of a + * CEFormatException. The syntax of the detail string is + * + *
+ *      DecoderClassName: Error message.
+ * 
+ * + * Several useful decoders have already been written and are referenced in the + * See Also list below. + * + * @author Chuck McManis + * @see CEFormatException + * @see CharacterEncoder + * @see UCDecoder + * @see UUDecoder + * @see BASE64Decoder + */ + +public abstract class CharacterDecoder { + + /** Return the number of bytes per atom of decoding */ + abstract protected int bytesPerAtom(); + + /** Return the maximum number of bytes that can be encoded per line */ + abstract protected int bytesPerLine(); + + /** decode the beginning of the buffer, by default this is a NOP. */ + protected void decodeBufferPrefix(PushbackInputStream aStream, + OutputStream bStream) throws IOException { + } + + /** decode the buffer suffix, again by default it is a NOP. */ + protected void decodeBufferSuffix(PushbackInputStream aStream, + OutputStream bStream) throws IOException { + } + + /** + * This method should return, if it knows, the number of bytes that will be + * decoded. Many formats such as uuencoding provide this information. By + * default we return the maximum bytes that could have been encoded on the + * line. + */ + protected int decodeLinePrefix(PushbackInputStream aStream, + OutputStream bStream) throws IOException { + return (bytesPerLine()); + } + + /** + * This method post processes the line, if there are error detection or + * correction codes in a line, they are generally processed by this method. + * The simplest version of this method looks for the (newline) character. + */ + protected void decodeLineSuffix(PushbackInputStream aStream, + OutputStream bStream) throws IOException { + } + + /** + * This method does an actual decode. It takes the decoded bytes and writes + * them to the OutputStream. The integer l tells the method how many + * bytes are required. This is always <= bytesPerAtom(). + */ + protected void decodeAtom(PushbackInputStream aStream, OutputStream bStream, + int l) throws IOException { + throw new CEStreamExhausted(); + } + + /** + * This method works around the bizarre semantics of BufferedInputStream's + * read method. + */ + protected int readFully(InputStream in, byte buffer[], int offset, int len) + throws java.io.IOException { + for (int i = 0; i < len; i++) { + int q = in.read(); + if (q == -1) + return ((i == 0) ? -1 : i); + buffer[i + offset] = (byte) q; + } + return len; + } + + /** + * Decode the text from the InputStream and write the decoded octets to the + * OutputStream. This method runs until the stream is exhausted. + * + * @exception CEFormatException + * An error has occured while decoding + * @exception CEStreamExhausted + * The input stream is unexpectedly out of data + */ + public void decodeBuffer(InputStream aStream, OutputStream bStream) + throws IOException { + int i; + int totalBytes = 0; + + PushbackInputStream ps = new PushbackInputStream(aStream); + decodeBufferPrefix(ps, bStream); + while (true) { + int length; + + try { + length = decodeLinePrefix(ps, bStream); + for (i = 0; (i + bytesPerAtom()) < length; i += bytesPerAtom()) { + decodeAtom(ps, bStream, bytesPerAtom()); + totalBytes += bytesPerAtom(); + } + if ((i + bytesPerAtom()) == length) { + decodeAtom(ps, bStream, bytesPerAtom()); + totalBytes += bytesPerAtom(); + } else { + decodeAtom(ps, bStream, length - i); + totalBytes += (length - i); + } + decodeLineSuffix(ps, bStream); + } catch (CEStreamExhausted e) { + break; + } + } + decodeBufferSuffix(ps, bStream); + } + + /** + * Alternate decode interface that takes a String containing the encoded + * buffer and returns a byte array containing the data. + * + * @exception CEFormatException + * An error has occured while decoding + */ + public byte decodeBuffer(String inputString)[] throws IOException { + byte inputBuffer[] = new byte[inputString.length()]; + ByteArrayInputStream inStream; + ByteArrayOutputStream outStream; + + inputString.getBytes(0, inputString.length(), inputBuffer, 0); + inStream = new ByteArrayInputStream(inputBuffer); + outStream = new ByteArrayOutputStream(); + decodeBuffer(inStream, outStream); + return (outStream.toByteArray()); + } + + /** + * Decode the contents of the inputstream into a buffer. + */ + public byte decodeBuffer(InputStream in)[] throws IOException { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + decodeBuffer(in, outStream); + return (outStream.toByteArray()); + } + + /** + * Decode the contents of the String into a ByteBuffer. + */ + public ByteBuffer decodeBufferToByteBuffer(String inputString) + throws IOException { + return ByteBuffer.wrap(decodeBuffer(inputString)); + } + + /** + * Decode the contents of the inputStream into a ByteBuffer. + */ + public ByteBuffer decodeBufferToByteBuffer(InputStream in) + throws IOException { + return ByteBuffer.wrap(decodeBuffer(in)); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterEncoder.java b/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterEncoder.java new file mode 100644 index 0000000..8df650e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/CharacterEncoder.java @@ -0,0 +1,340 @@ +/* + * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.OutputStream; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.io.IOException; +import java.nio.ByteBuffer; + +/** + * This class defines the encoding half of character encoders. A character + * encoder is an algorithim for transforming 8 bit binary data into text + * (generally 7 bit ASCII or 8 bit ISO-Latin-1 text) for transmition over text + * channels such as e-mail and network news. + * + * The character encoders have been structured around a central theme that, in + * general, the encoded text has the form: + * + *
+ *	[Buffer Prefix]
+ *	[Line Prefix][encoded data atoms][Line Suffix]
+ *	[Buffer Suffix]
+ * 
+ * + * In the CharacterEncoder and CharacterDecoder classes, one complete chunk of + * data is referred to as a buffer. Encoded buffers are all text, and + * decoded buffers (sometimes just referred to as buffers) are binary octets. + * + * To create a custom encoder, you must, at a minimum, overide three abstract + * methods in this class. + *
+ *
bytesPerAtom which tells the encoder how many bytes to send to encodeAtom + *
encodeAtom which encodes the bytes sent to it as text. + *
bytesPerLine which tells the encoder the maximum number of bytes per + * line. + *
+ * + * Several useful encoders have already been written and are referenced in the + * See Also list below. + * + * @version 1.38, 11/17/05 + * @author Chuck McManis + * @see CharacterDecoder; + * @see UCEncoder + * @see UUEncoder + * @see BASE64Encoder + */ +public abstract class CharacterEncoder { + + /** Stream that understands "printing" */ + protected PrintStream pStream; + + /** Return the number of bytes per atom of encoding */ + abstract protected int bytesPerAtom(); + + /** Return the number of bytes that can be encoded per line */ + abstract protected int bytesPerLine(); + + /** + * Encode the prefix for the entire buffer. By default is simply opens the + * PrintStream for use by the other functions. + */ + protected void encodeBufferPrefix(OutputStream aStream) throws IOException { + pStream = new PrintStream(aStream); + } + + /** + * Encode the suffix for the entire buffer. + */ + protected void encodeBufferSuffix(OutputStream aStream) throws IOException { + } + + /** + * Encode the prefix that starts every output line. + */ + protected void encodeLinePrefix(OutputStream aStream, int aLength) + throws IOException { + } + + /** + * Encode the suffix that ends every output line. By default this method just + * prints a into the output stream. + */ + protected void encodeLineSuffix(OutputStream aStream) throws IOException { + pStream.println(); + } + + /** Encode one "atom" of information into characters. */ + abstract protected void encodeAtom(OutputStream aStream, byte someBytes[], + int anOffset, int aLength) throws IOException; + + /** + * This method works around the bizarre semantics of BufferedInputStream's + * read method. + */ + protected int readFully(InputStream in, byte buffer[]) + throws java.io.IOException { + for (int i = 0; i < buffer.length; i++) { + int q = in.read(); + if (q == -1) + return i; + buffer[i] = (byte) q; + } + return buffer.length; + } + + /** + * Encode bytes from the input stream, and write them as text characters to + * the output stream. This method will run until it exhausts the input stream, + * but does not print the line suffix for a final line that is shorter than + * bytesPerLine(). + */ + public void encode(InputStream inStream, OutputStream outStream) + throws IOException { + int j; + int numBytes; + byte tmpbuffer[] = new byte[bytesPerLine()]; + + encodeBufferPrefix(outStream); + + while (true) { + numBytes = readFully(inStream, tmpbuffer); + if (numBytes == 0) { + break; + } + encodeLinePrefix(outStream, numBytes); + for (j = 0; j < numBytes; j += bytesPerAtom()) { + + if ((j + bytesPerAtom()) <= numBytes) { + encodeAtom(outStream, tmpbuffer, j, bytesPerAtom()); + } else { + encodeAtom(outStream, tmpbuffer, j, (numBytes) - j); + } + } + if (numBytes < bytesPerLine()) { + break; + } else { + encodeLineSuffix(outStream); + } + } + encodeBufferSuffix(outStream); + } + + /** + * Encode the buffer in aBuffer and write the encoded result to the + * OutputStream aStream. + */ + public void encode(byte aBuffer[], OutputStream aStream) throws IOException { + ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); + encode(inStream, aStream); + } + + /** + * A 'streamless' version of encode that simply takes a buffer of bytes and + * returns a string containing the encoded buffer. + */ + public String encode(byte aBuffer[]) { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); + String retVal = null; + try { + encode(inStream, outStream); + // explicit ascii->unicode conversion + retVal = outStream.toString("8859_1"); + } catch (Exception IOException) { + // This should never happen. + throw new Error("CharacterEncoder.encode internal error"); + } + return (retVal); + } + + /** + * Return a byte array from the remaining bytes in this ByteBuffer. + *

+ * The ByteBuffer's position will be advanced to ByteBuffer's limit. + *

+ * To avoid an extra copy, the implementation will attempt to return the byte + * array backing the ByteBuffer. If this is not possible, a new byte array + * will be created. + */ + private byte[] getBytes(ByteBuffer bb) { + /* + * This should never return a BufferOverflowException, as we're careful to + * allocate just the right amount. + */ + byte[] buf = null; + + /* + * If it has a usable backing byte buffer, use it. Use only if the array + * exactly represents the current ByteBuffer. + */ + if (bb.hasArray()) { + byte[] tmp = bb.array(); + if ((tmp.length == bb.capacity()) && (tmp.length == bb.remaining())) { + buf = tmp; + bb.position(bb.limit()); + } + } + + if (buf == null) { + /* + * This class doesn't have a concept of encode(buf, len, off), so if we + * have a partial buffer, we must reallocate space. + */ + buf = new byte[bb.remaining()]; + + /* + * position() automatically updated + */ + bb.get(buf); + } + + return buf; + } + + /** + * Encode the aBuffer ByteBuffer and write the encoded result to the + * OutputStream aStream. + *

+ * The ByteBuffer's position will be advanced to ByteBuffer's limit. + */ + public void encode(ByteBuffer aBuffer, OutputStream aStream) + throws IOException { + byte[] buf = getBytes(aBuffer); + encode(buf, aStream); + } + + /** + * A 'streamless' version of encode that simply takes a ByteBuffer and returns + * a string containing the encoded buffer. + *

+ * The ByteBuffer's position will be advanced to ByteBuffer's limit. + */ + public String encode(ByteBuffer aBuffer) { + byte[] buf = getBytes(aBuffer); + return encode(buf); + } + + /** + * Encode bytes from the input stream, and write them as text characters to + * the output stream. This method will run until it exhausts the input stream. + * It differs from encode in that it will add the line at the end of a final + * line that is shorter than bytesPerLine(). + */ + public void encodeBuffer(InputStream inStream, OutputStream outStream) + throws IOException { + int j; + int numBytes; + byte tmpbuffer[] = new byte[bytesPerLine()]; + + encodeBufferPrefix(outStream); + + while (true) { + numBytes = readFully(inStream, tmpbuffer); + if (numBytes == 0) { + break; + } + encodeLinePrefix(outStream, numBytes); + for (j = 0; j < numBytes; j += bytesPerAtom()) { + if ((j + bytesPerAtom()) <= numBytes) { + encodeAtom(outStream, tmpbuffer, j, bytesPerAtom()); + } else { + encodeAtom(outStream, tmpbuffer, j, (numBytes) - j); + } + } + encodeLineSuffix(outStream); + if (numBytes < bytesPerLine()) { + break; + } + } + encodeBufferSuffix(outStream); + } + + /** + * Encode the buffer in aBuffer and write the encoded result to the + * OutputStream aStream. + */ + public void encodeBuffer(byte aBuffer[], OutputStream aStream) + throws IOException { + ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); + encodeBuffer(inStream, aStream); + } + + /** + * A 'streamless' version of encode that simply takes a buffer of bytes and + * returns a string containing the encoded buffer. + */ + public String encodeBuffer(byte aBuffer[]) { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); + try { + encodeBuffer(inStream, outStream); + } catch (Exception IOException) { + // This should never happen. + throw new Error("CharacterEncoder.encodeBuffer internal error"); + } + return (outStream.toString()); + } + + /** + * Encode the aBuffer ByteBuffer and write the encoded result to the + * OutputStream aStream. + *

+ * The ByteBuffer's position will be advanced to ByteBuffer's limit. + */ + public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream) + throws IOException { + byte[] buf = getBytes(aBuffer); + encodeBuffer(buf, aStream); + } + + /** + * A 'streamless' version of encode that simply takes a ByteBuffer and returns + * a string containing the encoded buffer. + *

+ * The ByteBuffer's position will be advanced to ByteBuffer's limit. + */ + public String encodeBuffer(ByteBuffer aBuffer) { + byte[] buf = getBytes(aBuffer); + return encodeBuffer(buf); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/ConfigUtil.java b/tck/old-tck/source/src/com/sun/ts/lib/util/ConfigUtil.java new file mode 100644 index 0000000..248a1c0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/ConfigUtil.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +import java.util.*; +import java.io.*; + +public class ConfigUtil { + public final static File PROPS_DIR = new File( + System.getProperty("TS_HOME", System.getProperty("ts.home")) + + File.separator + "src" + File.separator + "com" + File.separator + + "sun" + File.separator + "ts" + File.separator + "lib", + "harness"); + + public final static File SRC_DIR = new File( + System.getProperty("TS_HOME", System.getProperty("ts.home")), "src"); + + public final static String INTEROP_DIRECTION_PROP_FILE_NAME = "interop-direction.properties"; + + public static String[] getMappingValue(Properties mapping, String[] keys, + String relativePath) { + String forwardSlashRelativePath = relativePath.replace(File.separator, "/"); + + for (int i = keys.length - 1; i >= 0; i--) { // must traverse in reverse + // order. + if (forwardSlashRelativePath.startsWith(keys[i])) { + return stringToArray(mapping.getProperty(keys[i])); + } + } + return TestUtil.EMPTY_STRING_ARRAY; + } + + public static String[] loadKeysFrom(Properties mapping) { + String[] keys = null; + if (mapping != null) { + keys = new String[mapping.size()]; + int i = 0; + for (Enumeration enum1 = mapping.keys(); enum1.hasMoreElements(); i++) { + keys[i] = (String) enum1.nextElement(); + } + Arrays.sort(keys); + } + return keys; + } + + public static String[] stringToArray(String s) { + if (s == null) { + return TestUtil.EMPTY_STRING_ARRAY; + } + StringTokenizer st = new StringTokenizer(s, " ,;\t\r\n\f"); + int tokenCount = st.countTokens(); + if (tokenCount == 0) { + return TestUtil.EMPTY_STRING_ARRAY; + } + String[] result = new String[tokenCount]; + for (int i = 0; st.hasMoreTokens(); i++) { + result[i] = st.nextToken(); + } + return result; + } + + public static Properties loadPropertiesFor(String propFileName) { + File propFile; + + // always load vehicle.properties from under src + if (propFileName.equals("vehicle.properties")) { + propFile = new File(SRC_DIR, propFileName); + } else { + propFile = new File(PROPS_DIR, propFileName); + } + + Properties props = null; + String propPath = propFile.getPath(); + if (propFile.exists()) { + props = new Properties(); + try { + System.out.println("Loading " + propPath); + props.load(new FileInputStream(propFile)); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + return props; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/DoubleConsts.java b/tck/old-tck/source/src/com/sun/ts/lib/util/DoubleConsts.java new file mode 100644 index 0000000..b15ed32 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/DoubleConsts.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +/** + * This class contains additional constants documenting limits of the + * double type. + * + * @author Joseph D. Darcy + */ + +public class DoubleConsts { + /** + * Don't let anyone instantiate this class. + */ + private DoubleConsts() { + } + + public static final double POSITIVE_INFINITY = java.lang.Double.POSITIVE_INFINITY; + + public static final double NEGATIVE_INFINITY = java.lang.Double.NEGATIVE_INFINITY; + + public static final double NaN = java.lang.Double.NaN; + + public static final double MAX_VALUE = java.lang.Double.MAX_VALUE; + + public static final double MIN_VALUE = java.lang.Double.MIN_VALUE; + + /** + * A constant holding the smallest positive normal value of type + * double, 2-1022. It is equal to the value returned + * by Double.longBitsToDouble(0x0010000000000000L). + * + * @since 1.5 + */ + public static final double MIN_NORMAL = 2.2250738585072014E-308; + + /** + * The number of logical bits in the significand of a double + * number, including the implicit bit. + */ + public static final int SIGNIFICAND_WIDTH = 53; + + /** + * Maximum exponent a finite double number may have. It is equal + * to the value returned by Math.ilogb(Double.MAX_VALUE). + */ + public static final int MAX_EXPONENT = 1023; + + /** + * Minimum exponent a normalized double number may have. It is + * equal to the value returned by Math.ilogb(Double.MIN_NORMAL). + */ + public static final int MIN_EXPONENT = -1022; + + /** + * The exponent the smallest positive double subnormal value + * would have if it could be normalized. It is equal to the value returned by + * FpUtils.ilogb(Double.MIN_VALUE). + */ + public static final int MIN_SUB_EXPONENT = MIN_EXPONENT + - (SIGNIFICAND_WIDTH - 1); + + /** + * Bias used in representing a double exponent. + */ + public static final int EXP_BIAS = 1023; + + /** + * Bit mask to isolate the sign bit of a double. + */ + public static final long SIGN_BIT_MASK = 0x8000000000000000L; + + /** + * Bit mask to isolate the exponent field of a double. + */ + public static final long EXP_BIT_MASK = 0x7FF0000000000000L; + + /** + * Bit mask to isolate the significand field of a double. + */ + public static final long SIGNIF_BIT_MASK = 0x000FFFFFFFFFFFFFL; + + static { + // verify bit masks cover all bit positions and that the bit + // masks are non-overlapping + assert (((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0L) + && (((SIGN_BIT_MASK & EXP_BIT_MASK) == 0L) + && ((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0L) + && ((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0L))); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/FloatConsts.java b/tck/old-tck/source/src/com/sun/ts/lib/util/FloatConsts.java new file mode 100644 index 0000000..4ce9b15 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/FloatConsts.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +/** + * This class contains additional constants documenting limits of the + * float type. + * + * @author Joseph D. Darcy + */ + +public class FloatConsts { + /** + * Don't let anyone instantiate this class. + */ + private FloatConsts() { + } + + public static final float POSITIVE_INFINITY = java.lang.Float.POSITIVE_INFINITY; + + public static final float NEGATIVE_INFINITY = java.lang.Float.NEGATIVE_INFINITY; + + public static final float NaN = java.lang.Float.NaN; + + public static final float MAX_VALUE = java.lang.Float.MAX_VALUE; + + public static final float MIN_VALUE = java.lang.Float.MIN_VALUE; + + /** + * A constant holding the smallest positive normal value of type + * float, 2-126. It is equal to the value returned by + * Float.intBitsToFloat(0x00800000). + */ + public static final float MIN_NORMAL = 1.17549435E-38f; + + /** + * The number of logical bits in the significand of a float + * number, including the implicit bit. + */ + public static final int SIGNIFICAND_WIDTH = 24; + + /** + * Maximum exponent a finite float number may have. It is equal + * to the value returned by Math.ilogb(Float.MAX_VALUE). + */ + public static final int MAX_EXPONENT = 127; + + /** + * Minimum exponent a normalized float number may have. It is + * equal to the value returned by Math.ilogb(Float.MIN_NORMAL). + */ + public static final int MIN_EXPONENT = -126; + + /** + * The exponent the smallest positive float subnormal value would + * have if it could be normalized. It is equal to the value returned by + * FpUtils.ilogb(Float.MIN_VALUE). + */ + public static final int MIN_SUB_EXPONENT = MIN_EXPONENT + - (SIGNIFICAND_WIDTH - 1); + + /** + * Bias used in representing a float exponent. + */ + public static final int EXP_BIAS = 127; + + /** + * Bit mask to isolate the sign bit of a float. + */ + public static final int SIGN_BIT_MASK = 0x80000000; + + /** + * Bit mask to isolate the exponent field of a float. + */ + public static final int EXP_BIT_MASK = 0x7F800000; + + /** + * Bit mask to isolate the significand field of a float. + */ + public static final int SIGNIF_BIT_MASK = 0x007FFFFF; + + static { + // verify bit masks cover all bit positions and that the bit + // masks are non-overlapping + assert (((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0) + && (((SIGN_BIT_MASK & EXP_BIT_MASK) == 0) + && ((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0) + && ((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0))); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/FpUtils.java b/tck/old-tck/source/src/com/sun/ts/lib/util/FpUtils.java new file mode 100644 index 0000000..e7b8c98 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/FpUtils.java @@ -0,0 +1,1166 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util; + +import com.sun.ts.lib.util.FloatConsts; +import com.sun.ts.lib.util.DoubleConsts; + +/** + * The class {@code FpUtils} contains static utility methods for manipulating + * and inspecting {@code float} and {@code double} floating-point numbers. These + * methods include functionality recommended or required by the IEEE 754 + * floating-point standard. + * + * @author Joseph D. Darcy + */ + +public class FpUtils { + /* + * The methods in this class are reasonably implemented using direct or + * indirect bit-level manipulation of floating-point values. However, having + * access to the IEEE 754 recommended functions would obviate the need for + * most programmers to engage in floating-point bit-twiddling. + * + * An IEEE 754 number has three fields, from most significant bit to to least + * significant, sign, exponent, and significand. + * + * msb lsb [sign|exponent| fractional_significand] + * + * Using some encoding cleverness, explained below, the high order bit of the + * logical significand does not need to be explicitly stored, thus + * "fractional_significand" instead of simply "significand" in the figure + * above. + * + * For finite normal numbers, the numerical value encoded is + * + * (-1)^sign * 2^(exponent)*(1.fractional_significand) + * + * Most finite floating-point numbers are normalized; the exponent value is + * reduced until the leading significand bit is 1. Therefore, the leading 1 is + * redundant and is not explicitly stored. If a numerical value is so small it + * cannot be normalized, it has a subnormal representation. Subnormal numbers + * don't have a leading 1 in their significand; subnormals are encoding using + * a special exponent value. In other words, the high-order bit of the logical + * significand can be elided in from the representation in either case since + * the bit's value is implicit from the exponent value. + * + * The exponent field uses a biased representation; if the bits of the + * exponent are interpreted as a unsigned integer E, the exponent represented + * is E - E_bias where E_bias depends on the floating-point format. E can + * range between E_min and E_max, constants which depend on the floating-point + * format. E_min and E_max are -126 and +127 for float, -1022 and +1023 for + * double. + * + * The 32-bit float format has 1 sign bit, 8 exponent bits, and 23 bits for + * the significand (which is logically 24 bits wide because of the implicit + * bit). The 64-bit double format has 1 sign bit, 11 exponent bits, and 52 + * bits for the significand (logically 53 bits). + * + * Subnormal numbers and zero have the special exponent value E_min -1; the + * numerical value represented by a subnormal is: + * + * (-1)^sign * 2^(E_min)*(0.fractional_significand) + * + * Zero is represented by all zero bits in the exponent and all zero bits in + * the significand; zero can have either sign. + * + * Infinity and NaN are encoded using the exponent value E_max + 1. Signed + * infinities have all significand bits zero; NaNs have at least one non-zero + * significand bit. + * + * The details of IEEE 754 floating-point encoding will be used in the methods + * below without further comment. For further exposition on IEEE 754 numbers, + * see "IEEE Standard for Binary Floating-Point Arithmetic" ANSI/IEEE Std + * 754-1985 or William Kahan's "Lecture Notes on the Status of IEEE Standard + * 754 for Binary Floating-Point Arithmetic", + * http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps. + * + * Many of this class's methods are members of the set of IEEE 754 recommended + * functions or similar functions recommended or required by IEEE 754R. + * Discussion of various implementation techniques for these functions have + * occurred in: + * + * W.J. Cody and Jerome T. Coonen, "Algorithm 772 Functions to Support the + * IEEE Standard for Binary Floating-Point Arithmetic," ACM Transactions on + * Mathematical Software, vol. 19, no. 4, December 1993, pp. 443-451. + * + * Joseph D. Darcy, "Writing robust IEEE recommended functions in ``100% Pure + * Java''(TM)," University of California, Berkeley technical report + * UCB//CSD-98-1009. + */ + + /** + * Don't let anyone instantiate this class. + */ + private FpUtils() { + } + + // Constants used in scalb + static double twoToTheDoubleScaleUp = powerOfTwoD(512); + + static double twoToTheDoubleScaleDown = powerOfTwoD(-512); + + // Helper Methods + + // The following helper methods are used in the implementation of + // the public recommended functions; they generally omit certain + // tests for exception cases. + + /** + * Returns unbiased exponent of a {@code double}. + */ + public static int getExponent(double d) { + /* + * Bitwise convert d to long, mask out exponent bits, shift to the right and + * then subtract out double's bias adjust to get true exponent value. + */ + return (int) (((Double.doubleToRawLongBits(d) + & DoubleConsts.EXP_BIT_MASK) >> (DoubleConsts.SIGNIFICAND_WIDTH - 1)) + - DoubleConsts.EXP_BIAS); + } + + /** + * Returns unbiased exponent of a {@code float}. + */ + public static int getExponent(float f) { + /* + * Bitwise convert f to integer, mask out exponent bits, shift to the right + * and then subtract out float's bias adjust to get true exponent value + */ + return ((Float.floatToRawIntBits(f) + & FloatConsts.EXP_BIT_MASK) >> (FloatConsts.SIGNIFICAND_WIDTH - 1)) + - FloatConsts.EXP_BIAS; + } + + /** + * Returns a floating-point power of two in the normal range. + */ + static double powerOfTwoD(int n) { + assert (n >= DoubleConsts.MIN_EXPONENT && n <= DoubleConsts.MAX_EXPONENT); + return Double.longBitsToDouble((((long) n + + (long) DoubleConsts.EXP_BIAS) << (DoubleConsts.SIGNIFICAND_WIDTH - 1)) + & DoubleConsts.EXP_BIT_MASK); + } + + /** + * Returns a floating-point power of two in the normal range. + */ + static float powerOfTwoF(int n) { + assert (n >= FloatConsts.MIN_EXPONENT && n <= FloatConsts.MAX_EXPONENT); + return Float.intBitsToFloat( + ((n + FloatConsts.EXP_BIAS) << (FloatConsts.SIGNIFICAND_WIDTH - 1)) + & FloatConsts.EXP_BIT_MASK); + } + + /** + * Returns the first floating-point argument with the sign of the second + * floating-point argument. Note that unlike the + * {@link FpUtils#copySign(double, double) copySign} method, this method does + * not require NaN {@code sign} arguments to be treated as positive values; + * implementations are permitted to treat some NaN arguments as positive and + * other NaN arguments as negative to allow greater performance. + * + * @param magnitude + * the parameter providing the magnitude of the result + * @param sign + * the parameter providing the sign of the result + * @return a value with the magnitude of {@code magnitude} and the sign of + * {@code sign}. + * @author Joseph D. Darcy + */ + public static double rawCopySign(double magnitude, double sign) { + return Double.longBitsToDouble( + (Double.doubleToRawLongBits(sign) & (DoubleConsts.SIGN_BIT_MASK)) + | (Double.doubleToRawLongBits(magnitude) + & (DoubleConsts.EXP_BIT_MASK | DoubleConsts.SIGNIF_BIT_MASK))); + } + + /** + * Returns the first floating-point argument with the sign of the second + * floating-point argument. Note that unlike the + * {@link FpUtils#copySign(float, float) copySign} method, this method does + * not require NaN {@code sign} arguments to be treated as positive values; + * implementations are permitted to treat some NaN arguments as positive and + * other NaN arguments as negative to allow greater performance. + * + * @param magnitude + * the parameter providing the magnitude of the result + * @param sign + * the parameter providing the sign of the result + * @return a value with the magnitude of {@code magnitude} and the sign of + * {@code sign}. + * @author Joseph D. Darcy + */ + public static float rawCopySign(float magnitude, float sign) { + return Float.intBitsToFloat( + (Float.floatToRawIntBits(sign) & (FloatConsts.SIGN_BIT_MASK)) + | (Float.floatToRawIntBits(magnitude) + & (FloatConsts.EXP_BIT_MASK | FloatConsts.SIGNIF_BIT_MASK))); + } + + /* ***************************************************************** */ + + /** + * Returns {@code true} if the argument is a finite floating-point value; + * returns {@code false} otherwise (for NaN and infinity arguments). + * + * @param d + * the {@code double} value to be tested + * @return {@code true} if the argument is a finite floating-point value, + * {@code false} otherwise. + */ + public static boolean isFinite(double d) { + return Math.abs(d) <= DoubleConsts.MAX_VALUE; + } + + /** + * Returns {@code true} if the argument is a finite floating-point value; + * returns {@code false} otherwise (for NaN and infinity arguments). + * + * @param f + * the {@code float} value to be tested + * @return {@code true} if the argument is a finite floating-point value, + * {@code false} otherwise. + */ + public static boolean isFinite(float f) { + return Math.abs(f) <= FloatConsts.MAX_VALUE; + } + + /** + * Returns {@code true} if the specified number is infinitely large in + * magnitude, {@code false} otherwise. + * + *

+ * Note that this method is equivalent to the {@link Double#isInfinite(double) + * Double.isInfinite} method; the functionality is included in this class for + * convenience. + * + * @param d + * the value to be tested. + * @return {@code true} if the value of the argument is positive infinity or + * negative infinity; {@code false} otherwise. + */ + public static boolean isInfinite(double d) { + return Double.isInfinite(d); + } + + /** + * Returns {@code true} if the specified number is infinitely large in + * magnitude, {@code false} otherwise. + * + *

+ * Note that this method is equivalent to the {@link Float#isInfinite(float) + * Float.isInfinite} method; the functionality is included in this class for + * convenience. + * + * @param f + * the value to be tested. + * @return {@code true} if the argument is positive infinity or negative + * infinity; {@code false} otherwise. + */ + public static boolean isInfinite(float f) { + return Float.isInfinite(f); + } + + /** + * Returns {@code true} if the specified number is a Not-a-Number (NaN) value, + * {@code false} otherwise. + * + *

+ * Note that this method is equivalent to the {@link Double#isNaN(double) + * Double.isNaN} method; the functionality is included in this class for + * convenience. + * + * @param d + * the value to be tested. + * @return {@code true} if the value of the argument is NaN; {@code false} + * otherwise. + */ + public static boolean isNaN(double d) { + return Double.isNaN(d); + } + + /** + * Returns {@code true} if the specified number is a Not-a-Number (NaN) value, + * {@code false} otherwise. + * + *

+ * Note that this method is equivalent to the {@link Float#isNaN(float) + * Float.isNaN} method; the functionality is included in this class for + * convenience. + * + * @param f + * the value to be tested. + * @return {@code true} if the argument is NaN; {@code false} otherwise. + */ + public static boolean isNaN(float f) { + return Float.isNaN(f); + } + + /** + * Returns {@code true} if the unordered relation holds between the two + * arguments. When two floating-point values are unordered, one value is + * neither less than, equal to, nor greater than the other. For the unordered + * relation to be true, at least one argument must be a {@code NaN}. + * + * @param arg1 + * the first argument + * @param arg2 + * the second argument + * @return {@code true} if at least one argument is a NaN, {@code false} + * otherwise. + */ + public static boolean isUnordered(double arg1, double arg2) { + return isNaN(arg1) || isNaN(arg2); + } + + /** + * Returns {@code true} if the unordered relation holds between the two + * arguments. When two floating-point values are unordered, one value is + * neither less than, equal to, nor greater than the other. For the unordered + * relation to be true, at least one argument must be a {@code NaN}. + * + * @param arg1 + * the first argument + * @param arg2 + * the second argument + * @return {@code true} if at least one argument is a NaN, {@code false} + * otherwise. + */ + public static boolean isUnordered(float arg1, float arg2) { + return isNaN(arg1) || isNaN(arg2); + } + + /** + * Returns unbiased exponent of a {@code double}; for subnormal values, the + * number is treated as if it were normalized. That is for all finite, + * non-zero, positive numbers x, + * scalb(x, -ilogb(x)) is always in the range [1, + * 2). + *

+ * Special cases: + *

    + *
  • If the argument is NaN, then the result is 230. + *
  • If the argument is infinite, then the result is 228. + *
  • If the argument is zero, then the result is -(228). + *
+ * + * @param d + * floating-point number whose exponent is to be extracted + * @return unbiased exponent of the argument. + * @author Joseph D. Darcy + */ + public static int ilogb(double d) { + int exponent = getExponent(d); + + switch (exponent) { + case DoubleConsts.MAX_EXPONENT + 1: // NaN or infinity + if (isNaN(d)) + return (1 << 30); // 2^30 + else // infinite value + return (1 << 28); // 2^28 + + case DoubleConsts.MIN_EXPONENT - 1: // zero or subnormal + if (d == 0.0) { + return -(1 << 28); // -(2^28) + } else { + long transducer = Double.doubleToRawLongBits(d); + + /* + * To avoid causing slow arithmetic on subnormals, the scaling to + * determine when d's significand is normalized is done in integer + * arithmetic. (there must be at least one "1" bit in the significand + * since zero has been screened out. + */ + + // isolate significand bits + transducer &= DoubleConsts.SIGNIF_BIT_MASK; + assert (transducer != 0L); + + // This loop is simple and functional. We might be + // able to do something more clever that was faster; + // e.g. number of leading zero detection on + // (transducer << (# exponent and sign bits). + while (transducer < (1L << (DoubleConsts.SIGNIFICAND_WIDTH - 1))) { + transducer *= 2; + exponent--; + } + exponent++; + assert (exponent >= DoubleConsts.MIN_EXPONENT + - (DoubleConsts.SIGNIFICAND_WIDTH - 1) + && exponent < DoubleConsts.MIN_EXPONENT); + return exponent; + } + + default: + assert (exponent >= DoubleConsts.MIN_EXPONENT + && exponent <= DoubleConsts.MAX_EXPONENT); + return exponent; + } + } + + /** + * Returns unbiased exponent of a {@code float}; for subnormal values, the + * number is treated as if it were normalized. That is for all finite, + * non-zero, positive numbers x, + * scalb(x, -ilogb(x)) is always in the range [1, + * 2). + *

+ * Special cases: + *

    + *
  • If the argument is NaN, then the result is 230. + *
  • If the argument is infinite, then the result is 228. + *
  • If the argument is zero, then the result is -(228). + *
+ * + * @param f + * floating-point number whose exponent is to be extracted + * @return unbiased exponent of the argument. + * @author Joseph D. Darcy + */ + public static int ilogb(float f) { + int exponent = getExponent(f); + + switch (exponent) { + case FloatConsts.MAX_EXPONENT + 1: // NaN or infinity + if (isNaN(f)) + return (1 << 30); // 2^30 + else // infinite value + return (1 << 28); // 2^28 + + case FloatConsts.MIN_EXPONENT - 1: // zero or subnormal + if (f == 0.0f) { + return -(1 << 28); // -(2^28) + } else { + int transducer = Float.floatToRawIntBits(f); + + /* + * To avoid causing slow arithmetic on subnormals, the scaling to + * determine when f's significand is normalized is done in integer + * arithmetic. (there must be at least one "1" bit in the significand + * since zero has been screened out. + */ + + // isolate significand bits + transducer &= FloatConsts.SIGNIF_BIT_MASK; + assert (transducer != 0); + + // This loop is simple and functional. We might be + // able to do something more clever that was faster; + // e.g. number of leading zero detection on + // (transducer << (# exponent and sign bits). + while (transducer < (1 << (FloatConsts.SIGNIFICAND_WIDTH - 1))) { + transducer *= 2; + exponent--; + } + exponent++; + assert (exponent >= FloatConsts.MIN_EXPONENT + - (FloatConsts.SIGNIFICAND_WIDTH - 1) + && exponent < FloatConsts.MIN_EXPONENT); + return exponent; + } + + default: + assert (exponent >= FloatConsts.MIN_EXPONENT + && exponent <= FloatConsts.MAX_EXPONENT); + return exponent; + } + } + + /* + * The scalb operation should be reasonably fast; however, there are tradeoffs + * in writing a method to minimize the worst case performance and writing a + * method to minimize the time for expected common inputs. Some processors + * operate very slowly on subnormal operands, taking hundreds or thousands of + * cycles for one floating-point add or multiply as opposed to, say, four + * cycles for normal operands. For processors with very slow subnormal + * execution, scalb would be fastest if written entirely with integer + * operations; in other words, scalb would need to include the logic of + * performing correct rounding of subnormal values. This could be reasonably + * done in at most a few hundred cycles. However, this approach may penalize + * normal operations since at least the exponent of the floating-point + * argument must be examined. + * + * The approach taken in this implementation is a compromise. Floating-point + * multiplication is used to do most of the work; but knowingly multiplying by + * a subnormal scaling factor is avoided. However, the floating-point argument + * is not examined to see whether or not it is subnormal since subnormal + * inputs are assumed to be rare. At most three multiplies are needed to scale + * from the largest to smallest exponent ranges (scaling down, at most two + * multiplies are needed if subnormal scaling factors are allowed). However, + * in this implementation an expensive integer remainder operation is avoided + * at the cost of requiring five floating-point multiplies in the worst case, + * which should still be a performance win. + * + * If scaling of entire arrays is a concern, it would probably be more + * efficient to provide a double[] scalb(double[], int) version of scalb to + * avoid having to recompute the needed scaling factors for each + * floating-point value. + */ + + /** + * Return {@code d} × 2{@code scale_factor} rounded as if + * performed by a single correctly rounded floating-point multiply to a member + * of the double value set. See section 4.2.3 of The Java™ + * Language Specification for a discussion of floating-point value + * sets. If the exponent of the result is between the {@code double}'s minimum + * exponent and maximum exponent, the answer is calculated exactly. If the + * exponent of the result would be larger than {@code doubles}'s maximum + * exponent, an infinity is returned. Note that if the result is subnormal, + * precision may be lost; that is, when {@code scalb(x, + * n)} is subnormal, {@code scalb(scalb(x, n), -n)} may not equal x. + * When the result is non-NaN, the result has the same sign as {@code d}. + * + *

+ * Special cases: + *

    + *
  • If the first argument is NaN, NaN is returned. + *
  • If the first argument is infinite, then an infinity of the same sign is + * returned. + *
  • If the first argument is zero, then a zero of the same sign is + * returned. + *
+ * + * @param d + * number to be scaled by a power of two. + * @param scale_factor + * power of 2 used to scale {@code d} + * @return {@code d * }2{@code scale_factor} + * @author Joseph D. Darcy + */ + public static double scalb(double d, int scale_factor) { + /* + * This method does not need to be declared strictfp to compute the same + * correct result on all platforms. When scaling up, it does not matter what + * order the multiply-store operations are done; the result will be finite + * or overflow regardless of the operation ordering. However, to get the + * correct result when scaling down, a particular ordering must be used. + * + * When scaling down, the multiply-store operations are sequenced so that it + * is not possible for two consecutive multiply-stores to return subnormal + * results. If one multiply-store result is subnormal, the next multiply + * will round it away to zero. This is done by first multiplying by 2 ^ + * (scale_factor % n) and then multiplying several times by by 2^n as needed + * where n is the exponent of number that is a covenient power of two. In + * this way, at most one real rounding error occurs. If the double value set + * is being used exclusively, the rounding will occur on a multiply. If the + * double-extended-exponent value set is being used, the products will + * (perhaps) be exact but the stores to d are guaranteed to round to the + * double value set. + * + * It is _not_ a valid implementation to first multiply d by 2^MIN_EXPONENT + * and then by 2 ^ (scale_factor % MIN_EXPONENT) since even in a strictfp + * program double rounding on underflow could occur; e.g. if the + * scale_factor argument was (MIN_EXPONENT - n) and the exponent of d was a + * little less than -(MIN_EXPONENT - n), meaning the final result would be + * subnormal. + * + * Since exact reproducibility of this method can be achieved without any + * undue performance burden, there is no compelling reason to allow double + * rounding on underflow in scalb. + */ + + // magnitude of a power of two so large that scaling a finite + // nonzero value by it would be guaranteed to over or + // underflow; due to rounding, scaling down takes takes an + // additional power of two which is reflected here + final int MAX_SCALE = DoubleConsts.MAX_EXPONENT + -DoubleConsts.MIN_EXPONENT + + DoubleConsts.SIGNIFICAND_WIDTH + 1; + int exp_adjust = 0; + int scale_increment = 0; + double exp_delta = Double.NaN; + + // Make sure scaling factor is in a reasonable range + + if (scale_factor < 0) { + scale_factor = Math.max(scale_factor, -MAX_SCALE); + scale_increment = -512; + exp_delta = twoToTheDoubleScaleDown; + } else { + scale_factor = Math.min(scale_factor, MAX_SCALE); + scale_increment = 512; + exp_delta = twoToTheDoubleScaleUp; + } + + // Calculate (scale_factor % +/-512), 512 = 2^9, using + // technique from "Hacker's Delight" section 10-2. + int t = (scale_factor >> 9 - 1) >>> 32 - 9; + exp_adjust = ((scale_factor + t) & (512 - 1)) - t; + + d *= powerOfTwoD(exp_adjust); + scale_factor -= exp_adjust; + + while (scale_factor != 0) { + d *= exp_delta; + scale_factor -= scale_increment; + } + return d; + } + + /** + * Return {@code f} × 2{@code scale_factor} rounded as if + * performed by a single correctly rounded floating-point multiply to a member + * of the float value set. See section 4.2.3 of The Java™ Language + * Specification for a discussion of floating-point value sets. If the + * exponent of the result is between the {@code float}'s minimum exponent and + * maximum exponent, the answer is calculated exactly. If the exponent of the + * result would be larger than {@code float}'s maximum exponent, an infinity + * is returned. Note that if the result is subnormal, precision may be lost; + * that is, when {@code scalb(x, n)} is subnormal, + * {@code scalb(scalb(x, n), -n)} may not equal x. When the result is + * non-NaN, the result has the same sign as {@code f}. + * + *

+ * Special cases: + *

    + *
  • If the first argument is NaN, NaN is returned. + *
  • If the first argument is infinite, then an infinity of the same sign is + * returned. + *
  • If the first argument is zero, then a zero of the same sign is + * returned. + *
+ * + * @param f + * number to be scaled by a power of two. + * @param scale_factor + * power of 2 used to scale {@code f} + * @return {@code f * }2{@code scale_factor} + * @author Joseph D. Darcy + */ + public static float scalb(float f, int scale_factor) { + // magnitude of a power of two so large that scaling a finite + // nonzero value by it would be guaranteed to over or + // underflow; due to rounding, scaling down takes takes an + // additional power of two which is reflected here + final int MAX_SCALE = FloatConsts.MAX_EXPONENT + -FloatConsts.MIN_EXPONENT + + FloatConsts.SIGNIFICAND_WIDTH + 1; + + // Make sure scaling factor is in a reasonable range + scale_factor = Math.max(Math.min(scale_factor, MAX_SCALE), -MAX_SCALE); + + /* + * Since + MAX_SCALE for float fits well within the double exponent range + * and + float -> double conversion is exact the multiplication below will + * be exact. Therefore, the rounding that occurs when the double product is + * cast to float will be the correctly rounded float result. Since all + * operations other than the final multiply will be exact, it is not + * necessary to declare this method strictfp. + */ + return (float) ((double) f * powerOfTwoD(scale_factor)); + } + + /** + * Returns the floating-point number adjacent to the first argument in the + * direction of the second argument. If both arguments compare as equal the + * second argument is returned. + * + *

+ * Special cases: + *

    + *
  • If either argument is a NaN, then NaN is returned. + * + *
  • If both arguments are signed zeros, {@code direction} is returned + * unchanged (as implied by the requirement of returning the second argument + * if the arguments compare as equal). + * + *
  • If {@code start} is ±{@code Double.MIN_VALUE} and + * {@code direction} has a value such that the result should have a smaller + * magnitude, then a zero with the same sign as {@code start} is returned. + * + *
  • If {@code start} is infinite and {@code direction} has a value such + * that the result should have a smaller magnitude, {@code Double.MAX_VALUE} + * with the same sign as {@code start} is returned. + * + *
  • If {@code start} is equal to ± {@code Double.MAX_VALUE} and + * {@code direction} has a value such that the result should have a larger + * magnitude, an infinity with same sign as {@code start} is returned. + *
+ * + * @param start + * starting floating-point value + * @param direction + * value indicating which of {@code start}'s neighbors or + * {@code start} should be returned + * @return The floating-point number adjacent to {@code start} in the + * direction of {@code direction}. + * @author Joseph D. Darcy + */ + public static double nextAfter(double start, double direction) { + /* + * The cases: + * + * nextAfter(+infinity, 0) == MAX_VALUE nextAfter(+infinity, +infinity) == + * +infinity nextAfter(-infinity, 0) == -MAX_VALUE nextAfter(-infinity, + * -infinity) == -infinity + * + * are naturally handled without any additional testing + */ + + // First check for NaN values + if (isNaN(start) || isNaN(direction)) { + // return a NaN derived from the input NaN(s) + return start + direction; + } else if (start == direction) { + return direction; + } else { // start > direction or start < direction + // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) + // then bitwise convert start to integer. + long transducer = Double.doubleToRawLongBits(start + 0.0d); + + /* + * IEEE 754 floating-point numbers are lexicographically ordered if + * treated as signed- magnitude integers . Since Java's integers are two's + * complement, incrementing" the two's complement representation of a + * logically negative floating-point value *decrements* the + * signed-magnitude representation. Therefore, when the integer + * representation of a floating-point values is less than zero, the + * adjustment to the representation is in the opposite direction than + * would be expected at first . + */ + if (direction > start) { // Calculate next greater value + transducer = transducer + (transducer >= 0L ? 1L : -1L); + } else { // Calculate next lesser value + assert direction < start; + if (transducer > 0L) + --transducer; + else if (transducer < 0L) + ++transducer; + /* + * transducer==0, the result is -MIN_VALUE + * + * The transition from zero (implicitly positive) to the smallest + * negative signed magnitude value must be done explicitly. + */ + else + transducer = DoubleConsts.SIGN_BIT_MASK | 1L; + } + + return Double.longBitsToDouble(transducer); + } + } + + /** + * Returns the floating-point number adjacent to the first argument in the + * direction of the second argument. If both arguments compare as equal, the + * second argument is returned. + * + *

+ * Special cases: + *

    + *
  • If either argument is a NaN, then NaN is returned. + * + *
  • If both arguments are signed zeros, a {@code float} zero with the same + * sign as {@code direction} is returned (as implied by the requirement of + * returning the second argument if the arguments compare as equal). + * + *
  • If {@code start} is ±{@code Float.MIN_VALUE} and + * {@code direction} has a value such that the result should have a smaller + * magnitude, then a zero with the same sign as {@code start} is returned. + * + *
  • If {@code start} is infinite and {@code direction} has a value such + * that the result should have a smaller magnitude, {@code Float.MAX_VALUE} + * with the same sign as {@code start} is returned. + * + *
  • If {@code start} is equal to ± {@code Float.MAX_VALUE} and + * {@code direction} has a value such that the result should have a larger + * magnitude, an infinity with same sign as {@code start} is returned. + *
+ * + * @param start + * starting floating-point value + * @param direction + * value indicating which of {@code start}'s neighbors or + * {@code start} should be returned + * @return The floating-point number adjacent to {@code start} in the + * direction of {@code direction}. + * @author Joseph D. Darcy + */ + public static float nextAfter(float start, double direction) { + /* + * The cases: + * + * nextAfter(+infinity, 0) == MAX_VALUE nextAfter(+infinity, +infinity) == + * +infinity nextAfter(-infinity, 0) == -MAX_VALUE nextAfter(-infinity, + * -infinity) == -infinity + * + * are naturally handled without any additional testing + */ + + // First check for NaN values + if (isNaN(start) || isNaN(direction)) { + // return a NaN derived from the input NaN(s) + return start + (float) direction; + } else if (start == direction) { + return (float) direction; + } else { // start > direction or start < direction + // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) + // then bitwise convert start to integer. + int transducer = Float.floatToRawIntBits(start + 0.0f); + + /* + * IEEE 754 floating-point numbers are lexicographically ordered if + * treated as signed- magnitude integers . Since Java's integers are two's + * complement, incrementing" the two's complement representation of a + * logically negative floating-point value *decrements* the + * signed-magnitude representation. Therefore, when the integer + * representation of a floating-point values is less than zero, the + * adjustment to the representation is in the opposite direction than + * would be expected at first. + */ + if (direction > start) {// Calculate next greater value + transducer = transducer + (transducer >= 0 ? 1 : -1); + } else { // Calculate next lesser value + assert direction < start; + if (transducer > 0) + --transducer; + else if (transducer < 0) + ++transducer; + /* + * transducer==0, the result is -MIN_VALUE + * + * The transition from zero (implicitly positive) to the smallest + * negative signed magnitude value must be done explicitly. + */ + else + transducer = FloatConsts.SIGN_BIT_MASK | 1; + } + + return Float.intBitsToFloat(transducer); + } + } + + /** + * Returns the floating-point value adjacent to {@code d} in the direction of + * positive infinity. This method is semantically equivalent to + * {@code nextAfter(d, + * Double.POSITIVE_INFINITY)}; however, a {@code nextUp} implementation may + * run faster than its equivalent {@code nextAfter} call. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, the result is NaN. + * + *
  • If the argument is positive infinity, the result is positive infinity. + * + *
  • If the argument is zero, the result is {@code Double.MIN_VALUE} + * + *
+ * + * @param d + * starting floating-point value + * @return The adjacent floating-point value closer to positive infinity. + * @author Joseph D. Darcy + */ + public static double nextUp(double d) { + if (isNaN(d) || d == Double.POSITIVE_INFINITY) + return d; + else { + d += 0.0d; + return Double.longBitsToDouble( + Double.doubleToRawLongBits(d) + ((d >= 0.0d) ? +1L : -1L)); + } + } + + /** + * Returns the floating-point value adjacent to {@code f} in the direction of + * positive infinity. This method is semantically equivalent to + * {@code nextAfter(f, + * Double.POSITIVE_INFINITY)}; however, a {@code nextUp} implementation may + * run faster than its equivalent {@code nextAfter} call. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, the result is NaN. + * + *
  • If the argument is positive infinity, the result is positive infinity. + * + *
  • If the argument is zero, the result is {@code Float.MIN_VALUE} + * + *
+ * + * @param f + * starting floating-point value + * @return The adjacent floating-point value closer to positive infinity. + * @author Joseph D. Darcy + */ + public static float nextUp(float f) { + if (isNaN(f) || f == FloatConsts.POSITIVE_INFINITY) + return f; + else { + f += 0.0f; + return Float + .intBitsToFloat(Float.floatToRawIntBits(f) + ((f >= 0.0f) ? +1 : -1)); + } + } + + /** + * Returns the floating-point value adjacent to {@code d} in the direction of + * negative infinity. This method is semantically equivalent to + * {@code nextAfter(d, + * Double.NEGATIVE_INFINITY)}; however, a {@code nextDown} implementation may + * run faster than its equivalent {@code nextAfter} call. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, the result is NaN. + * + *
  • If the argument is negative infinity, the result is negative infinity. + * + *
  • If the argument is zero, the result is {@code -Double.MIN_VALUE} + * + *
+ * + * @param d + * starting floating-point value + * @return The adjacent floating-point value closer to negative infinity. + * @author Joseph D. Darcy + */ + public static double nextDown(double d) { + if (isNaN(d) || d == Double.NEGATIVE_INFINITY) + return d; + else { + if (d == 0.0) + return -Double.MIN_VALUE; + else + return Double.longBitsToDouble( + Double.doubleToRawLongBits(d) + ((d > 0.0d) ? -1L : +1L)); + } + } + + /** + * Returns the floating-point value adjacent to {@code f} in the direction of + * negative infinity. This method is semantically equivalent to + * {@code nextAfter(f, + * Float.NEGATIVE_INFINITY)}; however, a {@code nextDown} implementation may + * run faster than its equivalent {@code nextAfter} call. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, the result is NaN. + * + *
  • If the argument is negative infinity, the result is negative infinity. + * + *
  • If the argument is zero, the result is {@code -Float.MIN_VALUE} + * + *
+ * + * @param f + * starting floating-point value + * @return The adjacent floating-point value closer to negative infinity. + * @author Joseph D. Darcy + */ + public static double nextDown(float f) { + if (isNaN(f) || f == Float.NEGATIVE_INFINITY) + return f; + else { + if (f == 0.0f) + return -Float.MIN_VALUE; + else + return Float.intBitsToFloat( + Float.floatToRawIntBits(f) + ((f > 0.0f) ? -1 : +1)); + } + } + + /** + * Returns the first floating-point argument with the sign of the second + * floating-point argument. For this method, a NaN {@code sign} argument is + * always treated as if it were positive. + * + * @param magnitude + * the parameter providing the magnitude of the result + * @param sign + * the parameter providing the sign of the result + * @return a value with the magnitude of {@code magnitude} and the sign of + * {@code sign}. + * @author Joseph D. Darcy + * @since 1.5 + */ + public static double copySign(double magnitude, double sign) { + return rawCopySign(magnitude, (isNaN(sign) ? 1.0d : sign)); + } + + /** + * Returns the first floating-point argument with the sign of the second + * floating-point argument. For this method, a NaN {@code sign} argument is + * always treated as if it were positive. + * + * @param magnitude + * the parameter providing the magnitude of the result + * @param sign + * the parameter providing the sign of the result + * @return a value with the magnitude of {@code magnitude} and the sign of + * {@code sign}. + * @author Joseph D. Darcy + */ + public static float copySign(float magnitude, float sign) { + return rawCopySign(magnitude, (isNaN(sign) ? 1.0f : sign)); + } + + /** + * Returns the size of an ulp of the argument. An ulp of a {@code double} + * value is the positive distance between this floating-point value and the + * {@code double} value next larger in magnitude. Note that for non-NaN + * x, ulp(-x) == ulp(x). + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, then the result is NaN. + *
  • If the argument is positive or negative infinity, then the result is + * positive infinity. + *
  • If the argument is positive or negative zero, then the result is + * {@code Double.MIN_VALUE}. + *
  • If the argument is ±{@code Double.MAX_VALUE}, then the result is + * equal to 2971. + *
+ * + * @param d + * the floating-point value whose ulp is to be returned + * @return the size of an ulp of the argument + * @author Joseph D. Darcy + * @since 1.5 + */ + public static double ulp(double d) { + int exp = getExponent(d); + + switch (exp) { + case DoubleConsts.MAX_EXPONENT + 1: // NaN or infinity + return Math.abs(d); + + case DoubleConsts.MIN_EXPONENT - 1: // zero or subnormal + return Double.MIN_VALUE; + + default: + assert exp <= DoubleConsts.MAX_EXPONENT + && exp >= DoubleConsts.MIN_EXPONENT; + + // ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x)) + exp = exp - (DoubleConsts.SIGNIFICAND_WIDTH - 1); + if (exp >= DoubleConsts.MIN_EXPONENT) { + return powerOfTwoD(exp); + } else { + // return a subnormal result; left shift integer + // representation of Double.MIN_VALUE appropriate + // number of positions + return Double.longBitsToDouble(1L << (exp - (DoubleConsts.MIN_EXPONENT + - (DoubleConsts.SIGNIFICAND_WIDTH - 1)))); + } + } + } + + /** + * Returns the size of an ulp of the argument. An ulp of a {@code float} value + * is the positive distance between this floating-point value and the + * {@code float} value next larger in magnitude. Note that for non-NaN + * x, ulp(-x) == ulp(x). + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, then the result is NaN. + *
  • If the argument is positive or negative infinity, then the result is + * positive infinity. + *
  • If the argument is positive or negative zero, then the result is + * {@code Float.MIN_VALUE}. + *
  • If the argument is ±{@code Float.MAX_VALUE}, then the result is + * equal to 2104. + *
+ * + * @param f + * the floating-point value whose ulp is to be returned + * @return the size of an ulp of the argument + * @author Joseph D. Darcy + * @since 1.5 + */ + public static float ulp(float f) { + int exp = getExponent(f); + + switch (exp) { + case FloatConsts.MAX_EXPONENT + 1: // NaN or infinity + return Math.abs(f); + + case FloatConsts.MIN_EXPONENT - 1: // zero or subnormal + return FloatConsts.MIN_VALUE; + + default: + assert exp <= FloatConsts.MAX_EXPONENT && exp >= FloatConsts.MIN_EXPONENT; + + // ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x)) + exp = exp - (FloatConsts.SIGNIFICAND_WIDTH - 1); + if (exp >= FloatConsts.MIN_EXPONENT) { + return powerOfTwoF(exp); + } else { + // return a subnormal result; left shift integer + // representation of FloatConsts.MIN_VALUE appropriate + // number of positions + return Float.intBitsToFloat(1 << (exp - (FloatConsts.MIN_EXPONENT + - (FloatConsts.SIGNIFICAND_WIDTH - 1)))); + } + } + } + + /** + * Returns the signum function of the argument; zero if the argument is zero, + * 1.0 if the argument is greater than zero, -1.0 if the argument is less than + * zero. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, then the result is NaN. + *
  • If the argument is positive zero or negative zero, then the result is + * the same as the argument. + *
+ * + * @param d + * the floating-point value whose signum is to be returned + * @return the signum function of the argument + * @author Joseph D. Darcy + * @since 1.5 + */ + public static double signum(double d) { + return (d == 0.0 || isNaN(d)) ? d : copySign(1.0, d); + } + + /** + * Returns the signum function of the argument; zero if the argument is zero, + * 1.0f if the argument is greater than zero, -1.0f if the argument is less + * than zero. + * + *

+ * Special Cases: + *

    + *
  • If the argument is NaN, then the result is NaN. + *
  • If the argument is positive zero or negative zero, then the result is + * the same as the argument. + *
+ * + * @param f + * the floating-point value whose signum is to be returned + * @return the signum function of the argument + * @author Joseph D. Darcy + * @since 1.5 + */ + public static float signum(float f) { + return (f == 0.0f || isNaN(f)) ? f : copySign(1.0f, f); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/RemoteLoggingInitException.java b/tck/old-tck/source/src/com/sun/ts/lib/util/RemoteLoggingInitException.java new file mode 100644 index 0000000..101e1bd --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/RemoteLoggingInitException.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +/** + * This exception is thrown by the init method of the TestUtil class, if + * anything goes wrong while establishing a socket connection back to the + * harness host. + * + * @author Kyle Grucci + */ +public class RemoteLoggingInitException extends java.lang.Exception { + /** + * creates a RemoteLoggingInitException + */ + public RemoteLoggingInitException() { + super(); + } + + /** + * creates a RemoteLoggingInitException with a message + * + * @param s + * the message + */ + public RemoteLoggingInitException(String s) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogAdapter.java b/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogAdapter.java new file mode 100644 index 0000000..3e8517c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogAdapter.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +/** + * This class acts as an adapter between the logging API used in the API check + * utility and the logginf API available in the CTS harness. The API check + * utility uses a PrintWriter to log messages. The parts of the PrintWriter API + * used by the API check utility will be translated to TestUtil calls in this + * class. The SigLogIntf will capture the parts of the PrintWriter API that need + * to be reimplemented so API check can fit into the CTS test framework. + */ +public class SigLogAdapter implements SigLogIntf { + + private static final String NL = System.getProperty("line.separator", "\n"); + + private boolean dumpMessagesToStdErr; + + public SigLogAdapter() { + String useStdErr = System.getProperty("dump.api.check.stderr", "false"); + if (useStdErr.equalsIgnoreCase("true")) { + dumpMessagesToStdErr = true; + } + } + + public void println(String msg) { + print(msg + NL); + } + + public void println(Object obj) { + print(obj.toString() + NL); + } + + public void println(char c) { + print(c); + println(); + } + + public void println() { + print(NL); + } + + public void print(String msg) { + if (dumpMessagesToStdErr) { + System.err.println(msg); + } else { + TestUtil.logMsg(msg); + } + } + + public void print(Object obj) { + print(obj.toString()); + } + + public void print(char c) { + char[] chars = new char[] { c }; + print(new String(chars)); + } + + public void flush() { + // do nothing unless there is an equivalent call in TestUtil + // to flush the output stream + } + + public void close() { + // do nothing unless there is an equivalent call in TestUtil + // to close the output stream + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogIntf.java b/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogIntf.java new file mode 100644 index 0000000..a28e9b0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/SigLogIntf.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +/** + * This interface defines the API necessary for a signature verification + * application to log status messages, errors and debug messages to a common + * output repository. This interface will be used by the API check tool to log + * messages to the CTS output framework (namely the output methods defined in + * the TestUtil class). This interface will be implemented by an adapter class + * that will adapt the API defined in this interface to the logging API used by + * CTS test code. + */ +public interface SigLogIntf { + + public void println(String msg); + + public void println(Object obj); + + public void println(char c); + + public void println(); + + public void print(String msg); + + public void print(Object obj); + + public void print(char c); + + public void flush(); // nop + + public void close(); // nop + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContext.java b/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContext.java new file mode 100644 index 0000000..1dd23c0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContext.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +import java.io.Serializable; +import java.rmi.*; +import java.util.*; +import javax.naming.*; +import javax.rmi.PortableRemoteObject; + +/** + * TSNamingContext provides a wrapper for all lookups. + */ +public class TSNamingContext implements TSNamingContextInterface, Serializable { + + Properties props = null; + + public TSNamingContext() throws Exception { + } + + public TSNamingContext(Properties pp) throws Exception { + if (pp != null) { + props = pp; + } + } + + /** + * Provides lookup of an object. + * + * @param s + * object name to lookup + * @param c + * object class to narrow to if remote object if null no narrow is + * performed. + */ + public Object lookup(String s, Class c) throws Exception { + Object o = lookup(s); + return c == null ? o : PortableRemoteObject.narrow(o, c); + } + + /** + * Provides lookup of an object. + * + * @param s + * object name to lookup + */ + public Object lookup(String s) throws Exception { + if (props != null) { + return new InitialContext(props).lookup(s); + } else { + return new InitialContext().lookup(s); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContextInterface.java b/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContextInterface.java new file mode 100644 index 0000000..e424a70 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/TSNamingContextInterface.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +import java.util.*; + +/** + * TSNamingContextInterface provides the interface that must be implemented to + * provide the implementation specific naming context code needed to obtain the + * intial naming context and perform object lookups. + */ +public interface TSNamingContextInterface { + public Object lookup(String s, Class c) throws Exception; + + public Object lookup(String s) throws Exception; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/TSXADataSource.java b/tck/old-tck/source/src/com/sun/ts/lib/util/TSXADataSource.java new file mode 100644 index 0000000..e96ffab --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/TSXADataSource.java @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * @(#)TSXADataSource.java 1.6 04/10/01 + */ + +package com.sun.ts.lib.util; + +import java.util.*; +import java.lang.reflect.*; +import javax.sql.XADataSource; + +public class TSXADataSource { + + private static final char PROPS_DELIM = ':'; + + private static final char PAIR_DELIM = '='; + + private static final char LITERAL_DELIM = '\''; + + private static final String XA_CLASS_NAME = "XADataSourceName"; + + private static TSXADataSource instance = new TSXADataSource(); + + private TSXADataSource() { + } + + public static TSXADataSource instance() { + return instance; + } + + private String lowerFirstChar(String str) { + String result = str; + if (str == null || str.length() == 0) { + return str; + } + char firstChar = str.charAt(0); + if (Character.isLowerCase(firstChar)) { + result = Character.toString(Character.toUpperCase(firstChar)) + + result.substring(1); + } + return result; + } + + private void setProperties(Map props, Class clazz, Object target) + throws Exception { + try { + Iterator iter = props.keySet().iterator(); + while (iter.hasNext()) { + String originalPropName = (String) iter.next(); + String propName = lowerFirstChar(originalPropName); + String methodName = "set" + propName; + Method m = findMethod(methodName, clazz); + String propValue = (String) props.get(originalPropName); + // Get the parameter type supported by the setter + Class[] parameters = m.getParameterTypes(); + Object[] values = new Object[1]; + // Now Convert the type to a wrapper object as needed + values[0] = convertType(parameters[0], propValue); + m.invoke(target, values); + System.err.println("$$$$$ TSXADataSource.setProperties \"[" + + originalPropName + ", " + propValue + "]\""); + } + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + private Map getProps(String arg) throws Exception { + Map result = new HashMap(); + boolean inValue = false; + boolean inQuote = false; + StringBuffer nameBuffer = new StringBuffer(); + StringBuffer valueBuffer = new StringBuffer(); + int numChars = arg.length(); + for (int i = 0; i < numChars; i++) { + char current = arg.charAt(i); + if (Character.isWhitespace(current)) { + continue; + } + if (current == PAIR_DELIM) { + inValue = true; + } else if (current == LITERAL_DELIM) { + inQuote = !inQuote; + } else if (current == PROPS_DELIM && !inQuote) { + inValue = false; + result.put(nameBuffer.toString(), valueBuffer.toString()); + nameBuffer.delete(0, nameBuffer.length()); + valueBuffer.delete(0, valueBuffer.length()); + } else { + if (inQuote || inValue) { + valueBuffer.append(current); + } else { + nameBuffer.append(current); + } + } + } + result.put(nameBuffer.toString(), valueBuffer.toString()); + System.err.println("$$$$$ getProps()" + result); + return result; + } + + /** + * Find a specific method within a Class + * + * @param methodName + * the name of the method to search for in clazz + * @param clazz + * The Class to search for 'methodName' in + * @return the returned Method. + * @throws Exception, + * in case methodName cannot be found in clazz + */ + private Method findMethod(String methodName, Class clazz) throws Exception { + Method[] methods = clazz.getMethods(); + Method result = null; + for (int i = 0; i < methods.length; i++) { + if (methods[i].getName().equalsIgnoreCase(methodName)) { + result = methods[i]; + System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$$"); + System.err.println("$$$$$ findMethod() found method: " + result); + System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$$"); + break; + } + } + if (result == null) { + throw new Exception("$$$$ Could not find method " + methodName + + " in Class: " + clazz.getName()); + } + return result; + } + + /** + * Converts the type from String to the Class type. + * + * @param type + * Class name to which the conversion is required. + * @param parameter + * String value to be converted. + * @return Converted value. + * @throws NumberFormatException, + * in case of the mismatch of parameter values. + */ + private Object convertType(Class type, String parameter) + throws NumberFormatException { + try { + String typeName = type.getName(); + if (typeName.equals("java.lang.String") + || typeName.equals("java.lang.Object")) { + return parameter; + } + + if (typeName.equals("int") || typeName.equals("java.lang.Integer")) { + return new Integer(parameter); + } + + if (typeName.equals("short") || typeName.equals("java.lang.Short")) { + return new Short(parameter); + } + + if (typeName.equals("byte") || typeName.equals("java.lang.Byte")) { + return new Byte(parameter); + } + + if (typeName.equals("long") || typeName.equals("java.lang.Long")) { + return new Long(parameter); + } + + if (typeName.equals("float") || typeName.equals("java.lang.Float")) { + return new Float(parameter); + } + + if (typeName.equals("double") || typeName.equals("java.lang.Double")) { + return new Double(parameter); + } + + if (typeName.equals("java.math.BigDecimal")) { + return new java.math.BigDecimal(parameter); + } + + if (typeName.equals("java.math.BigInteger")) { + return new java.math.BigInteger(parameter); + } + + if (typeName.equals("boolean") || typeName.equals("java.lang.Boolean")) { + return new Boolean(parameter); + } + + return parameter; + } catch (NumberFormatException nfe) { + System.err.println("$$$$$ NumberFormatException Encountered"); + throw nfe; + } + } + + public XADataSource getXADataSource(String xaProps, String className) + throws Exception { + System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$$"); + System.err.println("xaProps \"" + xaProps + "\""); + System.err.println("className \"" + className + "\""); + System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$$"); + Map props = getProps(xaProps); + Class clazz = Class.forName(className); + XADataSource target = (XADataSource) clazz.newInstance(); + setProperties(props, clazz, target); + return target; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/TestUtil.java b/tck/old-tck/source/src/com/sun/ts/lib/util/TestUtil.java new file mode 100644 index 0000000..9752c87 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/TestUtil.java @@ -0,0 +1,1148 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +import java.io.*; +import java.util.*; +import java.net.*; +import java.text.SimpleDateFormat; + +/** + * TestUtil is a final utility class responsible for implementing logging across + * multiple VMs. It also contains many convenience methods for logging property + * object contents, stacktraces, and header lines. + * + * @author Kyle Grucci + * + */ +public final class TestUtil { + public static boolean traceflag = true; + + // this can be set in TestUtil's start logging method!! + public static String sTestName; + + public static final String[] EMPTY_STRING_ARRAY = new String[0]; + + public static final int VM_UNDER_TEST = 0; + + public static final int VM_HARNESS = 1; // this is really the test client VM + + public static final int VM_JAVATEST = 2; + + public static final int DEBUG_OUTPUT_LEVEL = 2; + + public static final int NORMAL_OUTPUT_LEVEL = 3; + + public static final int ERROR_STREAM = 4; + + public static final int OUTPUT_STREAM = 5; + + public static String NEW_LINE = System.getProperty("line.separator", "\n"); + + // by default so the testers don't have to do anything + public static int iWhereAreWe = VM_UNDER_TEST; + + private static PrintWriter out = null; + + private static PrintWriter err = null; + + private static PrintWriter additionalWriter = null; + + private static ObjectOutputStream objectOutputStream = null; + + private static ObjectOutputStream objectInputStream = null; + + private static Socket socketOnRemoteVM = null; + + private static boolean bAlreadyInitialized = false; + + private static Object socketMutex = new Object(); + + private static int portOfHarness = 2000; + + private static String hostOfHarness = "unset host"; + + private static Vector vBuffereredOutput = new Vector(); + + // Transaction Attribute Value Mapping Table + private static final String UNRECOGNIZED_STATUS = "UNRECOGNIZED_STATUS"; + + private static final String transactionTable[] = { "STATUS_ACTIVE", // 0 + "STATUS_MARKED_ROLLBACK", // 1 + "STATUS_PREPARED", // 2 + "STATUS_COMMITTED", // 3 + "STATUS_ROLLEDBACK", // 4 + "STATUS_UNKNOWN", // 5 + "STATUS_NO_TRANSACTION", // 6 + "STATUS_PREPARING", // 7 + "STATUS_COMMITTING", // 8 + "STATUS_ROLLING_BACK", // 9 + }; + + // debug flag for printing TS harness debug output + public static boolean harnessDebug; + + // hang onto the props that are passed in during logging init calls + private static Properties testProps = null; + + private static SimpleDateFormat df = new SimpleDateFormat( + "MM-dd-yyyy HH:mm:ss"); + + static { + harnessDebug = Boolean.getBoolean("cts.harness.debug"); + } + + /** + * used by harness to log debug output to the standard output stream + * + * @param s + * the output string + */ + public static void logHarnessDebug(String s) { + if (harnessDebug) { + logHarness(s, null); + } + } + + /** + * used by TSTestFinder and TSScript to log output to the standard output + * stream + * + * @param s + * the output string + * @param t + * a Throwable whose stacktrace gets printed + */ + public static void logHarness(String s, Throwable t) { + synchronized (System.out) { + System.out.println(df.format(new Date()) + ": Harness - " + s); + logToAdditionalWriter(s, t); + if (t != null) { + t.printStackTrace(); + } + } + } + + public static void logHarness(String s) { + logHarness(s, null); + } + + private static void logToAdditionalWriter(String s) { + logToAdditionalWriter(s, null); + } + + private static void logToAdditionalWriter(String s, Throwable t) { + if (additionalWriter != null) + additionalWriter.println(s); + if (t != null) { + t.printStackTrace(additionalWriter); + } + } + + /** + * This method returns the properties object + * + * @return the properties object + */ + public static Properties getProperties() { + if (testProps == null) { + testProps = getPropsFromFile(); + } + return testProps; + } + + /** + * This method returns the property value for the appropriate property key + * + * @param s + * the property name + * @return the property value + */ + public static String getProperty(String s) { + Properties p = getProperties(); + return p.getProperty(s); + } + + /** + * This method returns the property value for the appropriate property key + * + * @param s + * the property name + * @return the property value + */ + public static String getProperty(String s, String defaultValue) { + Properties p = getProperties(); + return p.getProperty(s, defaultValue); + } + + /** + * returns the transaction status value as a String given its integer + * representation + * + * @param status + * integer representation of a transaction status + * @return string representation of a transaction status + */ + public static String getTransactionStatus(int status) { + if (status < 0 || status > transactionTable.length - 1) + return UNRECOGNIZED_STATUS; + else + return transactionTable[status]; + } + + /** + * prints the transaction status value as a String given its integer + * representation + * + * @param status + * integer representation of a transaction status + */ + public static void printTransactionStatus(int status) { + logMsg("TRANSACTION_STATUS: " + getTransactionStatus(status)); + } + + // MilliSeconds Multiple + public static final int MILLI = 1000; + + /** + * pauses the calling thread for the specified number of seconds + * + * @param s + * number of seconds + */ + public static void sleepSec(int s) { + logTrace("Sleeping " + s + " seconds"); + try { + Thread.sleep(s * MILLI); + } catch (InterruptedException e) { + logErr("Exception: " + e); + } + } + + /** + * pauses the calling thread for the specified number of milliseconds + * + * @param s + * number of milliseconds + */ + public static void sleep(int s) { + sleepMsec(s); + } + + /** + * pauses the calling thread for the specified number of milliseconds + * + * @param s + * number of milliseconds + */ + public static void sleepMsec(int s) { + logTrace("Sleeping " + s + " milliseconds"); + try { + Thread.sleep(s); + } catch (InterruptedException e) { + logErr("Exception: " + e); + } + } + + public static void flushStream() { + synchronized (socketMutex) { + try { + objectOutputStream.flush(); + } catch (Throwable t) { + // Ignore + // System.out.println("EXCEPTION WHILE FLUSHING"); + } + } + } + + public static void writeObject(TestReportInfo info) { + synchronized (socketMutex) { + flushStream(); + try { + objectOutputStream.writeObject(info); + // System.out.println("WROTE: " + info.sOutput); + } catch (Exception e) { + // System.out.println("EXCEPTION WHILE WRITING: " + info.sOutput); + synchronized (vBuffereredOutput) { + vBuffereredOutput.addElement(info); + // System.out.println("ADDED THIS STRING TO BUFFERED OUT: " + + // info.sOutput); + } + } + flushStream(); + } + } + + private static void sendBufferedData() throws Exception { + TestReportInfo tri = null; + synchronized (vBuffereredOutput) { + try { + // logMsg("vBuffereredOutput size = " + vBuffereredOutput.size()); + synchronized (socketMutex) { + for (int ii = 0; ii < vBuffereredOutput.size(); ii++) { + tri = (TestReportInfo) vBuffereredOutput.elementAt(ii); + writeObject(tri); + // System.out.println("WRITING_bufferedoutput: " + tri.sOutput); + // objectOutputStream.writeObject(tri); + // objectOutputStream.flush(); + // logMsg("writing: " + ii); + // logMsg("writing: " + tri.sOutput); + } + } + // logMsg("wrote buffered output"); + } catch (Exception e) { + throw e; + } finally { + vBuffereredOutput.removeAllElements(); + // logMsg("reinititialized buffered output vector"); + } + } + } + + private static final String PROPS_FILE_NAME = "-cts-props.txt"; + + private static final String PROPS_FILE; + + static { + String userName = System.getProperty("user.name"); + String tmpDir = System.getProperty("java.io.tmpdir", + File.separator + "tmp"); + if (tmpDir.endsWith(File.separator)) { + PROPS_FILE = tmpDir + userName + PROPS_FILE_NAME; + } else { + PROPS_FILE = tmpDir + File.separator + userName + PROPS_FILE_NAME; + } + System.out.println( + "************************************************************"); + System.out.println("* props file set to \"" + PROPS_FILE + "\""); + System.out.println( + "************************************************************"); + } + + private static Properties getPropsFromFile() { + FileInputStream in = null; + Properties p = new Properties(); + try { + in = new FileInputStream(PROPS_FILE); + p.load(in); + } catch (Exception e) { + logErr("Error reading the Properties object", e); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + } + } + } + return p; + } + + private static void savePropsToFile(Properties p) { + FileOutputStream out = null; + try { + out = new FileOutputStream(PROPS_FILE); + p.store(out, "CTS Test Properties File"); + } catch (Exception e) { + logErr("Error saving the Properties object", e); + } finally { + if (out != null) { + try { + out.close(); + } catch (Exception e) { + } + } + } + } + + /** + * This static method must be called once by each new remote VM. Once called, + * a socket connection is created back to the host running the test harness. + * All calls to logMsg, logErr, and logTrace are immediately sent back to the + * harness host. + * + * @param p + * properties containing harness host, port, and trace flag + * @exception RemoteLoggingInitException + * if an exception occurs while the server side is setting up the + * socket connection back to the client host + */ + public static void init(Properties p) throws RemoteLoggingInitException { + savePropsToFile(p); // persist properties to a disk file + // System.out.println("INIT_CALLED"); + synchronized (socketMutex) { + try { + // TSPropertyManager.createTSPropertyManager(p); + testProps = p; + if (p.isEmpty()) { + throw new RemoteLoggingInitException( + "Init: Error - Empty properties object passed to TestUtil.init"); + } + NEW_LINE = p.getProperty("line.separator"); + if (socketOnRemoteVM != null) { + socketOnRemoteVM.close(); + } + if (objectOutputStream != null) { + objectOutputStream.close(); + } + if (true) { + // System.out.println("INIT_CALLED AND SOCKET = NULL"); + traceflag = Boolean + .valueOf(p.getProperty("harness.log.traceflag", "true")) + .booleanValue(); + hostOfHarness = p.getProperty("harness.host"); + portOfHarness = Integer + .parseInt(p.getProperty("harness.log.port", "2000")); + if (hostOfHarness == null) { + throw new RemoteLoggingInitException( + "Init: Error while trying to getProperty(harness.host) - returned null"); + } + socketOnRemoteVM = new Socket(hostOfHarness, portOfHarness); + objectOutputStream = new ObjectOutputStream( + socketOnRemoteVM.getOutputStream()); + sendBufferedData(); + // logMsg("socketOnRemoteVM=null, renewed everything"); + } else { + // we'll never get here now... + // call flush to make sure that we still have an open connection. + // if the client went away and a new client is being run, we will + // get an IOException, in which case we will reconnect. + // logMsg("socketOnRemoteVM != null, calling flush"); + // objectOutputStream.flush(); + // if this fails, then the connection is gone + // this is better than flush, because flush seems to always fail + TestReportInfo tri = new TestReportInfo("SVR: " + "Logging check", + OUTPUT_STREAM, DEBUG_OUTPUT_LEVEL, null); + objectOutputStream.writeObject(tri); + // System.out.println("WROTE TEST OBJECT"); + } + } catch (UnknownHostException e) { + throw new RemoteLoggingInitException( + "You must pass a valid host string to init()"); + } catch (IOException e) { + // System.out.println("EXCEPTION WHILE WRITING TEST OBJECT"); + // the client VM may have shutdown, so establish a new connection + try { + // System.out.println("INIT_CALLED AND TRYING TO ESABLISH CONN. AFTER + // IOEXCEPTION"); + traceflag = Boolean + .valueOf(p.getProperty("harness.log.traceflag", "true")) + .booleanValue(); + hostOfHarness = p.getProperty("harness.host"); + portOfHarness = Integer + .parseInt(p.getProperty("harness.log.port", "2000")); + if (hostOfHarness == null) { + throw new RemoteLoggingInitException( + "Init: Error while trying to getProperty(harness.host) - returned null"); + } + socketOnRemoteVM.close(); + socketOnRemoteVM = new Socket(hostOfHarness, portOfHarness); + objectOutputStream = new ObjectOutputStream( + socketOnRemoteVM.getOutputStream()); + sendBufferedData(); + // logMsg("caught IOException from flush(), renewed everything"); + } catch (IOException e2) { + e2.printStackTrace(); + throw new RemoteLoggingInitException( + "IOException in TestUtil.init()"); + } catch (Exception e2) { + e2.printStackTrace(); + throw new RemoteLoggingInitException( + "got a random exception in init()"); + } + } catch (NumberFormatException e) { + throw new RemoteLoggingInitException( + "You must pass a valid port number string to init()"); + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteLoggingInitException( + "got a random exception in init()"); + } + } + } + + /* + * This method is called by our harness code to allow code that is shared + * between the harness and the tests and calls TestUtil logMsg and logTrace to + * do the right thing inside of the JavaTest VM. These calls will call to our + * logHarness methods. + */ + public static void initJavaTest() { + iWhereAreWe = VM_JAVATEST; + } + + public static void setAdditionalWriter(PrintWriter pw) { + iWhereAreWe = VM_JAVATEST; + additionalWriter = pw; + } + + /** + * This static method must be called once by a VM which does not rely upon any + * remote logging. + * + * param p properties containing harness trace flag + */ + public static void initNoLogging(Properties p) { + if (bAlreadyInitialized) + return; + + testProps = p; + NEW_LINE = p.getProperty("line.separator"); + traceflag = Boolean.valueOf(p.getProperty("harness.log.traceflag", "true")) + .booleanValue(); + iWhereAreWe = VM_HARNESS; + bAlreadyInitialized = true; + } + + /** + * This static method must be called once by the harness VM. Once called, a + * serversocket begins listening for Remote VMs to connect on the port + * specified by harness.log.port. + * + * @param p + * properties containing harness trace flag + */ + public static void initClient(Properties p) { + if (bAlreadyInitialized) + return; + // start listener thread + try { + testProps = p; + NEW_LINE = p.getProperty("line.separator"); + traceflag = Boolean + .valueOf(p.getProperty("harness.log.traceflag", "true")) + .booleanValue(); + iWhereAreWe = VM_HARNESS; + ServerSocket ss = getServerSocket(p); + new Acceptor(ss); + bAlreadyInitialized = true; + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ServerSocket getServerSocket(Properties p) throws IOException { + ServerSocket result = null; + int port = 2000; + int retry = 10; + final int delaySeconds = 1; + try { + port = Integer.parseInt(p.getProperty("harness.log.port", "2000")); + } catch (NumberFormatException e1) { + e1.printStackTrace(); + System.err.println("Invalid value for harness.log.port," + + " using default harness.log.port of " + port); + } + try { + retry = Integer + .parseInt(p.getProperty("harness.socket.retry.count", "10")); + } catch (NumberFormatException e2) { + e2.printStackTrace(); + System.err.println("Invalid value for harness.socket.retry.count," + + " using default harness.socket.retry.count of " + retry); + } + logTrace( + "####### Value of harness.socket.retry.count is \"" + retry + "\""); + logTrace("####### Value of harness.log.port is \"" + port + "\""); + result = getServerSocket0(port, retry, delaySeconds); + while (result == null) { + port++; + result = getServerSocket0(port, retry, delaySeconds); + } + p.setProperty("harness.log.port", Integer.toString(port)); + logTrace( + "####### Actual bind value of harness.log.port is \"" + port + "\""); + return result; + } + + private static ServerSocket getServerSocket0(int port, int retry, + int delaySeconds) { + ServerSocket result = null; + for (int i = 0; i < retry; i++) { + try { + result = new ServerSocket(port); + break; + } catch (IOException e3) { + try { + Thread.sleep(delaySeconds * 1000); + } catch (InterruptedException e4) { + } + } + } + return result; + } + + /** + * This static method must be called once by the harness VM in order to set + * the output and error streams and the name of the current test. + * + * @param testName + * the currently running testname as specified in the source code + * tags + * @param outStream + * stream printed to by the logMsg and logTrace methods + * @param errStream + * stream printed to by the logErr methods + */ + public static void setCurrentTest(String testName, PrintWriter outStream, + PrintWriter errStream) { + sTestName = testName; + out = outStream; + err = outStream; + } + + /** + * prints a string to the log stream. All tests should use this method for + * standard logging messages + * + * @param s + * string to print to the log stream + */ + public static void logMsg(String s) { + if (iWhereAreWe == VM_JAVATEST) { + logHarness(s); + } else if (iWhereAreWe == VM_HARNESS) { + synchronized (out) { + // just print to the appropriate stream + out.println(df.format(new Date()) + ": " + s); + out.flush(); + } + } else { + TestReportInfo tri = new TestReportInfo("SVR: " + s, OUTPUT_STREAM, + NORMAL_OUTPUT_LEVEL, null); + writeObject( + tri); /* + * try { synchronized(socketMutex) { objectOutputStream.flush(); + * objectOutputStream.writeObject(tri); + * objectOutputStream.flush(); //System.out. + * println("successfully wrote to objectOutputStream"); } } + * catch(Exception ex) { //System.out. + * println("got exception trying to write to objectOutputStream" + * ); //if we have any problem, buffer the data + * synchronized(vBuffereredOutput) { + * vBuffereredOutput.addElement(tri); } } + */ + + } + } + + /** + * prints a string as well as the provided Throwable's stacktrace to the log + * stream. All tests should use this method for standard logging messages + * + * @param s + * string to print to the log stream + * @param t + * - throwable whose stacktrace gets printed* + * + */ + public static void logMsg(String s, Throwable t) { + if (iWhereAreWe == VM_JAVATEST) { + logHarnessDebug(s); + if (t != null) { + t.printStackTrace(); + } + } else { + if (iWhereAreWe == VM_HARNESS) { + synchronized (out) { + // just print to the appropriate stream + out.println(df.format(new Date()) + ": " + s); + out.flush(); + } + } else { + TestReportInfo tri = new TestReportInfo("SVR: " + s, OUTPUT_STREAM, + NORMAL_OUTPUT_LEVEL, null); + writeObject(tri); + } + if (t != null) { + printStackTrace(t); + } + } + + } + + /** + * turns on/off debugging. Once on, all calls to the logTrace method result in + * messages being printed to the log stream. If off, all logTrace calls are + * not printed. + * + * @param b + * If true, debugging is on. If false, debugging is + * turned off. + */ + public static void setTrace(boolean b) { + traceflag = b; + } + + /** + * prints a debug string to the log stream. All tests should use this method + * for verbose logging messages. Whether or not the string is printed is + * determined by the last call to the setTrace method. + * + * @param s + * string to print to the log stream + */ + public static void logTrace(String s) { + logTrace(s, null); + } + + /** + * Prints a debug string as well as the provided Throwable's stacktrace. Use + * this if certain exceptions are only desired while tracing. + * + * @param s + * - string to print to the log stream + * @param t + * - throwable whose stactrace gets printed + */ + public static void logTrace(String s, Throwable t) { + if (traceflag) { + if (iWhereAreWe == VM_JAVATEST) { + logHarnessDebug(s); + } else { + if (iWhereAreWe == VM_HARNESS) { + synchronized (out) { + // just print to the appropriate stream + if (s != null && s.startsWith("SVR-TRACE")) + out.println(df.format(new Date()) + ": " + s); + else + out.println(df.format(new Date()) + ": TRACE: " + s); + } + } else { + TestReportInfo tri = new TestReportInfo("SVR-TRACE: " + s, + OUTPUT_STREAM, DEBUG_OUTPUT_LEVEL, null); + writeObject(tri); + } + } + if (t != null) { + t.printStackTrace(); + } + } + } + + /** + * prints an error string to the error stream. All tests should use this + * method for error messages. + * + * @param s + * string to print to the error stream + * @param e + * a Throwable whose stacktrace gets printed + */ + public static void logErr(String s, Throwable e) { + if (iWhereAreWe == VM_JAVATEST) { + logHarness(s); + if (e != null) { + e.printStackTrace(); + } + } else { + if (iWhereAreWe == VM_HARNESS) { + synchronized (err) { + // just print to the appropriate stream + if (s != null && s.startsWith("SVR-ERROR")) + err.println(df.format(new Date()) + ": " + s); + else + err.println(df.format(new Date()) + ": ERROR: " + s); + } + } else { + TestReportInfo tri = new TestReportInfo("SVR-ERROR: " + s, ERROR_STREAM, + NORMAL_OUTPUT_LEVEL, null); + writeObject(tri); + } + if (e != null) { + printStackTrace(e); + } + } + } + + /** + * prints an error string to the error stream. All tests should use this + * method for error messages. + * + * @param s + * string to print to the error stream + */ + public static void logErr(String s) { + logErr(s, null); + } + + /** + * prints the contents of a properties object to the logging stream + * + * @param p + * properties to print + */ + public static void list(Properties p) { + StringBuffer sb = new StringBuffer(); + if (p == null) + return; + sb.append("--- Property Listing ---").append(TestUtil.NEW_LINE); + Enumeration e = p.propertyNames(); + String key = null; + while (e.hasMoreElements()) { + key = (String) e.nextElement(); + sb.append(key).append("=").append(p.getProperty(key)) + .append(TestUtil.NEW_LINE); + } + sb.append("--- End Property Listing ---").append(TestUtil.NEW_LINE); + logTrace(new String(sb)); + } + + /** + * prints the stacktrace of a Throwable to the logging stream + * + * @param e + * exception to print the stacktrace of + */ + public static void printStackTrace(Throwable e) { + if (e == null) { + return; + } + try { + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + e.printStackTrace(writer); + logErr(sw.toString()); + writer.close(); + } catch (Exception E) { + } + } + + /** + * prints the stacktrace of a Throwable to a string + * + * @param e + * exception to print the stacktrace of + */ + public static String printStackTraceToString(Throwable e) { + String sTrace = ""; + if (e == null) + return ""; + try { + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + e.printStackTrace(writer); + sTrace = sw.toString(); + writer.close(); + } catch (Exception E) { + } + return sTrace; + } + + /** + * prints a line of asterisks to the logging stream + */ + public static void separator2() { + logMsg("**************************************************" + + "******************************"); + } + + /** + * prints a line of dashes to the logging stream + */ + public static void separator1() { + logMsg("--------------------------------------------------" + + "------------------------------"); + } + + /** + * Convience method to handle sucking in the data from a connection. + */ + public static String getResponse(URLConnection connection) + throws IOException { + StringBuffer content; + BufferedReader in; + // set up the streams / readers + InputStream instream = connection.getInputStream(); + InputStreamReader inreader = new InputStreamReader(instream); + in = new BufferedReader(inreader); + // data structures + content = new StringBuffer(1024); + char[] chars = new char[1024]; + int length = 0; + // pull the data into the content buffer + while (length != -1) { + content.append(chars, 0, length); + length = in.read(chars, 0, chars.length); + } + // return + instream.close(); // john feb 16 + inreader.close(); // john feb 16 + in.close(); // john feb 16 + return content.toString(); + } + + /** + * Loads any properties that might be in a given String. + */ + public static Properties getResponseProperties(String string) + throws IOException { + Properties props; + ByteArrayInputStream in; + byte[] bytes; + props = new Properties(); + bytes = string.getBytes(); + in = new ByteArrayInputStream(bytes); + props.load(in); + in.close(); + return props; + } + + /** + * One shot method to get Properties directly from a URLConnection. + */ + public static Properties getResponseProperties(URLConnection connection) + throws IOException { + Properties props; + String input; + input = getResponse(connection); + props = getResponseProperties(input); + return props; + } + + public static String toEncodedString(Properties args) { + StringBuffer buf = new StringBuffer(); + Enumeration names = args.propertyNames(); + while (names.hasMoreElements()) { + String name = (String) names.nextElement(); + String value = args.getProperty(name); + buf.append(URLEncoder.encode(name)).append("=") + .append(URLEncoder.encode(value)); + if (names.hasMoreElements()) + buf.append("&"); + } + return buf.toString(); + } + + public static URLConnection sendPostData(Properties p, URL url) + throws IOException { + TestUtil.logMsg("Openning url connection to: " + url.toString()); + URLConnection urlConn = url.openConnection(); + // Begin POST of properties to SERVLET + String argString = TestUtil.toEncodedString(p); + urlConn.setDoOutput(true); + urlConn.setDoInput(true); + urlConn.setUseCaches(false); + DataOutputStream out = new DataOutputStream(urlConn.getOutputStream()); + out.writeBytes(argString); + out.flush(); + out.close(); + // End POST + return urlConn; + } + + /** + * Parse a the table name from the ddl string such as: "create table foo" or + * "delete from foo" + * + * @param value + * buffer to parse + * @return The name of the table + */ + public static String getTableName(String value) { + String tableName = ""; + if (value != null) { + tableName = value.trim(); + int pos = tableName.lastIndexOf(" "); + tableName = tableName.substring(pos + 1); + } else { + TestUtil.logMsg("Error: Null value passed for table Name"); + } + return (tableName); + } // END -- getTableName + + public static String srcToDist(String src) { + return replaceLastSrc(src, "dist"); + } + + public static String replaceLastSrc(String src, String replacement) { + // find last index of /src/, remove "src", then replace it with replacement + StringBuffer sbToConvert = new StringBuffer(src); + int iStart = src.lastIndexOf("src"); + if (iStart != -1) { + if (harnessDebug) { + TestUtil.logHarnessDebug("Pre-converted src dir = " + sbToConvert); + } + sbToConvert.replace(iStart, iStart + 3, replacement); + + if (harnessDebug) { + TestUtil.logHarnessDebug( + "Converted " + replacement + " dir = " + sbToConvert); + } + } + return sbToConvert.toString(); + } + + public static String getDistString() { + // we may need to default to src until we are ready to convert for good + return "dist"; + } + + public static String getRelativePath(String oldVal) { + if (oldVal == null) { + return oldVal; + } + String result = oldVal; + oldVal = oldVal.replace('\\', '/'); + while (oldVal.endsWith("/")) { + oldVal = oldVal.substring(0, oldVal.length() - 1); + } + if (oldVal.endsWith("/src")) { + return result; + } + int pos = oldVal.indexOf("/src/"); + if (pos == -1) { + pos = oldVal.indexOf("/dist/"); + if (pos == -1) { + result = oldVal; + } else { + result = oldVal.substring(pos + 6); // len of '/dist/' + } + } else { + result = oldVal.substring(pos + 5); + } + return result; + } + + // Convert the given string of key-value-pair into a properties object + // + // for example : + // DatabaseName=derbyDB:user=cts1:password=cts1:serverName=localhost:portNumber=1527 + // + public static Properties strToProps(String strProps) { + + logTrace("Props String = " + strProps); + Properties props = new Properties(); + String strArray[] = strProps.split(":"); // Split the given string into + // array of key value pairs + + for (String keyValuePair : strArray) { + String strArray2[] = keyValuePair.split("="); // Take the key value pair + // and store it into + // properties + logTrace("Setting property " + strArray2[0] + " = " + strArray2[1]); + props.setProperty(strArray2[0], strArray2[1]); + } + + return props; + + } + + public static void printProperties(Properties props) { + Set propertyNames = props.stringPropertyNames(); + for (String key : propertyNames) { + logTrace(key + " = " + props.getProperty(key)); + } + } + +} + +// ======================= end of class TestUtil ====================== + +class Acceptor extends Thread { + ServerSocket serverSocket; + + private Socket outputSocket = null; + + public Acceptor(ServerSocket ss) { + serverSocket = ss; + this.start(); + } + + public void run() { + while (true) { + try { + outputSocket = serverSocket.accept(); + new SocketReader(outputSocket); + // System.out.println("new connection!!!!!"); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } +} + +class TestReportInfo implements Serializable { + public int iDebugLevel = TestUtil.NORMAL_OUTPUT_LEVEL; + + public String sOutput = ""; // Constants.EMPTY_STRING; + + public Throwable exception = null; + + public int iStream = TestUtil.OUTPUT_STREAM; + + public TestReportInfo(String output, int stream, int level, Throwable e) { + if (sOutput != null) + sOutput = output; + iDebugLevel = level; + exception = e; + iStream = stream; + } +} + +class SocketReader extends Thread { + private Socket outputSocket = null; + + public SocketReader(Socket s) { + outputSocket = s; + this.start(); + } + + public void run() { + ObjectInputStream objIn; + TestReportInfo tri = null; + try { + objIn = new ObjectInputStream(outputSocket.getInputStream()); + // while((tri = (TestReportInfo)objIn.readObject()) != null) + while (true) { + tri = (TestReportInfo) objIn.readObject(); + if (tri.iDebugLevel == TestUtil.DEBUG_OUTPUT_LEVEL) { + // System.out.println("about to call logTrace"); + TestUtil.logTrace(tri.sOutput); + } else { + if (tri.iStream == TestUtil.ERROR_STREAM) { + if (tri.exception == null) + TestUtil.logErr(tri.sOutput); + else + TestUtil.logErr(tri.sOutput, tri.exception); + // System.out.println("about to call logErr"); + } else // assume outputstream + { + // System.out.println("about to call logMsg"); + TestUtil.logMsg(tri.sOutput); + } + } + } + } catch (EOFException e) { + // do nothing since the eof broke us out of the loop + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + // cleanup socket no matter what happens + /* + * try { outputSocket.close(); outputSocket = null; } catch(IOException e) { + * + * } + */ + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/WebUtil.java b/tck/old-tck/source/src/com/sun/ts/lib/util/WebUtil.java new file mode 100644 index 0000000..b11a0f1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/WebUtil.java @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.lib.util; + +import java.io.*; +import java.net.*; +import java.util.*; + +/** + * Contains convenience methods for interacting with a web server. + * + * @author Mark Roth + */ +public class WebUtil { + + /** + * Reponse object containing information returned from the web server + */ + public static class Response { + /** Version (usually HTTP/1.0) */ + public String versionToken; + + /** Status (e.g. 401) */ + public String statusToken; + + /** Location (for redirections) */ + public String location; + + /** Actual page content */ + public String content = ""; + + /** Storage for cookies */ + public Hashtable cookies = new Hashtable(); + + /** Flag; true if authentication requested */ + public boolean authenticationRequested = false; + + /** + * Parses a header line for an old-style cookie (not Set-Cookie2), and + * stores the cookie in the cookies table. Only the key and value are + * stored. Expected syntax: "Set-Cookie: NAME=VALUE[;...]" The key is stored + * in upper-case. + * + * @param cookieLine + * The string with the cookie in it. + */ + public void parseCookie(String cookieLine) { + // Strip Set-Cookie: from line: + cookieLine = cookieLine.substring("Set-Cookie:".length()).trim(); + + // Strip any additional parameters from the end of the line. + int semicolon = cookieLine.indexOf(";"); + if (semicolon != -1) { + cookieLine = cookieLine.substring(0, semicolon).trim(); + } + + // Now we have "NAME=VALUE" + int equals = cookieLine.indexOf("="); + String name = cookieLine.substring(0, equals).toUpperCase(); + String value = cookieLine.substring(equals + 1); + cookies.put(name.trim(), value.trim()); + } + + /** + * Returns true if the status token for this response represents an error, + * or false if the status token indicates the page was retrieved okay. Note + * that a redirection is not an error. + */ + public boolean isError() { + // According to RFC2616, all status tokens staring with 4xx or 5xx + // are errors. + return statusToken.startsWith("4") || statusToken.startsWith("5"); + } + } + + /** + * Converts a standard URL to a request. For example, the string + * "http://goodtimes:8000/testing" would be converted to "/testing". + * + * @param urlString + * The URL to convert + * @return The resulting GET request + * @exception MalformedURLException + * Thrown if the urlString does not contain a valid URL. + */ + public static String getRequestFromURL(String urlString) + throws MalformedURLException { + URL url = new URL(urlString); + return url.getFile(); + } + + /** + * Sends a request to the web server. A WebUtil.Response object is returned + * with the response information. + * + * @param method + * Can be either "GET" or "POST" + * @param addr + * Address of web server + * @param port + * Port of web server + * @param req + * The file to request (e.g. /jsp_dep_secContextRoot/jspSec.jsp) + * @param postData + * If this is a POST request, the data to be posted, encoded in a + * Properties class. null if no post data to be sent. + * @param cookieList + * A list of cookies to send when requesting the page. null if no + * cookie list is to be sent. + * @return WebUtil.Response object containing response information + * @exception IOException + * Thrown if request could not be made + */ + public static Response sendRequest(String method, InetAddress addr, int port, + String req, Properties postData, Hashtable cookieList) + throws IOException { + return sendAuthenticatedRequest(method, addr, port, req, postData, + cookieList, null, null); + } + + /** + * Sends an authenticated request to the web server. A WebUtil.Response object + * is returned with the response information. + * + * @param method + * Can be either "GET" or "POST" + * @param addr + * Address of web server + * @param port + * Port of web server + * @param req + * The file to request (e.g. /jsp_dep_secContextRoot/jspSec.jsp) + * @param postData + * If this is a POST request, the data to be posted, encoded in a + * Properties class. null if no post data to be sent. + * @param cookieList + * A list of cookies to send when requesting the page. null if no + * cookie list is to be sent. + * @param username + * The username for authentication, null if no authentication + * required. + * @param password + * The password for authentication, null if no authentication + * required. + * @return WebUtil.Response object containing response information + * @exception IOException + * Thrown if request could not be made + */ + public static Response sendAuthenticatedRequest(String method, + InetAddress addr, int port, String req, Properties postData, + Hashtable cookieList, String username, String password) + throws IOException { + String protocol = "HTTP/1.0"; + URL requestURL; + Socket socket = null; + PrintWriter out = null; + BufferedReader in = null; + String line = null; + Response response = new Response(); + String hostname = null; + + try { + hostname = addr.getHostName(); + requestURL = new URL("http", hostname, port, req); + req = method + " " + req + " " + protocol; + + socket = new Socket(addr, port); + + in = new BufferedReader(new InputStreamReader(socket.getInputStream())); + out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); + send(out, req); + + // send Host header + if (port == 80) { + send(out, "Host: " + hostname); + } else { + send(out, "Host: " + hostname + ':' + port); + } + + if (cookieList != null) { + // Send cookies: + Enumeration keys = cookieList.keys(); + + // Does at least one cookie exist? + if (keys.hasMoreElements()) { + String cookieString = "Cookie: "; + + // Add each cookie to the string + boolean first = true; + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + String value = (String) cookieList.get(key); + cookieString += (first ? "" : "; ") + key + "=" + value; // + "; + // $Path=/"; + first = false; + } + + // Write cookies: + send(out, cookieString); + } + } + + // Send authentication information if necessary: + if (username != null) { + String code = encodeBase64(username + ":" + password); + send(out, "Authorization: Basic " + code.trim()); + } + + // Send extra header information if we are posting. + if (postData != null) { + send(out, "Content-type: application/x-www-form-urlencoded"); + } + + // If this is a post request, send post data: + if ((postData != null) && method.toUpperCase().equals("POST")) { + String postString = TestUtil.toEncodedString(postData); + + // Skip a line: + send(out, "Content-length: " + postString.length()); + send(out, ""); + send(out, postString); + } else { + // Skip a line: + send(out, ""); + } + + out.flush(); + + // Read first line and check for HTTP version and OK. + line = in.readLine(); + if (line != null) { + TestUtil.logTrace("HEADER: " + line); + + StringTokenizer st = new StringTokenizer(line.trim()); + response.versionToken = st.nextToken(); + response.statusToken = st.nextToken(); + } + + // Read each line of the header until we hit a blank line + while ((line = in.readLine()) != null) { + TestUtil.logTrace("HEADER: " + line); + + // Blank line means we are done with the header: + if (line.trim().equals("")) + break; + + // Analyze special tags location and set cookie + if (line.toLowerCase().startsWith("location:")) { + // This is a redirect. Extract valuable infomration: + response.location = line.substring(10); + } else if (line.toLowerCase().startsWith("set-cookie:")) { + // This is a cookie. Add the cookie to the response + // object. + response.parseCookie(line); + } else if (line.toLowerCase().startsWith("www-authenticate:")) { + // Request to authenticate this page. + response.authenticationRequested = true; + } + } + + // The rest is content: + while ((line = in.readLine()) != null) { + response.content += line + "\n"; + } + + in.close(); + out.close(); + } catch (MalformedURLException e) { + throw new IOException("MalformedURLException: " + e.getMessage()); + } catch (UnknownHostException e) { + throw new IOException("UnknownHostException: " + e.getMessage()); + } catch (ConnectException e) { + throw new IOException("ConnectException: " + e.getMessage()); + } + + return response; + } + + /** + * Outputs a single line of text to the given output stream. Appends a \r\n + * automatically. By adding a System.out.println here, you can easily echo + * what is being sent to the web server. + */ + private static void send(PrintWriter out, String s) { + out.print(s + "\r\n"); + TestUtil.logTrace("REQUEST: " + s); + } + + /** + * Encodes the given string in base64 format (useful for BASIC + * authentication). Base64 encoding is defined by RFC2047. + * + * @param s + * The string to encode + * @return The encoded string + */ + public static String encodeBase64(String s) { + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encodeBuffer(s.getBytes()); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInfo.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInfo.java new file mode 100644 index 0000000..5ca6c1f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInfo.java @@ -0,0 +1,404 @@ +/* + * Copyright (c) 1999, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.util.StringTokenizer; +import java.util.jar.Attributes; +import java.util.jar.Attributes.Name; +import java.util.ResourceBundle; +import java.util.MissingResourceException; +import java.text.MessageFormat; +import java.lang.Character.*; + +/** + * This class holds all necessary information to install or upgrade a extension + * on the user's disk + * + * @author Jerome Dochez + */ +public class ExtensionInfo { + + /** + *

+ * public static values returned by the isCompatible method + *

+ */ + public static final int COMPATIBLE = 0; + + public static final int REQUIRE_SPECIFICATION_UPGRADE = 1; + + public static final int REQUIRE_IMPLEMENTATION_UPGRADE = 2; + + public static final int REQUIRE_VENDOR_SWITCH = 3; + + public static final int INCOMPATIBLE = 4; + + /** + *

+ * attributes fully describer an extension. The underlying described extension + * may be installed and requested. + *

+ */ + public String title; + + public String name; + + public String specVersion; + + public String specVendor; + + public String implementationVersion; + + public String vendor; + + public String vendorId; + + public String url; + + // For I18N support + private static final ResourceBundle rb = ResourceBundle + .getBundle("sun.misc.resources.Messages"); + + /** + *

+ * Create a new uninitialized extension information object + *

+ */ + public ExtensionInfo() { + } + + /** + *

+ * Create and initialize an extension information object. The initialization + * uses the attributes passed as being the content of a manifest file to load + * the extension information from. Since manifest file may contain information + * on several extension they may depend on, the extension key parameter is + * prepanded to the attribute name to make the key used to retrieve the + * attribute from the manifest file + *

+ * + * @param extensionKey + * unique extension key in the manifest + * @param attr + * Attributes of a manifest file + */ + public ExtensionInfo(String extensionKey, Attributes attr) + throws NullPointerException { + String s; + if (extensionKey != null) { + s = extensionKey + "-"; + } else { + s = ""; + } + + String attrKey = s + Name.EXTENSION_NAME.toString(); + name = attr.getValue(attrKey); + if (name != null) + name = name.trim(); + + attrKey = s + Name.SPECIFICATION_TITLE.toString(); + title = attr.getValue(attrKey); + if (title != null) + title = title.trim(); + + attrKey = s + Name.SPECIFICATION_VERSION.toString(); + specVersion = attr.getValue(attrKey); + if (specVersion != null) + specVersion = specVersion.trim(); + + attrKey = s + Name.SPECIFICATION_VENDOR.toString(); + specVendor = attr.getValue(attrKey); + if (specVendor != null) + specVendor = specVendor.trim(); + + attrKey = s + Name.IMPLEMENTATION_VERSION.toString(); + implementationVersion = attr.getValue(attrKey); + if (implementationVersion != null) + implementationVersion = implementationVersion.trim(); + + attrKey = s + Name.IMPLEMENTATION_VENDOR.toString(); + vendor = attr.getValue(attrKey); + if (vendor != null) + vendor = vendor.trim(); + + attrKey = s + Name.IMPLEMENTATION_VENDOR_ID.toString(); + vendorId = attr.getValue(attrKey); + if (vendorId != null) + vendorId = vendorId.trim(); + + attrKey = s + Name.IMPLEMENTATION_URL.toString(); + url = attr.getValue(attrKey); + if (url != null) + url = url.trim(); + } + + /** + *

+ * + * @return true if the extension described by this extension information is + * compatible with the extension described by the extension + * information passed as a parameter + *

+ * + * @param the + * requested extension information to compare to + */ + public int isCompatibleWith(ExtensionInfo ei) { + + if (name == null || ei.name == null) + return INCOMPATIBLE; + if (name.compareTo(ei.name) == 0) { + // is this true, if not spec version is specified, we consider + // the value as being "any". + if (specVersion == null || ei.specVersion == null) + return COMPATIBLE; + + int version = compareExtensionVersion(specVersion, ei.specVersion); + if (version < 0) { + // this extension specification is "older" + if (vendorId != null && ei.vendorId != null) { + if (vendorId.compareTo(ei.vendorId) != 0) { + return REQUIRE_VENDOR_SWITCH; + } + } + return REQUIRE_SPECIFICATION_UPGRADE; + } else { + // the extension spec is compatible, let's look at the + // implementation attributes + if (vendorId != null && ei.vendorId != null) { + // They care who provides the extension + if (vendorId.compareTo(ei.vendorId) != 0) { + // They want to use another vendor implementation + return REQUIRE_VENDOR_SWITCH; + } else { + // Vendor matches, let's see the implementation version + if (implementationVersion != null + && ei.implementationVersion != null) { + // they care about the implementation version + version = compareExtensionVersion(implementationVersion, + ei.implementationVersion); + if (version < 0) { + // This extension is an older implementation + return REQUIRE_IMPLEMENTATION_UPGRADE; + } + } + } + } + // All othe cases, we consider the extensions to be compatible + return COMPATIBLE; + } + } + return INCOMPATIBLE; + } + + /** + *

+ * helper method to print sensible information on the undelying described + * extension + *

+ */ + public String toString() { + return "Extension : title(" + title + "), name(" + name + "), spec vendor(" + + specVendor + "), spec version(" + specVersion + "), impl vendor(" + + vendor + "), impl vendor id(" + vendorId + "), impl version(" + + implementationVersion + "), impl url(" + url + ")"; + } + + /* + *

helper method to compare two versions. version are in the x.y.z.t + * pattern.

+ * + * @param source version to compare to + * + * @param target version used to compare against + * + * @return < 0 if source < version > 0 if source > version = 0 if source = + * version + */ + private int compareExtensionVersion(String source, String target) + throws NumberFormatException { + source = source.toLowerCase(); + target = target.toLowerCase(); + + return strictCompareExtensionVersion(source, target); + } + + /* + *

helper method to compare two versions. version are in the x.y.z.t + * pattern.

+ * + * @param source version to compare to + * + * @param target version used to compare against + * + * @return < 0 if source < version > 0 if source > version = 0 if source = + * version + */ + private int strictCompareExtensionVersion(String source, String target) + throws NumberFormatException { + if (source.equals(target)) + return 0; + + StringTokenizer stk = new StringTokenizer(source, ".,"); + StringTokenizer ttk = new StringTokenizer(target, ".,"); + + // Compare number + int n = 0, m = 0, result = 0; + + // Convert token into meaning number for comparision + if (stk.hasMoreTokens()) + n = convertToken(stk.nextToken().toString()); + + // Convert token into meaning number for comparision + if (ttk.hasMoreTokens()) + m = convertToken(ttk.nextToken().toString()); + + if (n > m) + return 1; + else if (m > n) + return -1; + else { + // Look for index of "." in the string + int sIdx = source.indexOf("."); + int tIdx = target.indexOf("."); + + if (sIdx == -1) + sIdx = source.length() - 1; + + if (tIdx == -1) + tIdx = target.length() - 1; + + return strictCompareExtensionVersion(source.substring(sIdx + 1), + target.substring(tIdx + 1)); + } + } + + private int convertToken(String token) { + if (token == null || token.equals("")) + return 0; + + int charValue = 0; + int charVersion = 0; + int patchVersion = 0; + int strLength = token.length(); + int endIndex = strLength; + char lastChar; + + Object[] args = { name }; + MessageFormat mf = new MessageFormat(rb.getString("optpkg.versionerror")); + String versionError = mf.format(args); + + // Look for "-" for pre-release + int prIndex = token.indexOf("-"); + + // Look for "_" for patch release + int patchIndex = token.indexOf("_"); + + if (prIndex == -1 && patchIndex == -1) { + // This is a FCS release + try { + return Integer.parseInt(token) * 100; + } catch (NumberFormatException e) { + System.out.println(versionError); + return 0; + } + } else if (patchIndex != -1) { + // This is a patch (update) release + int prversion; + try { + // Obtain the version + prversion = Integer.parseInt(token.substring(0, patchIndex)); + + // Check to see if the patch version is in the n.n.n_nnl format (special + // release) + lastChar = token.charAt(strLength - 1); + if (Character.isLetter(lastChar)) { + // letters a-z have values from 10-35 + charValue = Character.getNumericValue(lastChar); + endIndex = strLength - 1; + + // Obtain the patch version id + patchVersion = Integer + .parseInt(token.substring(patchIndex + 1, endIndex)); + + if (charValue >= Character.getNumericValue('a') + && charValue <= Character.getNumericValue('z')) { + // This is a special release + charVersion = (patchVersion * 100) + charValue; + } else { + // character is not a a-z letter, ignore + charVersion = 0; + System.out.println(versionError); + } + } else { + // This is a regular update release. Obtain the patch version id + patchVersion = Integer + .parseInt(token.substring(patchIndex + 1, endIndex)); + } + } catch (NumberFormatException e) { + System.out.println(versionError); + return 0; + } + return prversion * 100 + (patchVersion + charVersion); + } else { + // This is a milestone release, either a early access, alpha, beta, or RC + + // Obtain the version + int mrversion; + try { + mrversion = Integer.parseInt(token.substring(0, prIndex)); + } catch (NumberFormatException e) { + System.out.println(versionError); + return 0; + } + + // Obtain the patch version string, including the milestone + version + String prString = token.substring(prIndex + 1); + + // Milestone version + String msVersion = ""; + int delta = 0; + + if (prString.indexOf("ea") != -1) { + msVersion = prString.substring(2); + delta = 50; + } else if (prString.indexOf("alpha") != -1) { + msVersion = prString.substring(5); + delta = 40; + } else if (prString.indexOf("beta") != -1) { + msVersion = prString.substring(4); + delta = 30; + } else if (prString.indexOf("rc") != -1) { + msVersion = prString.substring(2); + delta = 20; + } + + if (msVersion == null || msVersion.equals("")) { + // No version after the milestone, assume 0 + return mrversion * 100 - delta; + } else { + // Convert the milestone version + try { + return mrversion * 100 - delta + Integer.parseInt(msVersion); + } catch (NumberFormatException e) { + System.out.println(versionError); + return 0; + } + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationException.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationException.java new file mode 100644 index 0000000..8db9a0e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationException.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1999, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +/* + * Exception when installation of an extension has failed for + * any reason + * + * @author Jerome Dochez + */ + +public class ExtensionInstallationException extends Exception { + + /* + *

Construct a new exception with an exception reason

+ */ + public ExtensionInstallationException(String s) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationProvider.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationProvider.java new file mode 100644 index 0000000..382cbc6 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/ExtensionInstallationProvider.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +/** + * This interface defines the contract a extension installation capable provided + * to the extension installation dependency mechanism to install new extensions + * on the user's disk + * + * @author Jerome Dochez + */ +public interface ExtensionInstallationProvider { + + /* + *

Request the installation of an extension in the extension directory + *

+ * + * @param requestExtInfo information on the extension that need to be + * installed + * + * @param installedExtInfo information on the current compatible installed + * extension. Can be null if no current installation has been found. + * + * @return true if the installation is successful, false if the installation + * could not be attempted. + * + * @exception ExtensionInstallationException if an installation was attempted + * but did not succeed. + */ + boolean installExtension(ExtensionInfo requestExtInfo, + ExtensionInfo installedExtInfo) throws ExtensionInstallationException; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/FileURLMapper.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/FileURLMapper.java new file mode 100644 index 0000000..4d7c744 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/FileURLMapper.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.net.URL; +import java.io.File; +import com.sun.ts.lib.util.sec.net.www.ParseUtil; + +/** + * (Windows) Platform specific handling for file: URLs . In particular deals + * with network paths mapping them to UNCs. + * + * @author Michael McMahon + */ + +public class FileURLMapper { + + URL url; + + String file; + + public FileURLMapper(URL url) { + this.url = url; + } + + /** + * @returns the platform specific path corresponding to the URL, and in + * particular returns a UNC when the authority contains a hostname + */ + + public String getPath() { + if (file != null) { + return file; + } + String host = url.getHost(); + if (host != null && !host.equals("") + && !"localhost".equalsIgnoreCase(host)) { + String rest = url.getFile(); + String s = host + ParseUtil.decode(url.getFile()); + file = "\\\\" + s.replace('/', '\\'); + return file; + } + String path = url.getFile().replace('/', '\\'); + file = ParseUtil.decode(path); + return file; + } + + public boolean exists() { + String path = getPath(); + File f = new File(path); + return f.exists(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/InvalidJarIndexException.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/InvalidJarIndexException.java new file mode 100644 index 0000000..a14b2f1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/InvalidJarIndexException.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1999, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.lang.LinkageError; + +/** + * Thrown if the URLClassLoader finds the INDEX.LIST file of a jar file contains + * incorrect information. + * + * @author Zhenghua Li + * @since 1.3 + */ + +public class InvalidJarIndexException extends RuntimeException { + + /** + * Constructs an InvalidJarIndexException with no detail message. + */ + public InvalidJarIndexException() { + super(); + } + + /** + * Constructs an InvalidJarIndexException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public InvalidJarIndexException(String s) { + super(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JarIndex.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JarIndex.java new file mode 100644 index 0000000..2560504 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JarIndex.java @@ -0,0 +1,306 @@ +/* + * Copyright (c) 1999, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.*; +import java.util.*; +import java.util.jar.*; +import java.util.zip.*; + +/** + * This class is used to maintain mappings from packages, classes and resources + * to their enclosing JAR files. Mappings are kept at the package level except + * for class or resource files that are located at the root directory. + * URLClassLoader uses the mapping information to determine where to fetch an + * extension class or resource from. + * + * @author Zhenghua Li + * @since 1.3 + */ + +public class JarIndex { + + /** + * The hash map that maintains mappings from package/classe/resource to jar + * file list(s) + */ + private HashMap indexMap; + + /** + * The hash map that maintains mappings from jar file to + * package/class/resource lists + */ + private HashMap jarMap; + + /* + * An ordered list of jar file names. + */ + private String[] jarFiles; + + /** + * The index file name. + */ + public static final String INDEX_NAME = "META-INF/INDEX.LIST"; + + /** + * Constructs a new, empty jar index. + */ + public JarIndex() { + indexMap = new HashMap(); + jarMap = new HashMap(); + } + + /** + * Constructs a new index from the specified input stream. + * + * @param is + * the input stream containing the index data + */ + public JarIndex(InputStream is) throws IOException { + this(); + read(is); + } + + /** + * Constructs a new index for the specified list of jar files. + * + * @param files + * the list of jar files to construct the index from. + */ + public JarIndex(String[] files) throws IOException { + this(); + this.jarFiles = files; + parseJars(files); + } + + /** + * Returns the jar index, or null if none. + * + * @param jar + * the JAR file to get the index from. + * @exception IOException + * if an I/O error has occurred. + */ + public static JarIndex getJarIndex(JarFile jar, MetaIndex metaIndex) + throws IOException { + JarIndex index = null; + /* + * If metaIndex is not null, check the meta index to see if + * META-INF/INDEX.LIST is contained in jar file or not. + */ + if (metaIndex != null && !metaIndex.mayContain(INDEX_NAME)) { + return null; + } + JarEntry e = jar.getJarEntry(INDEX_NAME); + // if found, then load the index + if (e != null) { + index = new JarIndex(jar.getInputStream(e)); + } + return index; + } + + /** + * Returns the jar files that are defined in this index. + */ + public String[] getJarFiles() { + return jarFiles; + } + + /* + * Add the key, value pair to the hashmap, the value will be put in a linked + * list which is created if necessary. + */ + private void addToList(String key, String value, HashMap t) { + LinkedList list = (LinkedList) t.get(key); + if (list == null) { + list = new LinkedList(); + list.add(value); + t.put(key, list); + } else if (!list.contains(value)) { + list.add(value); + } + } + + /** + * Returns the list of jar files that are mapped to the file. + * + * @param fileName + * the key of the mapping + */ + public LinkedList get(String fileName) { + LinkedList jarFiles = null; + if ((jarFiles = (LinkedList) indexMap.get(fileName)) == null) { + /* try the package name again */ + int pos; + if ((pos = fileName.lastIndexOf("/")) != -1) { + jarFiles = (LinkedList) indexMap.get(fileName.substring(0, pos)); + } + } + return jarFiles; + } + + /** + * Add the mapping from the specified file to the specified jar file. If there + * were no mapping for the package of the specified file before, a new linked + * list will be created, the jar file is added to the list and a new mapping + * from the package to the jar file list is added to the hashmap. Otherwise, + * the jar file will be added to the end of the existing list. + * + * @param fileName + * the file name + * @param jarName + * the jar file that the file is mapped to + * + */ + public void add(String fileName, String jarName) { + String packageName; + int pos; + if ((pos = fileName.lastIndexOf("/")) != -1) { + packageName = fileName.substring(0, pos); + } else { + packageName = fileName; + } + + // add the mapping to indexMap + addToList(packageName, jarName, indexMap); + + // add the mapping to jarMap + addToList(jarName, packageName, jarMap); + } + + /** + * Go through all the jar files and construct the index table. + */ + private void parseJars(String[] files) throws IOException { + if (files == null) { + return; + } + + String currentJar = null; + + for (int i = 0; i < files.length; i++) { + currentJar = files[i]; + ZipFile zrf = new ZipFile(currentJar.replace('/', File.separatorChar)); + + Enumeration entries = zrf.entries(); + while (entries.hasMoreElements()) { + String fileName = ((ZipEntry) (entries.nextElement())).getName(); + // Index the META-INF directory, but not the index or manifest. + if (!fileName.startsWith("META-INF/") + || !(fileName.equals("META-INF/") || fileName.equals(INDEX_NAME) + || fileName.equals(JarFile.MANIFEST_NAME))) { + add(fileName, currentJar); + } + } + zrf.close(); + } + } + + /** + * Writes the index to the specified OutputStream + * + * @param out + * the output stream + * @exception IOException + * if an I/O error has occurred + */ + public void write(OutputStream out) throws IOException { + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out, "UTF8")); + bw.write("JarIndex-Version: 1.0\n\n"); + + if (jarFiles != null) { + for (int i = 0; i < jarFiles.length; i++) { + /* print out the jar file name */ + String jar = jarFiles[i]; + bw.write(jar + "\n"); + LinkedList jarlist = (LinkedList) jarMap.get(jar); + if (jarlist != null) { + Iterator listitr = jarlist.iterator(); + while (listitr.hasNext()) { + bw.write((String) (listitr.next()) + "\n"); + } + } + bw.write("\n"); + } + bw.flush(); + } + } + + /** + * Reads the index from the specified InputStream. + * + * @param is + * the input stream + * @exception IOException + * if an I/O error has occurred + */ + public void read(InputStream is) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF8")); + String line = null; + String currentJar = null; + + /* an ordered list of jar file names */ + Vector jars = new Vector(); + + /* read until we see a .jar line */ + while ((line = br.readLine()) != null && !line.endsWith(".jar")) + ; + + for (; line != null; line = br.readLine()) { + if (line.length() == 0) + continue; + + if (line.endsWith(".jar")) { + currentJar = line; + jars.add(currentJar); + } else { + String name = line; + addToList(name, currentJar, indexMap); + addToList(currentJar, name, jarMap); + } + } + + jarFiles = (String[]) jars.toArray(new String[jars.size()]); + } + + /** + * Merges the current index into another index, taking into account the + * relative path of the current index. + * + * @param toIndex + * The destination index which the current index will merge into. + * @param path + * The relative path of the this index to the destination index. + * + */ + public void merge(JarIndex toIndex, String path) { + Iterator itr = indexMap.entrySet().iterator(); + while (itr.hasNext()) { + Map.Entry e = (Map.Entry) itr.next(); + String packageName = (String) e.getKey(); + LinkedList from_list = (LinkedList) e.getValue(); + Iterator listItr = from_list.iterator(); + while (listItr.hasNext()) { + String jarName = (String) listItr.next(); + if (path != null) { + jarName = path.concat(jarName); + } + toIndex.add(packageName, jarName); + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOAccess.java new file mode 100644 index 0000000..1f75cab --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOAccess.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.Console; +import java.nio.charset.Charset; + +public interface JavaIOAccess { + public Console console(); + + public Runnable consoleRestoreHook(); + + public Charset charset(); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIODeleteOnExitAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIODeleteOnExitAccess.java new file mode 100644 index 0000000..b8508fe --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIODeleteOnExitAccess.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +public interface JavaIODeleteOnExitAccess extends Runnable { + public void run(); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOFileDescriptorAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOFileDescriptorAccess.java new file mode 100644 index 0000000..fcb7ba1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaIOFileDescriptorAccess.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.FileDescriptor; + +/* + * @author Chris Hegarty + */ + +public interface JavaIOFileDescriptorAccess { + public void set(FileDescriptor obj, int fd); + + public int get(FileDescriptor fd); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaLangAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaLangAccess.java new file mode 100644 index 0000000..b549389 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaLangAccess.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import com.sun.ts.lib.util.sec.reflect.ConstantPool; +import com.sun.ts.lib.util.sec.reflect.annotation.AnnotationType; +import com.sun.ts.lib.util.sec.nio.ch.Interruptible; + +public interface JavaLangAccess { + /** Return the constant pool for a class. */ + ConstantPool getConstantPool(Class klass); + + /** + * Set the AnnotationType instance corresponding to this class. (This method + * only applies to annotation types.) + */ + void setAnnotationType(Class klass, AnnotationType annotationType); + + /** + * Get the AnnotationType instance corresponding to this class. (This method + * only applies to annotation types.) + */ + AnnotationType getAnnotationType(Class klass); + + /** + * Returns the elements of an enum class or null if the Class object does not + * represent an enum type; the result is uncloned, cached, and shared by all + * callers. + */ + > E[] getEnumConstantsShared(Class klass); + + /** Set thread's blocker field. */ + void blockedOn(Thread t, Interruptible b); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaNetAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaNetAccess.java new file mode 100644 index 0000000..fffb3c7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaNetAccess.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.net.URLClassLoader; + +public interface JavaNetAccess { + /** + * return the URLClassPath belonging to the given loader + */ + URLClassPath getURLClassPath(URLClassLoader u); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityAccess.java new file mode 100644 index 0000000..98c6b0a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityAccess.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.security.AccessControlContext; +import java.security.PrivilegedAction; + +public interface JavaSecurityAccess { + + T doIntersectionPrivilege(PrivilegedAction action, + AccessControlContext stack, AccessControlContext context); + + T doIntersectionPrivilege(PrivilegedAction action, + AccessControlContext context); + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityProtectionDomainAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityProtectionDomainAccess.java new file mode 100644 index 0000000..259272e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaSecurityProtectionDomainAccess.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.security.PermissionCollection; +import java.security.ProtectionDomain; + +public interface JavaSecurityProtectionDomainAccess { + interface ProtectionDomainCache { + void put(ProtectionDomain pd, PermissionCollection pc); + + PermissionCollection get(ProtectionDomain pd); + } + + /** + * Returns the ProtectionDomainCache. + */ + ProtectionDomainCache getProtectionDomainCache(); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaUtilJarAccess.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaUtilJarAccess.java new file mode 100644 index 0000000..60b4db3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/JavaUtilJarAccess.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.IOException; +import java.util.jar.JarFile; + +public interface JavaUtilJarAccess { + public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Launcher.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Launcher.java new file mode 100644 index 0000000..d7a046d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Launcher.java @@ -0,0 +1,450 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.File; +import java.io.IOException; +import java.io.FilePermission; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.MalformedURLException; +import java.net.URLStreamHandler; +import java.net.URLStreamHandlerFactory; +import java.util.HashSet; +import java.util.Set; +import java.util.Vector; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.AccessControlContext; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.ProtectionDomain; +import java.security.CodeSource; +import com.sun.ts.lib.util.sec.security.action.GetPropertyAction; +import com.sun.ts.lib.util.sec.security.util.SecurityConstants; +import com.sun.ts.lib.util.sec.net.www.ParseUtil; + +/** + * This class is used by the system to launch the main application. Launcher + */ +public class Launcher { + private static URLStreamHandlerFactory factory = new Factory(); + + private static Launcher launcher = new Launcher(); + + public static Launcher getLauncher() { + return launcher; + } + + private ClassLoader loader; + + public Launcher() { + + // Now create the class loader to use to launch the application + try { + loader = AppClassLoader.getAppClassLoader(new ExtClassLoader(null)); + } catch (IOException e) { + throw new InternalError("Could not create application class loader"); + } + + // Also set the context class loader for the primordial thread. + Thread.currentThread().setContextClassLoader(loader); + + // Finally, install a security manager if requested + String s = System.getProperty("java.security.manager"); + if (s != null) { + SecurityManager sm = null; + if ("".equals(s) || "default".equals(s)) { + sm = new java.lang.SecurityManager(); + } else { + try { + sm = (SecurityManager) loader.loadClass(s).newInstance(); + } catch (IllegalAccessException e) { + } catch (InstantiationException e) { + } catch (ClassNotFoundException e) { + } catch (ClassCastException e) { + } + } + if (sm != null) { + System.setSecurityManager(sm); + } else { + throw new InternalError("Could not create SecurityManager: " + s); + } + } + } + + /* + * Returns the class loader used to launch the main application. + */ + public ClassLoader getClassLoader() { + return loader; + } + + /* + * The class loader used for loading installed extensions. + */ + static class ExtClassLoader extends URLClassLoader { + + void addExtURL(URL url) { + super.addURL(url); + } + + /* + * Creates a new ExtClassLoader for the specified directories. + */ + public ExtClassLoader(File[] ignore) throws IOException { + super(new URL[0], null, factory); + } + + /* + * Searches the installed extension directories for the specified library + * name. For each extension directory, we first look for the native library + * in the subdirectory whose name is the value of the system property + * os.arch. Failing that, we look in the extension directory + * itself. + */ + public String findLibrary(String name) { + return null; + } + + private static AccessControlContext getContext(File[] dirs) + throws IOException { + PathPermissions perms = new PathPermissions(dirs); + + ProtectionDomain domain = new ProtectionDomain(new CodeSource( + perms.getCodeBase(), (java.security.cert.Certificate[]) null), perms); + + AccessControlContext acc = new AccessControlContext( + new ProtectionDomain[] { domain }); + + return acc; + } + } + + /** + * The class loader used for loading from java.class.path. runs in a + * restricted security context. + */ + static class AppClassLoader extends URLClassLoader { + + public static ClassLoader getAppClassLoader(final ClassLoader extcl) + throws IOException { + final String s = System.getProperty("java.class.path"); + final File[] path = (s == null) ? new File[0] : getClassPath(s); + + // Note: on bugid 4256530 + // Prior implementations of this doPrivileged() block supplied + // a rather restrictive ACC via a call to the private method + // AppClassLoader.getContext(). This proved overly restrictive + // when loading classes. Specifically it prevent + // accessClassInPackage.sun.* grants from being honored. + // + return (AppClassLoader) AccessController + .doPrivileged(new PrivilegedAction() { + public Object run() { + URL[] urls = (s == null) ? new URL[0] : pathToURLs(path); + return new AppClassLoader(urls, extcl); + } + }); + } + + /* + * Creates a new AppClassLoader + */ + AppClassLoader(URL[] urls, ClassLoader parent) { + super(urls, parent, factory); + } + + /** + * Override loadClass so we can checkPackageAccess. + */ + public synchronized Class loadClass(String name, boolean resolve) + throws ClassNotFoundException { + int i = name.lastIndexOf('.'); + if (i != -1) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPackageAccess(name.substring(0, i)); + } + } + return (super.loadClass(name, resolve)); + } + + /** + * allow any classes loaded from classpath to exit the VM. + */ + protected PermissionCollection getPermissions(CodeSource codesource) { + PermissionCollection perms = super.getPermissions(codesource); + perms.add(new RuntimePermission("exitVM")); + return perms; + } + + /** + * This class loader supports dynamic additions to the class path at + * runtime. + * + * @see java.lang.instrument.Instrumentation#appendToSystemClassPathSearch + */ + private void appendToClassPathForInstrumentation(String path) { + assert (Thread.holdsLock(this)); + + // addURL is a no-op if path already contains the URL + super.addURL(getFileURL(new File(path))); + } + + /** + * create a context that can read any directories (recursively) mentioned in + * the class path. In the case of a jar, it has to be the directory + * containing the jar, not just the jar, as jar files might refer to other + * jar files. + */ + + private static AccessControlContext getContext(File[] cp) + throws java.net.MalformedURLException { + PathPermissions perms = new PathPermissions(cp); + + ProtectionDomain domain = new ProtectionDomain(new CodeSource( + perms.getCodeBase(), (java.security.cert.Certificate[]) null), perms); + + AccessControlContext acc = new AccessControlContext( + new ProtectionDomain[] { domain }); + + return acc; + } + } + + public static URLClassPath getBootstrapClassPath() { + String prop = AccessController + .doPrivileged(new GetPropertyAction("sun.boot.class.path")); + URL[] urls; + if (prop != null) { + final String path = prop; + urls = (URL[]) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + File[] classPath = getClassPath(path); + int len = classPath.length; + Set seenDirs = new HashSet(); + for (int i = 0; i < len; i++) { + File curEntry = classPath[i]; + // Negative test used to properly handle + // nonexistent jars on boot class path + if (!curEntry.isDirectory()) { + curEntry = curEntry.getParentFile(); + } + if (curEntry != null && seenDirs.add(curEntry)) { + MetaIndex.registerDirectory(curEntry); + } + } + return pathToURLs(classPath); + } + }); + } else { + urls = new URL[0]; + } + return new URLClassPath(urls, factory); + } + + private static URL[] pathToURLs(File[] path) { + URL[] urls = new URL[path.length]; + for (int i = 0; i < path.length; i++) { + urls[i] = getFileURL(path[i]); + } + // DEBUG + // for (int i = 0; i < urls.length; i++) { + // System.out.println("urls[" + i + "] = " + '"' + urls[i] + '"'); + // } + return urls; + } + + private static File[] getClassPath(String cp) { + File[] path; + if (cp != null) { + int count = 0, maxCount = 1; + int pos = 0, lastPos = 0; + // Count the number of separators first + while ((pos = cp.indexOf(File.pathSeparator, lastPos)) != -1) { + maxCount++; + lastPos = pos + 1; + } + path = new File[maxCount]; + lastPos = pos = 0; + // Now scan for each path component + while ((pos = cp.indexOf(File.pathSeparator, lastPos)) != -1) { + if (pos - lastPos > 0) { + path[count++] = new File(cp.substring(lastPos, pos)); + } else { + // empty path component translates to "." + path[count++] = new File("."); + } + lastPos = pos + 1; + } + // Make sure we include the last path component + if (lastPos < cp.length()) { + path[count++] = new File(cp.substring(lastPos)); + } else { + path[count++] = new File("."); + } + // Trim array to correct size + if (count != maxCount) { + File[] tmp = new File[count]; + System.arraycopy(path, 0, tmp, 0, count); + path = tmp; + } + } else { + path = new File[0]; + } + // DEBUG + // for (int i = 0; i < path.length; i++) { + // System.out.println("path[" + i + "] = " + '"' + path[i] + '"'); + // } + return path; + } + + private static URLStreamHandler fileHandler; + + static URL getFileURL(File file) { + try { + file = file.getCanonicalFile(); + } catch (IOException e) { + } + + try { + return ParseUtil.fileToEncodedURL(file); + } catch (MalformedURLException e) { + // Should never happen since we specify the protocol... + throw new InternalError(); + } + } + + /* + * The stream handler factory for loading system protocol handlers. + */ + private static class Factory implements URLStreamHandlerFactory { + private static String PREFIX = "sun.net.www.protocol"; + + public URLStreamHandler createURLStreamHandler(String protocol) { + String name = PREFIX + "." + protocol + ".Handler"; + try { + Class c = Class.forName(name); + return (URLStreamHandler) c.newInstance(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + throw new InternalError( + "could not load " + protocol + "system protocol handler"); + } + } +} + +class PathPermissions extends PermissionCollection { + // use serialVersionUID from JDK 1.2.2 for interoperability + private static final long serialVersionUID = 8133287259134945693L; + + private File path[]; + + private Permissions perms; + + URL codeBase; + + PathPermissions(File path[]) { + this.path = path; + this.perms = null; + this.codeBase = null; + } + + URL getCodeBase() { + return codeBase; + } + + public void add(java.security.Permission permission) { + throw new SecurityException("attempt to add a permission"); + } + + private synchronized void init() { + if (perms != null) + return; + + perms = new Permissions(); + + // this is needed to be able to create the classloader itself! + perms.add(SecurityConstants.CREATE_CLASSLOADER_PERMISSION); + + // add permission to read any "java.*" property + perms.add(new java.util.PropertyPermission("java.*", + SecurityConstants.PROPERTY_READ_ACTION)); + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + for (int i = 0; i < path.length; i++) { + File f = path[i]; + String path; + try { + path = f.getCanonicalPath(); + } catch (IOException ioe) { + path = f.getAbsolutePath(); + } + if (i == 0) { + codeBase = Launcher.getFileURL(new File(path)); + } + if (f.isDirectory()) { + if (path.endsWith(File.separator)) { + perms.add(new FilePermission(path + "-", + SecurityConstants.FILE_READ_ACTION)); + } else { + perms.add(new FilePermission(path + File.separator + "-", + SecurityConstants.FILE_READ_ACTION)); + } + } else { + int endIndex = path.lastIndexOf(File.separatorChar); + if (endIndex != -1) { + path = path.substring(0, endIndex + 1) + "-"; + perms.add( + new FilePermission(path, SecurityConstants.FILE_READ_ACTION)); + } else { + // XXX? + } + } + } + return null; + } + }); + } + + public boolean implies(java.security.Permission permission) { + if (perms == null) + init(); + return perms.implies(permission); + } + + public java.util.Enumeration elements() { + if (perms == null) + init(); + synchronized (perms) { + return perms.elements(); + } + } + + public String toString() { + if (perms == null) + init(); + return perms.toString(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/MetaIndex.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/MetaIndex.java new file mode 100644 index 0000000..124dde1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/MetaIndex.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* + * MetaIndex is intended to decrease startup time (in particular cold + * start, when files are not yet in the disk cache) by providing a + * quick reject mechanism for probes into jar files. The on-disk + * representation of the meta-index is a flat text file with per-jar + * entries indicating (generally speaking) prefixes of package names + * contained in the jar. As an example, here is an edited excerpt of + * the meta-index generated for jre/lib in the current build: + * +
+% VERSION 1
+# charsets.jar
+sun/
+# jce.jar
+javax/
+! jsse.jar
+sun/
+com/sun/net/
+javax/
+com/sun/security/
+@ resources.jar
+com/sun/xml/
+com/sun/rowset/
+com/sun/org/
+sun/
+com/sun/imageio/
+javax/
+com/sun/java/swing/
+META-INF/services/
+com/sun/java/util/jar/pack/
+com/sun/corba/
+com/sun/jndi/
+! rt.jar
+org/w3c/
+com/sun/imageio/
+javax/
+sunw/util/
+java/
+sun/
+...
+
+ *

A few notes about the design of the meta-index: + * + *

    + * + *
  • It contains entries for multiple jar files. This is + * intentional, to reduce the number of disk accesses that need to be + * performed during startup. + * + *
  • It is only intended to act as a fast reject mechanism to + * prevent application and other classes from forcing all jar files on + * the boot and extension class paths to be opened. It is not intended + * as a precise index of the contents of the jar. + * + *
  • It should be as small as possible to reduce the amount of time + * required to parse it during startup. For example, adding on the + * secondary package element to java/ and javax/ packages + * ("javax/swing/", for example) causes the meta-index to grow + * significantly. This is why substrings of the packages have been + * chosen as the principal contents. + * + *
  • It is versioned, and optional, to prevent strong dependencies + * between the JVM and JDK. It is also potentially applicable to more + * than just the boot and extension class paths. + * + *
  • Precisely speaking, it plays different role in JVM and J2SE + * side. On the JVM side, meta-index file is used to speed up locating the + * class files only while on the J2SE side, meta-index file is used to speed + * up the resources file & class file. + * To help the JVM and J2SE code to better utilize the information in meta-index + * file, we mark the jar file differently. Here is the current rule we use. + * For jar file containing only class file, we put '!' before the jar file name; + * for jar file containing only resources file, we put '@' before the jar file name; + * for jar file containing both resources and class file, we put '#' before the + * jar name. + * Notice the fact that every jar file contains at least the manifest file, so when + * we say "jar file containing only class file", we don't include that file. + * + *
+ * + *

To avoid changing the behavior of the current application + * loader and other loaders, the current MetaIndex implementation in + * the JDK requires that the directory containing the meta-index be + * registered with the MetaIndex class before construction of the + * associated URLClassPath. This prevents the need for automatic + * searching for the meta-index in the URLClassPath code and potential + * changes in behavior for non-core ClassLoaders. + * + * This class depends on make/tools/MetaIndex/BuildMetaIndex.java and + * is used principally by sun.misc.URLClassPath. + */ + +public class MetaIndex { + // Maps jar file names in registered directories to meta-indices + private static volatile Map jarMap; + + // List of contents of this meta-index + private String[] contents; + + // Indicate whether the coresponding jar file is a pure class jar file or not + private boolean isClassOnlyJar; + + // ---------------------------------------------------------------------- + // Registration of directories (which can cause parsing of the + // meta-index file if it is present), and fetching of parsed + // meta-indices + // jarMap is not strictly thread-safe when the meta index mechanism + // is extended for user-provided jar files in future. + + public static MetaIndex forJar(File jar) { + return getJarMap().get(jar); + } + + // 'synchronized' is added to protect the jarMap from being modified + // by multiple threads. + public static synchronized void registerDirectory(File dir) { + // Note that this does not currently check to see whether the + // directory has previously been registered, since the meta-index + // in a particular directory creates multiple entries in the + // jarMap. If this mechanism is extended beyond the boot and + // extension class paths (for example, automatically searching for + // meta-index files in directories containing jars which have been + // explicitly opened) then this code should be generalized. + // + // This method must be called from a privileged context. + File indexFile = new File(dir, "meta-index"); + if (indexFile.exists()) { + try { + BufferedReader reader = new BufferedReader(new FileReader(indexFile)); + String line = null; + String curJarName = null; + boolean isCurJarContainClassOnly = false; + List contents = new ArrayList(); + Map map = getJarMap(); + + /* Convert dir into canonical form. */ + dir = dir.getCanonicalFile(); + /* + * Note: The first line should contain the version of the meta-index + * file. We have to match the right version before trying to parse this + * file. + */ + line = reader.readLine(); + if (line == null || !line.equals("% VERSION 2")) { + reader.close(); + return; + } + while ((line = reader.readLine()) != null) { + switch (line.charAt(0)) { + case '!': + case '#': + case '@': { + // Store away current contents, if any + if ((curJarName != null) && (contents.size() > 0)) { + map.put(new File(dir, curJarName), + new MetaIndex(contents, isCurJarContainClassOnly)); + + contents.clear(); + } + // Fetch new current jar file name + curJarName = line.substring(2); + if (line.charAt(0) == '!') { + isCurJarContainClassOnly = true; + } else if (isCurJarContainClassOnly) { + isCurJarContainClassOnly = false; + } + + break; + } + case '%': + break; + default: { + contents.add(line); + } + } + } + // Store away current contents, if any + if ((curJarName != null) && (contents.size() > 0)) { + map.put(new File(dir, curJarName), + new MetaIndex(contents, isCurJarContainClassOnly)); + } + + reader.close(); + + } catch (IOException e) { + // Silently fail for now (similar behavior to elsewhere in + // extension and core loaders) + } + } + } + + // ---------------------------------------------------------------------- + // Public APIs + // + + public boolean mayContain(String entry) { + // Ask non-class file from class only jar returns false + // This check is important to avoid some class only jar + // files such as rt.jar are opened for resource request. + if (isClassOnlyJar && !entry.endsWith(".class")) { + return false; + } + + String[] conts = contents; + for (int i = 0; i < conts.length; i++) { + if (entry.startsWith(conts[i])) { + return true; + } + } + return false; + } + + // ---------------------------------------------------------------------- + // Implementation only below this point + // @IllegalArgumentException if entries is null. + private MetaIndex(List entries, boolean isClassOnlyJar) + throws IllegalArgumentException { + if (entries == null) { + throw new IllegalArgumentException(); + } + + contents = entries.toArray(new String[0]); + this.isClassOnlyJar = isClassOnlyJar; + } + + private static Map getJarMap() { + if (jarMap == null) { + synchronized (MetaIndex.class) { + if (jarMap == null) { + jarMap = new HashMap(); + } + } + } + assert jarMap != null; + return jarMap; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Resource.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Resource.java new file mode 100644 index 0000000..960ff58 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Resource.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.io.EOFException; +import java.net.URL; +import java.io.IOException; +import java.io.InterruptedIOException; +import java.io.InputStream; +import java.security.CodeSigner; +import java.util.jar.Manifest; +import java.nio.ByteBuffer; +import java.util.Arrays; +import com.sun.ts.lib.util.sec.nio.ByteBuffered; + +/** + * This class is used to represent a Resource that has been loaded from the + * class path. + * + * @author David Connelly + * @since 1.2 + */ +public abstract class Resource { + /** + * Returns the name of the Resource. + */ + public abstract String getName(); + + /** + * Returns the URL of the Resource. + */ + public abstract URL getURL(); + + /** + * Returns the CodeSource URL for the Resource. + */ + public abstract URL getCodeSourceURL(); + + /** + * Returns an InputStream for reading the Resource data. + */ + public abstract InputStream getInputStream() throws IOException; + + /** + * Returns the length of the Resource data, or -1 if unknown. + */ + public abstract int getContentLength() throws IOException; + + private InputStream cis; + + /* Cache result in case getBytes is called after getByteBuffer. */ + private synchronized InputStream cachedInputStream() throws IOException { + if (cis == null) { + cis = getInputStream(); + } + return cis; + } + + /** + * Returns the Resource data as an array of bytes. + */ + public byte[] getBytes() throws IOException { + byte[] b; + // Get stream before content length so that a FileNotFoundException + // can propagate upwards without being caught too early + InputStream in = cachedInputStream(); + + // This code has been uglified to protect against interrupts. + // Even if a thread has been interrupted when loading resources, + // the IO should not abort, so must carefully retry, failing only + // if the retry leads to some other IO exception. + + boolean isInterrupted = Thread.interrupted(); + int len; + for (;;) { + try { + len = getContentLength(); + break; + } catch (InterruptedIOException iioe) { + Thread.interrupted(); + isInterrupted = true; + } + } + + try { + b = new byte[0]; + if (len == -1) + len = Integer.MAX_VALUE; + int pos = 0; + while (pos < len) { + int bytesToRead; + if (pos >= b.length) { // Only expand when there's no room + bytesToRead = Math.min(len - pos, b.length + 1024); + if (b.length < pos + bytesToRead) { + b = Arrays.copyOf(b, pos + bytesToRead); + } + } else { + bytesToRead = b.length - pos; + } + int cc = 0; + try { + cc = in.read(b, pos, bytesToRead); + } catch (InterruptedIOException iioe) { + Thread.interrupted(); + isInterrupted = true; + } + if (cc < 0) { + if (len != Integer.MAX_VALUE) { + throw new EOFException("Detect premature EOF"); + } else { + if (b.length != pos) { + b = Arrays.copyOf(b, pos); + } + break; + } + } + pos += cc; + } + } finally { + try { + in.close(); + } catch (InterruptedIOException iioe) { + isInterrupted = true; + } catch (IOException ignore) { + } + + if (isInterrupted) { + Thread.currentThread().interrupt(); + } + } + return b; + } + + /** + * Returns the Resource data as a ByteBuffer, but only if the input stream was + * implemented on top of a ByteBuffer. Return null otherwise. + */ + public ByteBuffer getByteBuffer() throws IOException { + InputStream in = cachedInputStream(); + if (in instanceof ByteBuffered) { + return ((ByteBuffered) in).getByteBuffer(); + } + return null; + } + + /** + * Returns the Manifest for the Resource, or null if none. + */ + public Manifest getManifest() throws IOException { + return null; + } + + /** + * Returns theCertificates for the Resource, or null if none. + */ + public java.security.cert.Certificate[] getCertificates() { + return null; + } + + /** + * Returns the code signers for the Resource, or null if none. + */ + public CodeSigner[] getCodeSigners() { + return null; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/SharedSecrets.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/SharedSecrets.java new file mode 100644 index 0000000..07a7af7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/SharedSecrets.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.util.jar.JarFile; +import java.io.Console; +import java.io.File; +import java.io.FileDescriptor; +import java.security.ProtectionDomain; + +import java.security.AccessController; + +/** + * A repository of "shared secrets", which are a mechanism for calling + * implementation-private methods in another package without using reflection. A + * package-private class implements a public interface and provides the ability + * to call package-private methods within that package; the object implementing + * that interface is provided through a third package to which access is + * restricted. This framework avoids the primary disadvantage of using + * reflection for this purpose, namely the loss of compile-time checking. + */ + +public class SharedSecrets { + private static final Unsafe unsafe = Unsafe.getUnsafe(); + + private static JavaUtilJarAccess javaUtilJarAccess; + + private static JavaLangAccess javaLangAccess; + + private static JavaIOAccess javaIOAccess; + + private static JavaIODeleteOnExitAccess javaIODeleteOnExitAccess; + + private static JavaNetAccess javaNetAccess; + + private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; + + private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; + + private static JavaSecurityAccess javaSecurityAccess; + + public static JavaUtilJarAccess javaUtilJarAccess() { + if (javaUtilJarAccess == null) { + // Ensure JarFile is initialized; we know that that class + // provides the shared secret + unsafe.ensureClassInitialized(JarFile.class); + } + return javaUtilJarAccess; + } + + public static void setJavaUtilJarAccess(JavaUtilJarAccess access) { + javaUtilJarAccess = access; + } + + public static void setJavaLangAccess(JavaLangAccess jla) { + javaLangAccess = jla; + } + + public static JavaLangAccess getJavaLangAccess() { + return javaLangAccess; + } + + public static void setJavaNetAccess(JavaNetAccess jna) { + javaNetAccess = jna; + } + + public static JavaNetAccess getJavaNetAccess() { + return javaNetAccess; + } + + public static void setJavaIOAccess(JavaIOAccess jia) { + javaIOAccess = jia; + } + + public static JavaIOAccess getJavaIOAccess() { + if (javaIOAccess == null) { + unsafe.ensureClassInitialized(Console.class); + } + return javaIOAccess; + } + + public static void setJavaIODeleteOnExitAccess( + JavaIODeleteOnExitAccess jida) { + javaIODeleteOnExitAccess = jida; + } + + public static JavaIODeleteOnExitAccess getJavaIODeleteOnExitAccess() { + if (javaIODeleteOnExitAccess == null) { + unsafe.ensureClassInitialized(File.class); + } + return javaIODeleteOnExitAccess; + } + + public static void setJavaIOFileDescriptorAccess( + JavaIOFileDescriptorAccess jiofda) { + javaIOFileDescriptorAccess = jiofda; + } + + public static JavaIOFileDescriptorAccess getJavaIOFileDescriptorAccess() { + if (javaIOFileDescriptorAccess == null) + unsafe.ensureClassInitialized(FileDescriptor.class); + + return javaIOFileDescriptorAccess; + } + + public static void setJavaSecurityProtectionDomainAccess( + JavaSecurityProtectionDomainAccess jspda) { + javaSecurityProtectionDomainAccess = jspda; + } + + public static JavaSecurityProtectionDomainAccess getJavaSecurityProtectionDomainAccess() { + if (javaSecurityProtectionDomainAccess == null) + unsafe.ensureClassInitialized(ProtectionDomain.class); + + return javaSecurityProtectionDomainAccess; + } + + public static void setJavaSecurityAccess(JavaSecurityAccess jsa) { + javaSecurityAccess = jsa; + } + + public static JavaSecurityAccess getJavaSecurityAccess() { + if (javaSecurityAccess == null) { + unsafe.ensureClassInitialized(AccessController.class); + } + return javaSecurityAccess; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/URLClassPath.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/URLClassPath.java new file mode 100644 index 0000000..a27f442 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/URLClassPath.java @@ -0,0 +1,1048 @@ +/* + * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Hashtable; +import java.util.NoSuchElementException; +import java.util.Stack; +import java.util.Set; +import java.util.HashSet; +import java.util.StringTokenizer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.jar.JarFile; +import com.sun.ts.lib.util.sec.misc.JarIndex; +import com.sun.ts.lib.util.sec.misc.InvalidJarIndexException; +import com.sun.ts.lib.util.sec.net.www.ParseUtil; +import java.util.zip.ZipEntry; +import java.util.jar.JarEntry; +import java.util.jar.Manifest; +import java.util.jar.Attributes; +import java.util.jar.Attributes.Name; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.HttpURLConnection; +import java.net.URLStreamHandler; +import java.net.URLStreamHandlerFactory; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.security.AccessController; +import java.security.AccessControlException; +import java.security.CodeSigner; +import java.security.Permission; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.security.cert.Certificate; +import com.sun.ts.lib.util.sec.misc.FileURLMapper; + +/** + * This class is used to maintain a search path of URLs for loading classes and + * resources from both JAR files and directories. + * + * @author David Connelly + */ +public class URLClassPath { + final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version"; + + final static String JAVA_VERSION; + + private static final boolean DEBUG; + + static { + JAVA_VERSION = java.security.AccessController.doPrivileged( + new com.sun.ts.lib.util.sec.security.action.GetPropertyAction( + "java.version")); + DEBUG = (java.security.AccessController.doPrivileged( + new com.sun.ts.lib.util.sec.security.action.GetPropertyAction( + "sun.misc.URLClassPath.debug")) != null); + } + + /* The original search path of URLs. */ + private ArrayList path = new ArrayList(); + + /* The stack of unopened URLs */ + Stack urls = new Stack(); + + /* The resulting search path of Loaders */ + ArrayList loaders = new ArrayList(); + + /* Map of each URL opened to its corresponding Loader */ + HashMap lmap = new HashMap(); + + /* The jar protocol handler to use when creating new URLs */ + private URLStreamHandler jarHandler; + + /** + * Creates a new URLClassPath for the given URLs. The URLs will be searched in + * the order specified for classes and resources. A URL ending with a '/' is + * assumed to refer to a directory. Otherwise, the URL is assumed to refer to + * a JAR file. + * + * @param urls + * the directory and JAR file URLs to search for classes and + * resources + * @param factory + * the URLStreamHandlerFactory to use when creating new URLs + */ + public URLClassPath(URL[] urls, URLStreamHandlerFactory factory) { + for (int i = 0; i < urls.length; i++) { + path.add(urls[i]); + } + push(urls); + if (factory != null) { + jarHandler = factory.createURLStreamHandler("jar"); + } + } + + public URLClassPath(URL[] urls) { + this(urls, null); + } + + /** + * Appends the specified URL to the search path of directory and JAR file URLs + * from which to load classes and resources. + */ + public void addURL(URL url) { + synchronized (urls) { + if (path.contains(url)) + return; + + urls.add(0, url); + path.add(url); + } + } + + /** + * Returns the original search path of URLs. + */ + public URL[] getURLs() { + synchronized (urls) { + return (URL[]) path.toArray(new URL[path.size()]); + } + } + + /** + * Finds the resource with the specified name on the URL search path or null + * if not found or security check fails. + * + * @param name + * the name of the resource + * @param check + * whether to perform a security check + * @return a URL for the resource, or null if the + * resource could not be found. + */ + public URL findResource(String name, boolean check) { + Loader loader; + for (int i = 0; (loader = getLoader(i)) != null; i++) { + URL url = loader.findResource(name, check); + if (url != null) { + return url; + } + } + return null; + } + + /** + * Finds the first Resource on the URL search path which has the specified + * name. Returns null if no Resource could be found. + * + * @param name + * the name of the Resource + * @param check + * whether to perform a security check + * @return the Resource, or null if not found + */ + public Resource getResource(String name, boolean check) { + if (DEBUG) { + System.err.println("URLClassPath.getResource(\"" + name + "\")"); + } + + Loader loader; + for (int i = 0; (loader = getLoader(i)) != null; i++) { + Resource res = loader.getResource(name, check); + if (res != null) { + return res; + } + } + return null; + } + + /** + * Finds all resources on the URL search path with the given name. Returns an + * enumeration of the URL objects. + * + * @param name + * the resource name + * @return an Enumeration of all the urls having the specified name + */ + public Enumeration findResources(final String name, final boolean check) { + return new Enumeration() { + private int index = 0; + + private URL url = null; + + private boolean next() { + if (url != null) { + return true; + } else { + Loader loader; + while ((loader = getLoader(index++)) != null) { + url = loader.findResource(name, check); + if (url != null) { + return true; + } + } + return false; + } + } + + public boolean hasMoreElements() { + return next(); + } + + public Object nextElement() { + if (!next()) { + throw new NoSuchElementException(); + } + URL u = url; + url = null; + return u; + } + }; + } + + public Resource getResource(String name) { + return getResource(name, true); + } + + /** + * Finds all resources on the URL search path with the given name. Returns an + * enumeration of the Resource objects. + * + * @param name + * the resource name + * @return an Enumeration of all the resources having the specified name + */ + public Enumeration getResources(final String name, final boolean check) { + return new Enumeration() { + private int index = 0; + + private Resource res = null; + + private boolean next() { + if (res != null) { + return true; + } else { + Loader loader; + while ((loader = getLoader(index++)) != null) { + res = loader.getResource(name, check); + if (res != null) { + return true; + } + } + return false; + } + } + + public boolean hasMoreElements() { + return next(); + } + + public Object nextElement() { + if (!next()) { + throw new NoSuchElementException(); + } + Resource r = res; + res = null; + return r; + } + }; + } + + public Enumeration getResources(final String name) { + return getResources(name, true); + } + + /* + * Returns the Loader at the specified position in the URL search path. The + * URLs are opened and expanded as needed. Returns null if the specified index + * is out of range. + */ + private synchronized Loader getLoader(int index) { + // Expand URL search path until the request can be satisfied + // or the URL stack is empty. + while (loaders.size() < index + 1) { + // Pop the next URL from the URL stack + URL url; + synchronized (urls) { + if (urls.empty()) { + return null; + } else { + url = (URL) urls.pop(); + } + } + // Skip this URL if it already has a Loader. (Loader + // may be null in the case where URL has not been opened + // but is referenced by a JAR index.) + if (lmap.containsKey(url)) { + continue; + } + // Otherwise, create a new Loader for the URL. + Loader loader; + try { + loader = getLoader(url); + // If the loader defines a local class path then add the + // URLs to the list of URLs to be opened. + URL[] urls = loader.getClassPath(); + if (urls != null) { + push(urls); + } + } catch (IOException e) { + // Silently ignore for now... + continue; + } + // Finally, add the Loader to the search path. + loaders.add(loader); + lmap.put(url, loader); + } + return (Loader) loaders.get(index); + } + + /* + * Returns the Loader for the specified base URL. + */ + private Loader getLoader(final URL url) throws IOException { + try { + return (Loader) java.security.AccessController + .doPrivileged(new java.security.PrivilegedExceptionAction() { + public Object run() throws IOException { + String file = url.getFile(); + if (file != null && file.endsWith("/")) { + if ("file".equals(url.getProtocol())) { + return new FileLoader(url); + } else { + return new Loader(url); + } + } else { + return new JarLoader(url, jarHandler, lmap); + } + } + }); + } catch (java.security.PrivilegedActionException pae) { + throw (IOException) pae.getException(); + } + } + + /* + * Pushes the specified URLs onto the list of unopened URLs. + */ + private void push(URL[] us) { + synchronized (urls) { + for (int i = us.length - 1; i >= 0; --i) { + urls.push(us[i]); + } + } + } + + /** + * Convert class path specification into an array of file URLs. + * + * The path of the file is encoded before conversion into URL form so that + * reserved characters can safely appear in the path. + */ + public static URL[] pathToURLs(String path) { + StringTokenizer st = new StringTokenizer(path, File.pathSeparator); + URL[] urls = new URL[st.countTokens()]; + int count = 0; + while (st.hasMoreTokens()) { + File f = new File(st.nextToken()); + try { + f = new File(f.getCanonicalPath()); + } catch (IOException x) { + // use the non-canonicalized filename + } + try { + urls[count++] = ParseUtil.fileToEncodedURL(f); + } catch (IOException x) { + } + } + + if (urls.length != count) { + URL[] tmp = new URL[count]; + System.arraycopy(urls, 0, tmp, 0, count); + urls = tmp; + } + return urls; + } + + /* + * Check whether the resource URL should be returned. Return null on security + * check failure. Called by java.net.URLClassLoader. + */ + public URL checkURL(URL url) { + try { + check(url); + } catch (Exception e) { + return null; + } + + return url; + } + + /* + * Check whether the resource URL should be returned. Throw exception on + * failure. Called internally within this file. + */ + static void check(URL url) throws IOException { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + URLConnection urlConnection = url.openConnection(); + Permission perm = urlConnection.getPermission(); + if (perm != null) { + try { + security.checkPermission(perm); + } catch (SecurityException se) { + // fallback to checkRead/checkConnect for pre 1.2 + // security managers + if ((perm instanceof java.io.FilePermission) + && perm.getActions().indexOf("read") != -1) { + security.checkRead(perm.getName()); + } else if ((perm instanceof java.net.SocketPermission) + && perm.getActions().indexOf("connect") != -1) { + URL locUrl = url; + if (urlConnection instanceof JarURLConnection) { + locUrl = ((JarURLConnection) urlConnection).getJarFileURL(); + } + security.checkConnect(locUrl.getHost(), locUrl.getPort()); + } else { + throw se; + } + } + } + } + } + + /** + * Inner class used to represent a loader of resources and classes from a base + * URL. + */ + private static class Loader { + private final URL base; + + /* + * Creates a new Loader for the specified URL. + */ + Loader(URL url) { + base = url; + } + + /* + * Returns the base URL for this Loader. + */ + URL getBaseURL() { + return base; + } + + URL findResource(final String name, boolean check) { + URL url; + try { + url = new URL(base, ParseUtil.encodePath(name, false)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException("name"); + } + + try { + if (check) { + URLClassPath.check(url); + } + + /* + * For a HTTP connection we use the HEAD method to check if the resource + * exists. + */ + URLConnection uc = url.openConnection(); + if (uc instanceof HttpURLConnection) { + HttpURLConnection hconn = (HttpURLConnection) uc; + hconn.setRequestMethod("HEAD"); + if (hconn.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { + return null; + } + } else { + // our best guess for the other cases + InputStream is = url.openStream(); + is.close(); + } + return url; + } catch (Exception e) { + return null; + } + } + + Resource getResource(final String name, boolean check) { + final URL url; + try { + url = new URL(base, ParseUtil.encodePath(name, false)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException("name"); + } + final URLConnection uc; + try { + if (check) { + URLClassPath.check(url); + } + uc = url.openConnection(); + InputStream in = uc.getInputStream(); + } catch (Exception e) { + return null; + } + return new Resource() { + public String getName() { + return name; + } + + public URL getURL() { + return url; + } + + public URL getCodeSourceURL() { + return base; + } + + public InputStream getInputStream() throws IOException { + return uc.getInputStream(); + } + + public int getContentLength() throws IOException { + return uc.getContentLength(); + } + }; + } + + /* + * Returns the Resource for the specified name, or null if not found or the + * caller does not have the permission to get the resource. + */ + Resource getResource(final String name) { + return getResource(name, true); + } + + /* + * Returns the local class path for this loader, or null if none. + */ + URL[] getClassPath() throws IOException { + return null; + } + } + + /* + * Inner class used to represent a Loader of resources from a JAR URL. + */ + static class JarLoader extends Loader { + private JarFile jar; + + private URL csu; + + private JarIndex index; + + private MetaIndex metaIndex; + + private URLStreamHandler handler; + + private HashMap lmap; + + /* + * Creates a new JarLoader for the specified URL referring to a JAR file. + */ + JarLoader(URL url, URLStreamHandler jarHandler, HashMap loaderMap) + throws IOException { + super(new URL("jar", "", -1, url + "!/", jarHandler)); + csu = url; + handler = jarHandler; + lmap = loaderMap; + + if (!isOptimizable(url)) { + ensureOpen(); + } else { + String fileName = url.getFile(); + if (fileName != null) { + fileName = ParseUtil.decode(fileName); + File f = new File(fileName); + metaIndex = MetaIndex.forJar(f); + // If the meta index is found but the file is not + // installed, set metaIndex to null. A typical + // senario is charsets.jar which won't be installed + // when the user is running in certain locale environment. + // The side effect of null metaIndex will cause + // ensureOpen get called so that IOException is thrown. + if (metaIndex != null && !f.exists()) { + metaIndex = null; + } + } + + // metaIndex is null when either there is no such jar file + // entry recorded in meta-index file or such jar file is + // missing in JRE. See bug 6340399. + if (metaIndex == null) { + ensureOpen(); + } + } + } + + JarFile getJarFile() { + return jar; + } + + private boolean isOptimizable(URL url) { + return "file".equals(url.getProtocol()); + } + + private void ensureOpen() throws IOException { + if (jar == null) { + try { + java.security.AccessController + .doPrivileged(new java.security.PrivilegedExceptionAction() { + public Object run() throws IOException { + if (DEBUG) { + System.err.println("Opening " + csu); + Thread.dumpStack(); + } + + jar = getJarFile(csu); + index = JarIndex.getJarIndex(jar, metaIndex); + if (index != null) { + String[] jarfiles = index.getJarFiles(); + // Add all the dependent URLs to the lmap so that loaders + // will not be created for them by + // URLClassPath.getLoader(int) + // if the same URL occurs later on the main class path. We + // set + // Loader to null here to avoid creating a Loader for each + // URL until we actually need to try to load something from + // them. + for (int i = 0; i < jarfiles.length; i++) { + try { + URL jarURL = new URL(csu, jarfiles[i]); + // If a non-null loader already exists, leave it alone. + if (!lmap.containsKey(jarURL)) { + lmap.put(jarURL, null); + } + } catch (MalformedURLException e) { + continue; + } + } + } + return null; + } + }); + } catch (java.security.PrivilegedActionException pae) { + throw (IOException) pae.getException(); + } + } + } + + private JarFile getJarFile(URL url) throws IOException { + // Optimize case where url refers to a local jar file + if (isOptimizable(url)) { + FileURLMapper p = new FileURLMapper(url); + if (!p.exists()) { + throw new FileNotFoundException(p.getPath()); + } + return new JarFile(p.getPath()); + } + URLConnection uc = getBaseURL().openConnection(); + uc.setRequestProperty(USER_AGENT_JAVA_VERSION, JAVA_VERSION); + return ((JarURLConnection) uc).getJarFile(); + } + + /* + * Returns the index of this JarLoader if it exists. + */ + JarIndex getIndex() { + try { + ensureOpen(); + } catch (IOException e) { + throw (InternalError) new InternalError().initCause(e); + } + return index; + } + + /* + * Creates the resource and if the check flag is set to true, checks if is + * its okay to return the resource. + */ + Resource checkResource(final String name, boolean check, + final JarEntry entry) { + + final URL url; + try { + url = new URL(getBaseURL(), ParseUtil.encodePath(name, false)); + if (check) { + URLClassPath.check(url); + } + } catch (MalformedURLException e) { + return null; + // throw new IllegalArgumentException("name"); + } catch (IOException e) { + return null; + } catch (AccessControlException e) { + return null; + } + + return new Resource() { + public String getName() { + return name; + } + + public URL getURL() { + return url; + } + + public URL getCodeSourceURL() { + return csu; + } + + public InputStream getInputStream() throws IOException { + return jar.getInputStream(entry); + } + + public int getContentLength() { + return (int) entry.getSize(); + } + + public Manifest getManifest() throws IOException { + return jar.getManifest(); + }; + + public Certificate[] getCertificates() { + return entry.getCertificates(); + }; + + public CodeSigner[] getCodeSigners() { + return entry.getCodeSigners(); + }; + }; + } + + /* + * Returns true iff atleast one resource in the jar file has the same + * package name as that of the specified resource name. + */ + boolean validIndex(final String name) { + String packageName = name; + int pos; + if ((pos = name.lastIndexOf("/")) != -1) { + packageName = name.substring(0, pos); + } + + String entryName; + ZipEntry entry; + Enumeration enum_ = jar.entries(); + while (enum_.hasMoreElements()) { + entry = (ZipEntry) enum_.nextElement(); + entryName = entry.getName(); + if ((pos = entryName.lastIndexOf("/")) != -1) + entryName = entryName.substring(0, pos); + if (entryName.equals(packageName)) { + return true; + } + } + return false; + } + + /* + * Returns the URL for a resource with the specified name + */ + URL findResource(final String name, boolean check) { + Resource rsc = getResource(name, check); + if (rsc != null) { + return rsc.getURL(); + } + return null; + } + + /* + * Returns the JAR Resource for the specified name. + */ + Resource getResource(final String name, boolean check) { + if (metaIndex != null) { + if (!metaIndex.mayContain(name)) { + return null; + } + } + + try { + ensureOpen(); + } catch (IOException e) { + throw (InternalError) new InternalError().initCause(e); + } + final JarEntry entry = jar.getJarEntry(name); + if (entry != null) + return checkResource(name, check, entry); + + if (index == null) + return null; + + HashSet visited = new HashSet(); + return getResource(name, check, visited); + } + + /* + * Version of getResource() that tracks the jar files that have been visited + * by linking through the index files. This helper method uses a HashSet to + * store the URLs of jar files that have been searched and uses it to avoid + * going into an infinite loop, looking for a non-existent resource + */ + Resource getResource(final String name, boolean check, Set visited) { + + Resource res; + Object[] jarFiles; + boolean done = false; + int count = 0; + LinkedList jarFilesList = null; + + /* + * If there no jar files in the index that can potential contain this + * resource then return immediately. + */ + if ((jarFilesList = index.get(name)) == null) + return null; + + do { + jarFiles = jarFilesList.toArray(); + int size = jarFilesList.size(); + /* loop through the mapped jar file list */ + while (count < size) { + String jarName = (String) jarFiles[count++]; + JarLoader newLoader; + final URL url; + + try { + url = new URL(csu, jarName); + if ((newLoader = (JarLoader) lmap.get(url)) == null) { + /* + * no loader has been set up for this jar file before + */ + newLoader = (JarLoader) AccessController + .doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException { + return new JarLoader(url, handler, lmap); + } + }); + + /* + * this newly opened jar file has its own index, merge it into the + * parent's index, taking into account the relative path. + */ + JarIndex newIndex = newLoader.getIndex(); + if (newIndex != null) { + int pos = jarName.lastIndexOf("/"); + newIndex.merge(this.index, + (pos == -1 ? null : jarName.substring(0, pos + 1))); + } + + /* put it in the global hashtable */ + lmap.put(url, newLoader); + } + } catch (java.security.PrivilegedActionException pae) { + continue; + } catch (MalformedURLException e) { + continue; + } + + /* + * Note that the addition of the url to the list of visited jars + * incorporates a check for presence in the hashmap + */ + boolean visitedURL = !visited.add(url); + if (!visitedURL) { + try { + newLoader.ensureOpen(); + } catch (IOException e) { + throw (InternalError) new InternalError().initCause(e); + } + final JarEntry entry = newLoader.jar.getJarEntry(name); + if (entry != null) { + return newLoader.checkResource(name, check, entry); + } + + /* + * Verify that at least one other resource with the same package + * name as the lookedup resource is present in the new jar + */ + if (!newLoader.validIndex(name)) { + /* the mapping is wrong */ + throw new InvalidJarIndexException("Invalid index"); + } + } + + /* + * If newLoader is the current loader or if it is a loader that has + * already been searched or if the new loader does not have an index + * then skip it and move on to the next loader. + */ + if (visitedURL || newLoader == this || newLoader.getIndex() == null) { + continue; + } + + /* + * Process the index of the new loader + */ + if ((res = newLoader.getResource(name, check, visited)) != null) { + return res; + } + } + // Get the list of jar files again as the list could have grown + // due to merging of index files. + jarFilesList = index.get(name); + + // If the count is unchanged, we are done. + } while (count < jarFilesList.size()); + return null; + } + + /* + * Returns the JAR file local class path, or null if none. + */ + URL[] getClassPath() throws IOException { + if (index != null) { + return null; + } + + if (metaIndex != null) { + return null; + } + + ensureOpen(); + if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only + // get + // manifest + // when + // necessary + Manifest man = jar.getManifest(); + if (man != null) { + Attributes attr = man.getMainAttributes(); + if (attr != null) { + String value = attr.getValue(Name.CLASS_PATH); + if (value != null) { + return parseClassPath(csu, value); + } + } + } + } + return null; + } + + /* + * Parses value of the Class-Path manifest attribute and returns an array of + * URLs relative to the specified base URL. + */ + private URL[] parseClassPath(URL base, String value) + throws MalformedURLException { + StringTokenizer st = new StringTokenizer(value); + URL[] urls = new URL[st.countTokens()]; + int i = 0; + while (st.hasMoreTokens()) { + String path = st.nextToken(); + urls[i] = new URL(base, path); + i++; + } + return urls; + } + } + + /* + * Inner class used to represent a loader of classes and resources from a file + * URL that refers to a directory. + */ + private static class FileLoader extends Loader { + private File dir; + + FileLoader(URL url) throws IOException { + super(url); + if (!"file".equals(url.getProtocol())) { + throw new IllegalArgumentException("url"); + } + String path = url.getFile().replace('/', File.separatorChar); + path = ParseUtil.decode(path); + dir = new File(path); + } + + /* + * Returns the URL for a resource with the specified name + */ + URL findResource(final String name, boolean check) { + Resource rsc = getResource(name, check); + if (rsc != null) { + return rsc.getURL(); + } + return null; + } + + Resource getResource(final String name, boolean check) { + final URL url; + try { + URL normalizedBase = new URL(getBaseURL(), "."); + url = new URL(getBaseURL(), ParseUtil.encodePath(name, false)); + + if (url.getFile().startsWith(normalizedBase.getFile()) == false) { + // requested resource had ../..'s in path + return null; + } + + if (check) + URLClassPath.check(url); + final File file = new File(dir, name.replace('/', File.separatorChar)); + if (file.exists()) { + return new Resource() { + public String getName() { + return name; + }; + + public URL getURL() { + return url; + }; + + public URL getCodeSourceURL() { + return getBaseURL(); + }; + + public InputStream getInputStream() throws IOException { + return new FileInputStream(file); + }; + + public int getContentLength() throws IOException { + return (int) file.length(); + }; + }; + } + } catch (Exception e) { + return null; + } + return null; + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Unsafe.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Unsafe.java new file mode 100644 index 0000000..780bcae --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/misc/Unsafe.java @@ -0,0 +1,889 @@ +/* + * Copyright (c) 2000, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.misc; + +import java.security.*; +import java.lang.reflect.*; + +/** + * A collection of methods for performing low-level, unsafe operations. Although + * the class and all methods are public, use of this class is limited because + * only trusted code can obtain instances of it. + * + * @author John R. Rose + * @see #getUnsafe + */ + +public final class Unsafe { + + private static native void registerNatives(); + + static { + registerNatives(); + com.sun.ts.lib.util.sec.reflect.Reflection + .registerMethodsToFilter(Unsafe.class, "getUnsafe"); + } + + private Unsafe() { + } + + private static final Unsafe theUnsafe = new Unsafe(); + + /** + * Provides the caller with the capability of performing unsafe operations. + * + *

+ * The returned Unsafe object should be carefully guarded by the + * caller, since it can be used to read and write data at arbitrary memory + * addresses. It must never be passed to untrusted code. + * + *

+ * Most methods in this class are very low-level, and correspond to a small + * number of hardware instructions (on typical machines). Compilers are + * encouraged to optimize these methods accordingly. + * + *

+ * Here is a suggested idiom for using unsafe operations: + * + *

+ * + *
+   * class MyTrustedClass {
+   *   private static final Unsafe unsafe = Unsafe.getUnsafe();
+   *   ...
+   *   private long myCountAddress = ...;
+   *   public int getCount() { return unsafe.getByte(myCountAddress); }
+   * }
+   * 
+ * + *
+ * + * (It may assist compilers to make the local variable be final.) + * + * @exception SecurityException + * if a security manager exists and its + * checkPropertiesAccess method doesn't allow access + * to the system properties. + */ + public static Unsafe getUnsafe() { + Class cc = com.sun.ts.lib.util.sec.reflect.Reflection.getCallerClass(2); + if (cc.getClassLoader() != null) + throw new SecurityException("Unsafe"); + return theUnsafe; + } + + /// peek and poke operations + /// (compilers should optimize these to memory ops) + + // These work on object fields in the Java heap. + // They will not work on elements of packed arrays. + + /** + * Fetches a value from a given Java variable. More specifically, fetches a + * field or array element within the given object o at the given + * offset, or (if o is null) from the memory address whose + * numerical value is the given offset. + *

+ * The results are undefined unless one of the following cases is true: + *

    + *
  • The offset was obtained from {@link #objectFieldOffset} on the + * {@link java.lang.reflect.Field} of some Java field and the object referred + * to by o is of a class compatible with that field's class. + * + *
  • The offset and object reference o (either null or + * non-null) were both obtained via {@link #staticFieldOffset} and + * {@link #staticFieldBase} (respectively) from the reflective {@link Field} + * representation of some Java field. + * + *
  • The object referred to by o is an array, and the offset is + * an integer of the form B+N*S, where N is a valid + * index into the array, and B and S are the values + * obtained by {@link #arrayBaseOffset} and {@link #arrayIndexScale} + * (respectively) from the array's class. The value referred to is the + * Nth element of the array. + * + *
+ *

+ * If one of the above cases is true, the call references a specific Java + * variable (field or array element). However, the results are undefined if + * that variable is not in fact of the type returned by this method. + *

+ * This method refers to a variable by means of two parameters, and so it + * provides (in effect) a double-register addressing mode for Java + * variables. When the object reference is null, this method uses its offset + * as an absolute address. This is similar in operation to methods such as + * {@link #getInt(long)}, which provide (in effect) a single-register + * addressing mode for non-Java variables. However, because Java variables may + * have a different layout in memory from non-Java variables, programmers + * should not assume that these two addressing modes are ever equivalent. + * Also, programmers should remember that offsets from the double-register + * addressing mode cannot be portably confused with longs used in the + * single-register addressing mode. + * + * @param o + * Java heap object in which the variable resides, if any, else null + * @param offset + * indication of where the variable resides in a Java heap object, if + * any, else a memory address locating the variable statically + * @return the value fetched from the indicated Java variable + * @throws RuntimeException + * No defined exceptions are thrown, not even + * {@link NullPointerException} + */ + public native int getInt(Object o, long offset); + + /** + * Stores a value into a given Java variable. + *

+ * The first two parameters are interpreted exactly as with + * {@link #getInt(Object, long)} to refer to a specific Java variable (field + * or array element). The given value is stored into that variable. + *

+ * The variable must be of the same type as the method parameter + * x. + * + * @param o + * Java heap object in which the variable resides, if any, else null + * @param offset + * indication of where the variable resides in a Java heap object, if + * any, else a memory address locating the variable statically + * @param x + * the value to store into the indicated Java variable + * @throws RuntimeException + * No defined exceptions are thrown, not even + * {@link NullPointerException} + */ + public native void putInt(Object o, long offset, int x); + + /** + * Fetches a reference value from a given Java variable. + * + * @see #getInt(Object, long) + */ + public native Object getObject(Object o, long offset); + + /** + * Stores a reference value into a given Java variable. + *

+ * Unless the reference x being stored is either null or matches + * the field type, the results are undefined. If the reference o + * is non-null, car marks or other store barriers for that object (if the VM + * requires them) are updated. + * + * @see #putInt(Object, int, int) + */ + public native void putObject(Object o, long offset, Object x); + + /** @see #getInt(Object, long) */ + public native boolean getBoolean(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putBoolean(Object o, long offset, boolean x); + + /** @see #getInt(Object, long) */ + public native byte getByte(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putByte(Object o, long offset, byte x); + + /** @see #getInt(Object, long) */ + public native short getShort(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putShort(Object o, long offset, short x); + + /** @see #getInt(Object, long) */ + public native char getChar(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putChar(Object o, long offset, char x); + + /** @see #getInt(Object, long) */ + public native long getLong(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putLong(Object o, long offset, long x); + + /** @see #getInt(Object, long) */ + public native float getFloat(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putFloat(Object o, long offset, float x); + + /** @see #getInt(Object, long) */ + public native double getDouble(Object o, long offset); + + /** @see #putInt(Object, int, int) */ + public native void putDouble(Object o, long offset, double x); + + /** + * This method, like all others with 32-bit offsets, was native in a previous + * release but is now a wrapper which simply casts the offset to a long value. + * It provides backward compatibility with bytecodes compiled against 1.4. + * + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public int getInt(Object o, int offset) { + return getInt(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putInt(Object o, int offset, int x) { + putInt(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public Object getObject(Object o, int offset) { + return getObject(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putObject(Object o, int offset, Object x) { + putObject(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public boolean getBoolean(Object o, int offset) { + return getBoolean(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putBoolean(Object o, int offset, boolean x) { + putBoolean(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public byte getByte(Object o, int offset) { + return getByte(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putByte(Object o, int offset, byte x) { + putByte(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public short getShort(Object o, int offset) { + return getShort(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putShort(Object o, int offset, short x) { + putShort(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public char getChar(Object o, int offset) { + return getChar(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putChar(Object o, int offset, char x) { + putChar(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public long getLong(Object o, int offset) { + return getLong(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putLong(Object o, int offset, long x) { + putLong(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public float getFloat(Object o, int offset) { + return getFloat(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putFloat(Object o, int offset, float x) { + putFloat(o, (long) offset, x); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public double getDouble(Object o, int offset) { + return getDouble(o, (long) offset); + } + + /** + * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long. See + * {@link #staticFieldOffset}. + */ + @Deprecated + public void putDouble(Object o, int offset, double x) { + putDouble(o, (long) offset, x); + } + + // These work on values in the C heap. + + /** + * Fetches a value from a given memory address. If the address is zero, or + * does not point into a block obtained from {@link #allocateMemory}, the + * results are undefined. + * + * @see #allocateMemory + */ + public native byte getByte(long address); + + /** + * Stores a value into a given memory address. If the address is zero, or does + * not point into a block obtained from {@link #allocateMemory}, the results + * are undefined. + * + * @see #getByte(long) + */ + public native void putByte(long address, byte x); + + /** @see #getByte(long) */ + public native short getShort(long address); + + /** @see #putByte(long, byte) */ + public native void putShort(long address, short x); + + /** @see #getByte(long) */ + public native char getChar(long address); + + /** @see #putByte(long, byte) */ + public native void putChar(long address, char x); + + /** @see #getByte(long) */ + public native int getInt(long address); + + /** @see #putByte(long, byte) */ + public native void putInt(long address, int x); + + /** @see #getByte(long) */ + public native long getLong(long address); + + /** @see #putByte(long, byte) */ + public native void putLong(long address, long x); + + /** @see #getByte(long) */ + public native float getFloat(long address); + + /** @see #putByte(long, byte) */ + public native void putFloat(long address, float x); + + /** @see #getByte(long) */ + public native double getDouble(long address); + + /** @see #putByte(long, byte) */ + public native void putDouble(long address, double x); + + /** + * Fetches a native pointer from a given memory address. If the address is + * zero, or does not point into a block obtained from {@link #allocateMemory}, + * the results are undefined. + * + *

+ * If the native pointer is less than 64 bits wide, it is extended as an + * unsigned number to a Java long. The pointer may be indexed by any given + * byte offset, simply by adding that offset (as a simple integer) to the long + * representing the pointer. The number of bytes actually read from the target + * address maybe determined by consulting {@link #addressSize}. + * + * @see #allocateMemory + */ + public native long getAddress(long address); + + /** + * Stores a native pointer into a given memory address. If the address is + * zero, or does not point into a block obtained from {@link #allocateMemory}, + * the results are undefined. + * + *

+ * The number of bytes actually written at the target address maybe determined + * by consulting {@link #addressSize}. + * + * @see #getAddress(long) + */ + public native void putAddress(long address, long x); + + /// wrappers for malloc, realloc, free: + + /** + * Allocates a new block of native memory, of the given size in bytes. The + * contents of the memory are uninitialized; they will generally be garbage. + * The resulting native pointer will never be zero, and will be aligned for + * all value types. Dispose of this memory by calling {@link #freeMemory}, or + * resize it with {@link #reallocateMemory}. + * + * @throws IllegalArgumentException + * if the size is negative or too large for the native size_t type + * + * @throws OutOfMemoryError + * if the allocation is refused by the system + * + * @see #getByte(long) + * @see #putByte(long, byte) + */ + public native long allocateMemory(long bytes); + + /** + * Resizes a new block of native memory, to the given size in bytes. The + * contents of the new block past the size of the old block are uninitialized; + * they will generally be garbage. The resulting native pointer will be zero + * if and only if the requested size is zero. The resulting native pointer + * will be aligned for all value types. Dispose of this memory by calling + * {@link #freeMemory}, or resize it with {@link #reallocateMemory}. The + * address passed to this method may be null, in which case an allocation will + * be performed. + * + * @throws IllegalArgumentException + * if the size is negative or too large for the native size_t type + * + * @throws OutOfMemoryError + * if the allocation is refused by the system + * + * @see #allocateMemory + */ + public native long reallocateMemory(long address, long bytes); + + /** + * Sets all bytes in a given block of memory to a fixed value (usually zero). + */ + public native void setMemory(long address, long bytes, byte value); + + /** + * Sets all bytes in a given block of memory to a copy of another block. + */ + public native void copyMemory(long srcAddress, long destAddress, long bytes); + + /** + * Disposes of a block of native memory, as obtained from + * {@link #allocateMemory} or {@link #reallocateMemory}. The address passed to + * this method may be null, in which case no action is taken. + * + * @see #allocateMemory + */ + public native void freeMemory(long address); + + /// random queries + + /** + * This constant differs from all results that will ever be returned from + * {@link #staticFieldOffset}, {@link #objectFieldOffset}, or + * {@link #arrayBaseOffset}. + */ + public static final int INVALID_FIELD_OFFSET = -1; + + /** + * Returns the offset of a field, truncated to 32 bits. This method is + * implemented as follows:

+ * + *
+   * public int fieldOffset(Field f) {
+   *   if (Modifier.isStatic(f.getModifiers()))
+   *     return (int) staticFieldOffset(f);
+   *   else
+   *     return (int) objectFieldOffset(f);
+   * }
+   * 
+ * + *
+ * + * @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static fields + * and {@link #objectFieldOffset} for non-static fields. + */ + @Deprecated + public int fieldOffset(Field f) { + if (Modifier.isStatic(f.getModifiers())) + return (int) staticFieldOffset(f); + else + return (int) objectFieldOffset(f); + } + + /** + * Returns the base address for accessing some static field in the given + * class. This method is implemented as follows:
+ * + *
+   * public Object staticFieldBase(Class c) {
+   *   Field[] fields = c.getDeclaredFields();
+   *   for (int i = 0; i < fields.length; i++) {
+   *     if (Modifier.isStatic(fields[i].getModifiers())) {
+   *       return staticFieldBase(fields[i]);
+   *     }
+   *   }
+   *   return null;
+   * }
+   * 
+ * + *
+ * + * @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)} to obtain the + * base pertaining to a specific {@link Field}. This method works + * only for JVMs which store all statics for a given class in one + * place. + */ + @Deprecated + public Object staticFieldBase(Class c) { + Field[] fields = c.getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + if (Modifier.isStatic(fields[i].getModifiers())) { + return staticFieldBase(fields[i]); + } + } + return null; + } + + /** + * Report the location of a given field in the storage allocation of its + * class. Do not expect to perform any sort of arithmetic on this offset; it + * is just a cookie which is passed to the unsafe heap memory accessors. + * + *

+ * Any given field will always have the same offset and base, and no two + * distinct fields of the same class will ever have the same offset and base. + * + *

+ * As of 1.4.1, offsets for fields are represented as long values, although + * the Sun JVM does not use the most significant 32 bits. However, JVM + * implementations which store static fields at absolute addresses can use + * long offsets and null base pointers to express the field locations in a + * form usable by {@link #getInt(Object,long)}. Therefore, code which will be + * ported to such JVMs on 64-bit platforms must preserve all bits of static + * field offsets. + * + * @see #getInt(Object, long) + */ + public native long staticFieldOffset(Field f); + + /** + * Report the location of a given static field, in conjunction with + * {@link #staticFieldBase}. + *

+ * Do not expect to perform any sort of arithmetic on this offset; it is just + * a cookie which is passed to the unsafe heap memory accessors. + * + *

+ * Any given field will always have the same offset, and no two distinct + * fields of the same class will ever have the same offset. + * + *

+ * As of 1.4.1, offsets for fields are represented as long values, although + * the Sun JVM does not use the most significant 32 bits. It is hard to + * imagine a JVM technology which needs more than a few bits to encode an + * offset within a non-array object, However, for consistency with other + * methods in this class, this method reports its result as a long value. + * + * @see #getInt(Object, long) + */ + public native long objectFieldOffset(Field f); + + /** + * Report the location of a given static field, in conjunction with + * {@link #staticFieldOffset}. + *

+ * Fetch the base "Object", if any, with which static fields of the given + * class can be accessed via methods like {@link #getInt(Object, long)}. This + * value may be null. This value may refer to an object which is a "cookie", + * not guaranteed to be a real Object, and it should not be used in any way + * except as argument to the get and put routines in this class. + */ + public native Object staticFieldBase(Field f); + + /** + * Ensure the given class has been initialized. This is often needed in + * conjunction with obtaining the static field base of a class. + */ + public native void ensureClassInitialized(Class c); + + /** + * Report the offset of the first element in the storage allocation of a given + * array class. If {@link #arrayIndexScale} returns a non-zero value for the + * same class, you may use that scale factor, together with this base offset, + * to form new offsets to access elements of arrays of the given class. + * + * @see #getInt(Object, long) + * @see #putInt(Object, long, int) + */ + public native int arrayBaseOffset(Class arrayClass); + + /** + * Report the scale factor for addressing elements in the storage allocation + * of a given array class. However, arrays of "narrow" types will generally + * not work properly with accessors like {@link #getByte(Object, int)}, so the + * scale factor for such classes is reported as zero. + * + * @see #arrayBaseOffset + * @see #getInt(Object, long) + * @see #putInt(Object, long, int) + */ + public native int arrayIndexScale(Class arrayClass); + + /** + * Report the size in bytes of a native pointer, as stored via + * {@link #putAddress}. This value will be either 4 or 8. Note that the sizes + * of other primitive types (as stored in native memory blocks) is determined + * fully by their information content. + */ + public native int addressSize(); + + /** + * Report the size in bytes of a native memory page (whatever that is). This + * value will always be a power of two. + */ + public native int pageSize(); + + /// random trusted operations from JNI: + + /** + * Tell the VM to define a class, without security checks. By default, the + * class loader and protection domain come from the caller's class. + */ + public native Class defineClass(String name, byte[] b, int off, int len, + ClassLoader loader, ProtectionDomain protectionDomain); + + public native Class defineClass(String name, byte[] b, int off, int len); + + /** + * Allocate an instance but do not run any constructor. Initializes the class + * if it has not yet been. + */ + public native Object allocateInstance(Class cls) + throws InstantiationException; + + /** Lock the object. It must get unlocked via {@link #monitorExit}. */ + public native void monitorEnter(Object o); + + /** + * Unlock the object. It must have been locked via {@link #monitorEnter}. + */ + public native void monitorExit(Object o); + + /** + * Tries to lock the object. Returns true or false to indicate whether the + * lock succeeded. If it did, the object must be unlocked via + * {@link #monitorExit}. + */ + public native boolean tryMonitorEnter(Object o); + + /** Throw the exception without telling the verifier. */ + public native void throwException(Throwable ee); + + /** + * Atomically update Java variable to x if it is currently holding + * expected. + * + * @return true if successful + */ + public final native boolean compareAndSwapObject(Object o, long offset, + Object expected, Object x); + + /** + * Atomically update Java variable to x if it is currently holding + * expected. + * + * @return true if successful + */ + public final native boolean compareAndSwapInt(Object o, long offset, + int expected, int x); + + /** + * Atomically update Java variable to x if it is currently holding + * expected. + * + * @return true if successful + */ + public final native boolean compareAndSwapLong(Object o, long offset, + long expected, long x); + + /** + * Fetches a reference value from a given Java variable, with volatile load + * semantics. Otherwise identical to {@link #getObject(Object, long)} + */ + public native Object getObjectVolatile(Object o, long offset); + + /** + * Stores a reference value into a given Java variable, with volatile store + * semantics. Otherwise identical to {@link #putObject(Object, long, Object)} + */ + public native void putObjectVolatile(Object o, long offset, Object x); + + /** Volatile version of {@link #getInt(Object, long)} */ + public native int getIntVolatile(Object o, long offset); + + /** Volatile version of {@link #putInt(Object, long, int)} */ + public native void putIntVolatile(Object o, long offset, int x); + + /** Volatile version of {@link #getBoolean(Object, long)} */ + public native boolean getBooleanVolatile(Object o, long offset); + + /** Volatile version of {@link #putBoolean(Object, long, boolean)} */ + public native void putBooleanVolatile(Object o, long offset, boolean x); + + /** Volatile version of {@link #getByte(Object, long)} */ + public native byte getByteVolatile(Object o, long offset); + + /** Volatile version of {@link #putByte(Object, long, byte)} */ + public native void putByteVolatile(Object o, long offset, byte x); + + /** Volatile version of {@link #getShort(Object, long)} */ + public native short getShortVolatile(Object o, long offset); + + /** Volatile version of {@link #putShort(Object, long, short)} */ + public native void putShortVolatile(Object o, long offset, short x); + + /** Volatile version of {@link #getChar(Object, long)} */ + public native char getCharVolatile(Object o, long offset); + + /** Volatile version of {@link #putChar(Object, long, char)} */ + public native void putCharVolatile(Object o, long offset, char x); + + /** Volatile version of {@link #getLong(Object, long)} */ + public native long getLongVolatile(Object o, long offset); + + /** Volatile version of {@link #putLong(Object, long, long)} */ + public native void putLongVolatile(Object o, long offset, long x); + + /** Volatile version of {@link #getFloat(Object, long)} */ + public native float getFloatVolatile(Object o, long offset); + + /** Volatile version of {@link #putFloat(Object, long, float)} */ + public native void putFloatVolatile(Object o, long offset, float x); + + /** Volatile version of {@link #getDouble(Object, long)} */ + public native double getDoubleVolatile(Object o, long offset); + + /** Volatile version of {@link #putDouble(Object, long, double)} */ + public native void putDoubleVolatile(Object o, long offset, double x); + + /** + * Version of {@link #putObjectVolatile(Object, long, Object)} that does not + * guarantee immediate visibility of the store to other threads. This method + * is generally only useful if the underlying field is a Java volatile (or if + * an array cell, one that is otherwise only accessed using volatile + * accesses). + */ + public native void putOrderedObject(Object o, long offset, Object x); + + /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */ + public native void putOrderedInt(Object o, long offset, int x); + + /** Ordered/Lazy version of {@link #putLongVolatile(Object, long, long)} */ + public native void putOrderedLong(Object o, long offset, long x); + + /** + * Unblock the given thread blocked on park, or, if it is not + * blocked, cause the subsequent call to park not to block. Note: + * this operation is "unsafe" solely because the caller must somehow ensure + * that the thread has not been destroyed. Nothing special is usually required + * to ensure this when called from Java (in which there will ordinarily be a + * live reference to the thread) but this is not nearly-automatically so when + * calling from native code. + * + * @param thread + * the thread to unpark. + * + */ + public native void unpark(Object thread); + + /** + * Block current thread, returning when a balancing unpark occurs, or + * a balancing unpark has already occurred, or the thread is + * interrupted, or, if not absolute and time is not zero, the given time + * nanoseconds have elapsed, or if absolute, the given deadline in + * milliseconds since Epoch has passed, or spuriously (i.e., returning for no + * "reason"). Note: This operation is in the Unsafe class only because + * unpark is, so it would be strange to place it elsewhere. + */ + public native void park(boolean isAbsolute, long time); + + /** + * Gets the load average in the system run queue assigned to the available + * processors averaged over various periods of time. This method retrieves the + * given nelem samples and assigns to the elements of the given + * loadavg array. The system imposes a maximum of 3 samples, + * representing averages over the last 1, 5, and 15 minutes, respectively. + * + * @params loadavg an array of double of size nelems + * @params nelems the number of samples to be retrieved and must be 1 to 3. + * + * @return the number of samples actually retrieved; or -1 if the load average + * is unobtainable. + */ + public native int getLoadAverage(double[] loadavg, int nelems); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/net/www/ParseUtil.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/net/www/ParseUtil.java new file mode 100644 index 0000000..7fc8141 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/net/www/ParseUtil.java @@ -0,0 +1,653 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.net.www; + +import java.util.BitSet; +import java.io.UnsupportedEncodingException; +import java.io.File; +import java.net.URL; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import com.sun.ts.lib.util.sec.nio.cs.ThreadLocalCoders; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CoderResult; +import java.nio.charset.CodingErrorAction; + +/** + * A class that contains useful routines common to sun.net.www + * + * @author Mike McCloskey + */ + +public class ParseUtil { + static BitSet encodedInPath; + + static { + encodedInPath = new BitSet(256); + + // Set the bits corresponding to characters that are encoded in the + // path component of a URI. + + // These characters are reserved in the path segment as described in + // RFC2396 section 3.3. + encodedInPath.set('='); + encodedInPath.set(';'); + encodedInPath.set('?'); + encodedInPath.set('/'); + + // These characters are defined as excluded in RFC2396 section 2.4.3 + // and must be escaped if they occur in the data part of a URI. + encodedInPath.set('#'); + encodedInPath.set(' '); + encodedInPath.set('<'); + encodedInPath.set('>'); + encodedInPath.set('%'); + encodedInPath.set('"'); + encodedInPath.set('{'); + encodedInPath.set('}'); + encodedInPath.set('|'); + encodedInPath.set('\\'); + encodedInPath.set('^'); + encodedInPath.set('['); + encodedInPath.set(']'); + encodedInPath.set('`'); + + // US ASCII control characters 00-1F and 7F. + for (int i = 0; i < 32; i++) + encodedInPath.set(i); + encodedInPath.set(127); + } + + /** + * Constructs an encoded version of the specified path string suitable for use + * in the construction of a URL. + * + * A path separator is replaced by a forward slash. The string is UTF8 + * encoded. The % escape sequence is used for characters that are above 0x7F + * or those defined in RFC2396 as reserved or excluded in the path component + * of a URL. + */ + public static String encodePath(String path) { + return encodePath(path, true); + } + + /* + * flag indicates whether path uses platform dependent File.separatorChar or + * not. True indicates path uses platform dependent File.separatorChar. + */ + public static String encodePath(String path, boolean flag) { + char[] retCC = new char[path.length() * 2 + 16]; + int retLen = 0; + char[] pathCC = path.toCharArray(); + + int n = path.length(); + for (int i = 0; i < n; i++) { + char c = pathCC[i]; + if ((!flag && c == '/') || (flag && c == File.separatorChar)) + retCC[retLen++] = '/'; + else { + if (c <= 0x007F) { + if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' + || c >= '0' && c <= '9') { + retCC[retLen++] = c; + } else if (encodedInPath.get(c)) + retLen = escape(retCC, c, retLen); + else + retCC[retLen++] = c; + } else if (c > 0x07FF) { + retLen = escape(retCC, (char) (0xE0 | ((c >> 12) & 0x0F)), retLen); + retLen = escape(retCC, (char) (0x80 | ((c >> 6) & 0x3F)), retLen); + retLen = escape(retCC, (char) (0x80 | ((c >> 0) & 0x3F)), retLen); + } else { + retLen = escape(retCC, (char) (0xC0 | ((c >> 6) & 0x1F)), retLen); + retLen = escape(retCC, (char) (0x80 | ((c >> 0) & 0x3F)), retLen); + } + } + // worst case scenario for character [0x7ff-] every single + // character will be encoded into 9 characters. + if (retLen + 9 > retCC.length) { + int newLen = retCC.length * 2 + 16; + if (newLen < 0) { + newLen = Integer.MAX_VALUE; + } + char[] buf = new char[newLen]; + System.arraycopy(retCC, 0, buf, 0, retLen); + retCC = buf; + } + } + return new String(retCC, 0, retLen); + } + + /** + * Appends the URL escape sequence for the specified char to the specified + * StringBuffer. + */ + private static int escape(char[] cc, char c, int index) { + cc[index++] = '%'; + cc[index++] = Character.forDigit((c >> 4) & 0xF, 16); + cc[index++] = Character.forDigit(c & 0xF, 16); + return index; + } + + /** + * Un-escape and return the character at position i in string s. + */ + private static byte unescape(String s, int i) { + return (byte) Integer.parseInt(s.substring(i + 1, i + 3), 16); + } + + /** + * Returns a new String constructed from the specified String by replacing the + * URL escape sequences and UTF8 encoding with the characters they represent. + */ + public static String decode(String s) { + int n = s.length(); + if ((n == 0) || (s.indexOf('%') < 0)) + return s; + + StringBuilder sb = new StringBuilder(n); + ByteBuffer bb = ByteBuffer.allocate(n); + CharBuffer cb = CharBuffer.allocate(n); + CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8") + .onMalformedInput(CodingErrorAction.REPORT) + .onUnmappableCharacter(CodingErrorAction.REPORT); + + char c = s.charAt(0); + for (int i = 0; i < n;) { + assert c == s.charAt(i); + if (c != '%') { + sb.append(c); + if (++i >= n) + break; + c = s.charAt(i); + continue; + } + bb.clear(); + int ui = i; + for (;;) { + assert (n - i >= 2); + try { + bb.put(unescape(s, i)); + } catch (NumberFormatException e) { + throw new IllegalArgumentException(); + } + i += 3; + if (i >= n) + break; + c = s.charAt(i); + if (c != '%') + break; + } + bb.flip(); + cb.clear(); + dec.reset(); + CoderResult cr = dec.decode(bb, cb, true); + if (cr.isError()) + throw new IllegalArgumentException( + "Error decoding percent encoded characters"); + cr = dec.flush(cb); + if (cr.isError()) + throw new IllegalArgumentException( + "Error decoding percent encoded characters"); + sb.append(cb.flip().toString()); + } + + return sb.toString(); + } + + /** + * Returns a canonical version of the specified string. + */ + public String canonizeString(String file) { + int i = 0; + int lim = file.length(); + + // Remove embedded /../ + while ((i = file.indexOf("/../")) >= 0) { + if ((lim = file.lastIndexOf('/', i - 1)) >= 0) { + file = file.substring(0, lim) + file.substring(i + 3); + } else { + file = file.substring(i + 3); + } + } + // Remove embedded /./ + while ((i = file.indexOf("/./")) >= 0) { + file = file.substring(0, i) + file.substring(i + 2); + } + // Remove trailing .. + while (file.endsWith("/..")) { + i = file.indexOf("/.."); + if ((lim = file.lastIndexOf('/', i - 1)) >= 0) { + file = file.substring(0, lim + 1); + } else { + file = file.substring(0, i); + } + } + // Remove trailing . + if (file.endsWith("/.")) + file = file.substring(0, file.length() - 1); + + return file; + } + + public static URL fileToEncodedURL(File file) throws MalformedURLException { + String path = file.getAbsolutePath(); + path = ParseUtil.encodePath(path); + if (!path.startsWith("/")) { + path = "/" + path; + } + if (!path.endsWith("/") && file.isDirectory()) { + path = path + "/"; + } + return new URL("file", "", path); + } + + public static java.net.URI toURI(URL url) { + String protocol = url.getProtocol(); + String auth = url.getAuthority(); + String path = url.getPath(); + String query = url.getQuery(); + String ref = url.getRef(); + if (path != null && !(path.startsWith("/"))) + path = "/" + path; + + // + // In java.net.URI class, a port number of -1 implies the default + // port number. So get it stripped off before creating URI instance. + // + if (auth != null && auth.endsWith(":-1")) + auth = auth.substring(0, auth.length() - 3); + + java.net.URI uri; + try { + uri = createURI(protocol, auth, path, query, ref); + } catch (java.net.URISyntaxException e) { + uri = null; + } + return uri; + } + + // + // createURI() and its auxiliary code are cloned from java.net.URI. + // Most of the code are just copy and paste, except that quote() + // has been modified to avoid double-escape. + // + // Usually it is unacceptable, but we're forced to do it because + // otherwise we need to change public API, namely java.net.URI's + // multi-argument constructors. It turns out that the changes cause + // incompatibilities so can't be done. + // + private static URI createURI(String scheme, String authority, String path, + String query, String fragment) throws URISyntaxException { + String s = toString(scheme, null, authority, null, null, -1, path, query, + fragment); + checkPath(s, scheme, path); + return new URI(s); + } + + private static String toString(String scheme, String opaquePart, + String authority, String userInfo, String host, int port, String path, + String query, String fragment) { + StringBuffer sb = new StringBuffer(); + if (scheme != null) { + sb.append(scheme); + sb.append(':'); + } + appendSchemeSpecificPart(sb, opaquePart, authority, userInfo, host, port, + path, query); + appendFragment(sb, fragment); + return sb.toString(); + } + + private static void appendSchemeSpecificPart(StringBuffer sb, + String opaquePart, String authority, String userInfo, String host, + int port, String path, String query) { + if (opaquePart != null) { + /* + * check if SSP begins with an IPv6 address because we must not quote a + * literal IPv6 address + */ + if (opaquePart.startsWith("//[")) { + int end = opaquePart.indexOf("]"); + if (end != -1 && opaquePart.indexOf(":") != -1) { + String doquote, dontquote; + if (end == opaquePart.length()) { + dontquote = opaquePart; + doquote = ""; + } else { + dontquote = opaquePart.substring(0, end + 1); + doquote = opaquePart.substring(end + 1); + } + sb.append(dontquote); + sb.append(quote(doquote, L_URIC, H_URIC)); + } + } else { + sb.append(quote(opaquePart, L_URIC, H_URIC)); + } + } else { + appendAuthority(sb, authority, userInfo, host, port); + if (path != null) + sb.append(quote(path, L_PATH, H_PATH)); + if (query != null) { + sb.append('?'); + sb.append(quote(query, L_URIC, H_URIC)); + } + } + } + + private static void appendAuthority(StringBuffer sb, String authority, + String userInfo, String host, int port) { + if (host != null) { + sb.append("//"); + if (userInfo != null) { + sb.append(quote(userInfo, L_USERINFO, H_USERINFO)); + sb.append('@'); + } + boolean needBrackets = ((host.indexOf(':') >= 0) && !host.startsWith("[") + && !host.endsWith("]")); + if (needBrackets) + sb.append('['); + sb.append(host); + if (needBrackets) + sb.append(']'); + if (port != -1) { + sb.append(':'); + sb.append(port); + } + } else if (authority != null) { + sb.append("//"); + if (authority.startsWith("[")) { + int end = authority.indexOf("]"); + if (end != -1 && authority.indexOf(":") != -1) { + String doquote, dontquote; + if (end == authority.length()) { + dontquote = authority; + doquote = ""; + } else { + dontquote = authority.substring(0, end + 1); + doquote = authority.substring(end + 1); + } + sb.append(dontquote); + sb.append( + quote(doquote, L_REG_NAME | L_SERVER, H_REG_NAME | H_SERVER)); + } + } else { + sb.append( + quote(authority, L_REG_NAME | L_SERVER, H_REG_NAME | H_SERVER)); + } + } + } + + private static void appendFragment(StringBuffer sb, String fragment) { + if (fragment != null) { + sb.append('#'); + sb.append(quote(fragment, L_URIC, H_URIC)); + } + } + + // Quote any characters in s that are not permitted + // by the given mask pair + // + private static String quote(String s, long lowMask, long highMask) { + int n = s.length(); + StringBuffer sb = null; + boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c < '\u0080') { + if (!match(c, lowMask, highMask) && !isEscaped(s, i)) { + if (sb == null) { + sb = new StringBuffer(); + sb.append(s.substring(0, i)); + } + appendEscape(sb, (byte) c); + } else { + if (sb != null) + sb.append(c); + } + } else if (allowNonASCII + && (Character.isSpaceChar(c) || Character.isISOControl(c))) { + if (sb == null) { + sb = new StringBuffer(); + sb.append(s.substring(0, i)); + } + appendEncoded(sb, c); + } else { + if (sb != null) + sb.append(c); + } + } + return (sb == null) ? s : sb.toString(); + } + + // + // To check if the given string has an escaped triplet + // at the given position + // + private static boolean isEscaped(String s, int pos) { + if (s == null || (s.length() <= (pos + 2))) + return false; + + return s.charAt(pos) == '%' && match(s.charAt(pos + 1), L_HEX, H_HEX) + && match(s.charAt(pos + 2), L_HEX, H_HEX); + } + + private static void appendEncoded(StringBuffer sb, char c) { + ByteBuffer bb = null; + try { + bb = ThreadLocalCoders.encoderFor("UTF-8") + .encode(CharBuffer.wrap("" + c)); + } catch (CharacterCodingException x) { + assert false; + } + while (bb.hasRemaining()) { + int b = bb.get() & 0xff; + if (b >= 0x80) + appendEscape(sb, (byte) b); + else + sb.append((char) b); + } + } + + private final static char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', + '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + + private static void appendEscape(StringBuffer sb, byte b) { + sb.append('%'); + sb.append(hexDigits[(b >> 4) & 0x0f]); + sb.append(hexDigits[(b >> 0) & 0x0f]); + } + + // Tell whether the given character is permitted by the given mask pair + private static boolean match(char c, long lowMask, long highMask) { + if (c < 64) + return ((1L << c) & lowMask) != 0; + if (c < 128) + return ((1L << (c - 64)) & highMask) != 0; + return false; + } + + // If a scheme is given then the path, if given, must be absolute + // + private static void checkPath(String s, String scheme, String path) + throws URISyntaxException { + if (scheme != null) { + if ((path != null) && ((path.length() > 0) && (path.charAt(0) != '/'))) + throw new URISyntaxException(s, "Relative path in absolute URI"); + } + } + + // -- Character classes for parsing -- + + // Compute a low-order mask for the characters + // between first and last, inclusive + private static long lowMask(char first, char last) { + long m = 0; + int f = Math.max(Math.min(first, 63), 0); + int l = Math.max(Math.min(last, 63), 0); + for (int i = f; i <= l; i++) + m |= 1L << i; + return m; + } + + // Compute the low-order mask for the characters in the given string + private static long lowMask(String chars) { + int n = chars.length(); + long m = 0; + for (int i = 0; i < n; i++) { + char c = chars.charAt(i); + if (c < 64) + m |= (1L << c); + } + return m; + } + + // Compute a high-order mask for the characters + // between first and last, inclusive + private static long highMask(char first, char last) { + long m = 0; + int f = Math.max(Math.min(first, 127), 64) - 64; + int l = Math.max(Math.min(last, 127), 64) - 64; + for (int i = f; i <= l; i++) + m |= 1L << i; + return m; + } + + // Compute the high-order mask for the characters in the given string + private static long highMask(String chars) { + int n = chars.length(); + long m = 0; + for (int i = 0; i < n; i++) { + char c = chars.charAt(i); + if ((c >= 64) && (c < 128)) + m |= (1L << (c - 64)); + } + return m; + } + + // Character-class masks + + // digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | + // "8" | "9" + private static final long L_DIGIT = lowMask('0', '9'); + + private static final long H_DIGIT = 0L; + + // hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | + // "a" | "b" | "c" | "d" | "e" | "f" + private static final long L_HEX = L_DIGIT; + + private static final long H_HEX = highMask('A', 'F') | highMask('a', 'f'); + + // upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | + // "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | + // "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" + private static final long L_UPALPHA = 0L; + + private static final long H_UPALPHA = highMask('A', 'Z'); + + // lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | + // "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | + // "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" + private static final long L_LOWALPHA = 0L; + + private static final long H_LOWALPHA = highMask('a', 'z'); + + // alpha = lowalpha | upalpha + private static final long L_ALPHA = L_LOWALPHA | L_UPALPHA; + + private static final long H_ALPHA = H_LOWALPHA | H_UPALPHA; + + // alphanum = alpha | digit + private static final long L_ALPHANUM = L_DIGIT | L_ALPHA; + + private static final long H_ALPHANUM = H_DIGIT | H_ALPHA; + + // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | + // "(" | ")" + private static final long L_MARK = lowMask("-_.!~*'()"); + + private static final long H_MARK = highMask("-_.!~*'()"); + + // unreserved = alphanum | mark + private static final long L_UNRESERVED = L_ALPHANUM | L_MARK; + + private static final long H_UNRESERVED = H_ALPHANUM | H_MARK; + + // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | + // "$" | "," | "[" | "]" + // Added per RFC2732: "[", "]" + private static final long L_RESERVED = lowMask(";/?:@&=+$,[]"); + + private static final long H_RESERVED = highMask(";/?:@&=+$,[]"); + + // The zero'th bit is used to indicate that escape pairs and non-US-ASCII + // characters are allowed; this is handled by the scanEscape method below. + private static final long L_ESCAPED = 1L; + + private static final long H_ESCAPED = 0L; + + // Dash, for use in domainlabel and toplabel + private static final long L_DASH = lowMask("-"); + + private static final long H_DASH = highMask("-"); + + // uric = reserved | unreserved | escaped + private static final long L_URIC = L_RESERVED | L_UNRESERVED | L_ESCAPED; + + private static final long H_URIC = H_RESERVED | H_UNRESERVED | H_ESCAPED; + + // pchar = unreserved | escaped | + // ":" | "@" | "&" | "=" | "+" | "$" | "," + private static final long L_PCHAR = L_UNRESERVED | L_ESCAPED + | lowMask(":@&=+$,"); + + private static final long H_PCHAR = H_UNRESERVED | H_ESCAPED + | highMask(":@&=+$,"); + + // All valid path characters + private static final long L_PATH = L_PCHAR | lowMask(";/"); + + private static final long H_PATH = H_PCHAR | highMask(";/"); + + // userinfo = *( unreserved | escaped | + // ";" | ":" | "&" | "=" | "+" | "$" | "," ) + private static final long L_USERINFO = L_UNRESERVED | L_ESCAPED + | lowMask(";:&=+$,"); + + private static final long H_USERINFO = H_UNRESERVED | H_ESCAPED + | highMask(";:&=+$,"); + + // reg_name = 1*( unreserved | escaped | "$" | "," | + // ";" | ":" | "@" | "&" | "=" | "+" ) + private static final long L_REG_NAME = L_UNRESERVED | L_ESCAPED + | lowMask("$,;:@&=+"); + + private static final long H_REG_NAME = H_UNRESERVED | H_ESCAPED + | highMask("$,;:@&=+"); + + // All valid characters for server-based authorities + private static final long L_SERVER = L_USERINFO | L_ALPHANUM | L_DASH + | lowMask(".:@[]"); + + private static final long H_SERVER = H_USERINFO | H_ALPHANUM | H_DASH + | highMask(".:@[]"); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ByteBuffered.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ByteBuffered.java new file mode 100644 index 0000000..9988ed1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ByteBuffered.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.nio; + +import java.nio.ByteBuffer; +import java.io.IOException; + +/** + * This is an interface to adapt existing APIs to use {@link java.nio.ByteBuffer + * ByteBuffers} as the underlying data format. Only the initial + * producer and final consumer have to be changed. + *

+ * + * For example, the Zip/Jar code supports {@link java.io.InputStream + * InputStreams}. To make the Zip code use + * {@link java.nio.MappedByteBuffer MappedByteBuffers} as the + * underlying data structure, it can create a class of InputStream that wraps + * the ByteBuffer, and implements the ByteBuffered interface. A co-operating + * class several layers away can ask the InputStream if it is an instance of + * ByteBuffered, then call the {@link #getByteBuffer()} method. + */ +public interface ByteBuffered { + + /** + * Returns the ByteBuffer behind this object, if this particular + * instance has one. An implementation of getByteBuffer() is allowed + * to return null for any reason. + * + * @return The ByteBuffer, if this particular instance has one, or + * null otherwise. + * + * @throws IOException + * If the ByteBuffer is no longer valid. + * + * @since 1.5 + */ + public ByteBuffer getByteBuffer() throws IOException; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ch/Interruptible.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ch/Interruptible.java new file mode 100644 index 0000000..314e67b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/ch/Interruptible.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2000, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.nio.ch; + +public interface Interruptible { + + public void interrupt(); + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/cs/ThreadLocalCoders.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/cs/ThreadLocalCoders.java new file mode 100644 index 0000000..7471969 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/nio/cs/ThreadLocalCoders.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2001, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.nio.cs; + +import java.nio.*; +import java.nio.charset.*; + +/** + * Utility class for caching per-thread decoders and encoders. + */ + +public class ThreadLocalCoders { + + private static final int CACHE_SIZE = 3; + + private static abstract class Cache { + + // Thread-local reference to array of cached objects, in LRU order + private ThreadLocal cache = new ThreadLocal(); + + private final int size; + + Cache(int size) { + this.size = size; + } + + abstract Object create(Object name); + + private void moveToFront(Object[] oa, int i) { + Object ob = oa[i]; + for (int j = i; j > 0; j--) + oa[j] = oa[j - 1]; + oa[0] = ob; + } + + abstract boolean hasName(Object ob, Object name); + + Object forName(Object name) { + Object[] oa = (Object[]) cache.get(); + if (oa == null) { + oa = new Object[size]; + cache.set(oa); + } else { + for (int i = 0; i < oa.length; i++) { + Object ob = oa[i]; + if (ob == null) + continue; + if (hasName(ob, name)) { + if (i > 0) + moveToFront(oa, i); + return ob; + } + } + } + + // Create a new object + Object ob = create(name); + oa[oa.length - 1] = ob; + moveToFront(oa, oa.length - 1); + return ob; + } + + } + + private static Cache decoderCache = new Cache(CACHE_SIZE) { + boolean hasName(Object ob, Object name) { + if (name instanceof String) + return (((CharsetDecoder) ob).charset().name().equals(name)); + if (name instanceof Charset) + return ((CharsetDecoder) ob).charset().equals(name); + return false; + } + + Object create(Object name) { + if (name instanceof String) + return Charset.forName((String) name).newDecoder(); + if (name instanceof Charset) + return ((Charset) name).newDecoder(); + assert false; + return null; + } + }; + + public static CharsetDecoder decoderFor(Object name) { + CharsetDecoder cd = (CharsetDecoder) decoderCache.forName(name); + cd.reset(); + return cd; + } + + private static Cache encoderCache = new Cache(CACHE_SIZE) { + boolean hasName(Object ob, Object name) { + if (name instanceof String) + return (((CharsetEncoder) ob).charset().name().equals(name)); + if (name instanceof Charset) + return ((CharsetEncoder) ob).charset().equals(name); + return false; + } + + Object create(Object name) { + if (name instanceof String) + return Charset.forName((String) name).newEncoder(); + if (name instanceof Charset) + return ((Charset) name).newEncoder(); + assert false; + return null; + } + }; + + public static CharsetEncoder encoderFor(Object name) { + CharsetEncoder ce = (CharsetEncoder) encoderCache.forName(name); + ce.reset(); + return ce; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/ConstantPool.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/ConstantPool.java new file mode 100644 index 0000000..4eb3122 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/ConstantPool.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.reflect; + +import java.lang.reflect.*; + +/** + * Provides reflective access to the constant pools of classes. Currently this + * is needed to provide reflective access to annotations but may be used by + * other internal subsystems in the future. + */ + +public class ConstantPool { + // Number of entries in this constant pool (= maximum valid constant pool + // index) + public int getSize() { + return getSize0(constantPoolOop); + } + + public Class getClassAt(int index) { + return getClassAt0(constantPoolOop, index); + } + + public Class getClassAtIfLoaded(int index) { + return getClassAtIfLoaded0(constantPoolOop, index); + } + + // Returns either a Method or Constructor. + // Static initializers are returned as Method objects. + public Member getMethodAt(int index) { + return getMethodAt0(constantPoolOop, index); + } + + public Member getMethodAtIfLoaded(int index) { + return getMethodAtIfLoaded0(constantPoolOop, index); + } + + public Field getFieldAt(int index) { + return getFieldAt0(constantPoolOop, index); + } + + public Field getFieldAtIfLoaded(int index) { + return getFieldAtIfLoaded0(constantPoolOop, index); + } + + // Fetches the class name, member (field, method or interface + // method) name, and type descriptor as an array of three Strings + public String[] getMemberRefInfoAt(int index) { + return getMemberRefInfoAt0(constantPoolOop, index); + } + + public int getIntAt(int index) { + return getIntAt0(constantPoolOop, index); + } + + public long getLongAt(int index) { + return getLongAt0(constantPoolOop, index); + } + + public float getFloatAt(int index) { + return getFloatAt0(constantPoolOop, index); + } + + public double getDoubleAt(int index) { + return getDoubleAt0(constantPoolOop, index); + } + + public String getStringAt(int index) { + return getStringAt0(constantPoolOop, index); + } + + public String getUTF8At(int index) { + return getUTF8At0(constantPoolOop, index); + } + + // --------------------------------------------------------------------------- + // Internals only below this point + // + + static { + Reflection.registerFieldsToFilter(ConstantPool.class, + new String[] { "constantPoolOop" }); + } + + // HotSpot-internal constant pool object (set by the VM, name known to the VM) + private Object constantPoolOop; + + private native int getSize0(Object constantPoolOop); + + private native Class getClassAt0(Object constantPoolOop, int index); + + private native Class getClassAtIfLoaded0(Object constantPoolOop, int index); + + private native Member getMethodAt0(Object constantPoolOop, int index); + + private native Member getMethodAtIfLoaded0(Object constantPoolOop, int index); + + private native Field getFieldAt0(Object constantPoolOop, int index); + + private native Field getFieldAtIfLoaded0(Object constantPoolOop, int index); + + private native String[] getMemberRefInfoAt0(Object constantPoolOop, + int index); + + private native int getIntAt0(Object constantPoolOop, int index); + + private native long getLongAt0(Object constantPoolOop, int index); + + private native float getFloatAt0(Object constantPoolOop, int index); + + private native double getDoubleAt0(Object constantPoolOop, int index); + + private native String getStringAt0(Object constantPoolOop, int index); + + private native String getUTF8At0(Object constantPoolOop, int index); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/Reflection.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/Reflection.java new file mode 100644 index 0000000..cfcf69e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/Reflection.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2001, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.reflect; + +import java.lang.reflect.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +/** + * Common utility routines used by both java.lang and java.lang.reflect + */ + +public class Reflection { + + /** + * Used to filter out fields and methods from certain classes from public + * view, where they are sensitive or they may contain VM-internal objects. + * These Maps are updated very rarely. Rather than synchronize on each access, + * we use copy-on-write + */ + private static volatile Map fieldFilterMap; + + private static volatile Map methodFilterMap; + + static { + Map map = new HashMap(); + map.put(Reflection.class, + new String[] { "fieldFilterMap", "methodFilterMap" }); + map.put(System.class, new String[] { "security" }); + fieldFilterMap = map; + + methodFilterMap = new HashMap(); + } + + /** + * Returns the class of the method realFramesToSkip frames up the + * stack (zero-based), ignoring frames associated with + * java.lang.reflect.Method.invoke() and its implementation. The first frame + * is that associated with this method, so getCallerClass(0) + * returns the Class object for sun.reflect.Reflection. Frames associated with + * java.lang.reflect.Method.invoke() and its implementation are completely + * ignored and do not count toward the number of "real" frames skipped. + */ + public static native Class getCallerClass(int realFramesToSkip); + + /** + * Retrieves the access flags written to the class file. For inner classes + * these flags may differ from those returned by Class.getModifiers(), which + * searches the InnerClasses attribute to find the source-level access flags. + * This is used instead of Class.getModifiers() for run-time access checks due + * to compatibility reasons; see 4471811. Only the values of the low 13 bits + * (i.e., a mask of 0x1FFF) are guaranteed to be valid. + */ + private static native int getClassAccessFlags(Class c); + + /** + * A quick "fast-path" check to try to avoid getCallerClass() calls. + */ + public static boolean quickCheckMemberAccess(Class memberClass, + int modifiers) { + return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers); + } + + public static void ensureMemberAccess(Class currentClass, Class memberClass, + Object target, int modifiers) throws IllegalAccessException { + if (currentClass == null || memberClass == null) { + throw new InternalError(); + } + + if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) { + throw new IllegalAccessException("Class " + currentClass.getName() + + " can not access a member of class " + memberClass.getName() + + " with modifiers \"" + Modifier.toString(modifiers) + "\""); + } + } + + public static boolean verifyMemberAccess(Class currentClass, + // Declaring class of field + // or method + Class memberClass, + // May be NULL in case of statics + Object target, int modifiers) { + // Verify that currentClass can access a field, method, or + // constructor of memberClass, where that member's access bits are + // "modifiers". + + boolean gotIsSameClassPackage = false; + boolean isSameClassPackage = false; + + if (currentClass == memberClass) { + // Always succeeds + return true; + } + + if (!Modifier.isPublic(getClassAccessFlags(memberClass))) { + isSameClassPackage = isSameClassPackage(currentClass, memberClass); + gotIsSameClassPackage = true; + if (!isSameClassPackage) { + return false; + } + } + + // At this point we know that currentClass can access memberClass. + + if (Modifier.isPublic(modifiers)) { + return true; + } + + boolean successSoFar = false; + + if (Modifier.isProtected(modifiers)) { + // See if currentClass is a subclass of memberClass + if (isSubclassOf(currentClass, memberClass)) { + successSoFar = true; + } + } + + if (!successSoFar && !Modifier.isPrivate(modifiers)) { + if (!gotIsSameClassPackage) { + isSameClassPackage = isSameClassPackage(currentClass, memberClass); + gotIsSameClassPackage = true; + } + + if (isSameClassPackage) { + successSoFar = true; + } + } + + if (!successSoFar) { + return false; + } + + if (Modifier.isProtected(modifiers)) { + // Additional test for protected members: JLS 6.6.2 + Class targetClass = (target == null ? memberClass : target.getClass()); + if (targetClass != currentClass) { + if (!gotIsSameClassPackage) { + isSameClassPackage = isSameClassPackage(currentClass, memberClass); + gotIsSameClassPackage = true; + } + if (!isSameClassPackage) { + if (!isSubclassOf(targetClass, currentClass)) { + return false; + } + } + } + } + + return true; + } + + private static boolean isSameClassPackage(Class c1, Class c2) { + return isSameClassPackage(c1.getClassLoader(), c1.getName(), + c2.getClassLoader(), c2.getName()); + } + + /** + * Returns true if two classes are in the same package; classloader and + * classname information is enough to determine a class's package + */ + private static boolean isSameClassPackage(ClassLoader loader1, String name1, + ClassLoader loader2, String name2) { + if (loader1 != loader2) { + return false; + } else { + int lastDot1 = name1.lastIndexOf('.'); + int lastDot2 = name2.lastIndexOf('.'); + if ((lastDot1 == -1) || (lastDot2 == -1)) { + // One of the two doesn't have a package. Only return true + // if the other one also doesn't have a package. + return (lastDot1 == lastDot2); + } else { + int idx1 = 0; + int idx2 = 0; + + // Skip over '['s + if (name1.charAt(idx1) == '[') { + do { + idx1++; + } while (name1.charAt(idx1) == '['); + if (name1.charAt(idx1) != 'L') { + // Something is terribly wrong. Shouldn't be here. + throw new InternalError("Illegal class name " + name1); + } + } + if (name2.charAt(idx2) == '[') { + do { + idx2++; + } while (name2.charAt(idx2) == '['); + if (name2.charAt(idx2) != 'L') { + // Something is terribly wrong. Shouldn't be here. + throw new InternalError("Illegal class name " + name2); + } + } + + // Check that package part is identical + int length1 = lastDot1 - idx1; + int length2 = lastDot2 - idx2; + + if (length1 != length2) { + return false; + } + return name1.regionMatches(false, idx1, name2, idx2, length1); + } + } + } + + static boolean isSubclassOf(Class queryClass, Class ofClass) { + while (queryClass != null) { + if (queryClass == ofClass) { + return true; + } + queryClass = queryClass.getSuperclass(); + } + return false; + } + + // fieldNames must contain only interned Strings + public static synchronized void registerFieldsToFilter(Class containingClass, + String... fieldNames) { + fieldFilterMap = registerFilter(fieldFilterMap, containingClass, + fieldNames); + } + + // methodNames must contain only interned Strings + public static synchronized void registerMethodsToFilter(Class containingClass, + String... methodNames) { + methodFilterMap = registerFilter(methodFilterMap, containingClass, + methodNames); + } + + private static Map registerFilter(Map map, + Class containingClass, String... names) { + if (map.get(containingClass) != null) { + throw new IllegalArgumentException( + "Filter already registered: " + containingClass); + } + map = new HashMap(map); + map.put(containingClass, names); + return map; + } + + public static Field[] filterFields(Class containingClass, Field[] fields) { + if (fieldFilterMap == null) { + // Bootstrapping + return fields; + } + return (Field[]) filter(fields, fieldFilterMap.get(containingClass)); + } + + public static Method[] filterMethods(Class containingClass, + Method[] methods) { + if (methodFilterMap == null) { + // Bootstrapping + return methods; + } + return (Method[]) filter(methods, methodFilterMap.get(containingClass)); + } + + private static Member[] filter(Member[] members, String[] filteredNames) { + if ((filteredNames == null) || (members.length == 0)) { + return members; + } + int numNewMembers = 0; + for (Member member : members) { + boolean shouldSkip = false; + for (String filteredName : filteredNames) { + if (member.getName() == filteredName) { + shouldSkip = true; + break; + } + } + if (!shouldSkip) { + ++numNewMembers; + } + } + Member[] newMembers = (Member[]) Array.newInstance(members[0].getClass(), + numNewMembers); + int destIdx = 0; + for (Member member : members) { + boolean shouldSkip = false; + for (String filteredName : filteredNames) { + if (member.getName() == filteredName) { + shouldSkip = true; + break; + } + } + if (!shouldSkip) { + newMembers[destIdx++] = member; + } + } + return newMembers; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/annotation/AnnotationType.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/annotation/AnnotationType.java new file mode 100644 index 0000000..dedc937 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/reflect/annotation/AnnotationType.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.reflect.annotation; + +import java.lang.annotation.*; +import java.lang.reflect.*; +import java.util.*; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * Represents an annotation type at run time. Used to type-check annotations and + * apply member defaults. + * + * @author Josh Bloch + * @since 1.5 + */ +public class AnnotationType { + /** + * Member name -> type mapping. Note that primitive types are represented by + * the class objects for the corresponding wrapper types. This matches the + * return value that must be used for a dynamic proxy, allowing for a simple + * isInstance test. + */ + private final Map memberTypes = new HashMap(); + + /** + * Member name -> default value mapping. + */ + private final Map memberDefaults = new HashMap(); + + /** + * Member name -> Method object mapping. This (and its assoicated accessor) + * are used only to generate AnnotationTypeMismatchExceptions. + */ + private final Map members = new HashMap(); + + /** + * The retention policy for this annotation type. + */ + private RetentionPolicy retention = RetentionPolicy.RUNTIME;; + + /** + * Whether this annotation type is inherited. + */ + private boolean inherited = false; + + /** + * Returns an AnnotationType instance for the specified annotation type. + * + * @throw IllegalArgumentException if the specified class object for does not + * represent a valid annotation type + */ + public static synchronized AnnotationType getInstance(Class annotationClass) { + AnnotationType result = com.sun.ts.lib.util.sec.misc.SharedSecrets + .getJavaLangAccess().getAnnotationType(annotationClass); + if (result == null) + result = new AnnotationType((Class) annotationClass); + + return result; + } + + /** + * Sole constructor. + * + * @param annotationClass + * the class object for the annotation type + * @throw IllegalArgumentException if the specified class object for does not + * represent a valid annotation type + */ + private AnnotationType(final Class annotationClass) { + if (!annotationClass.isAnnotation()) + throw new IllegalArgumentException("Not an annotation type"); + + Method[] methods = AccessController + .doPrivileged(new PrivilegedAction() { + public Method[] run() { + // Initialize memberTypes and defaultValues + return annotationClass.getDeclaredMethods(); + } + }); + + for (Method method : methods) { + if (method.getParameterTypes().length != 0) + throw new IllegalArgumentException(method + " has params"); + String name = method.getName(); + Class type = method.getReturnType(); + memberTypes.put(name, invocationHandlerReturnType(type)); + members.put(name, method); + + Object defaultValue = method.getDefaultValue(); + if (defaultValue != null) + memberDefaults.put(name, defaultValue); + + members.put(name, method); + } + + com.sun.ts.lib.util.sec.misc.SharedSecrets.getJavaLangAccess() + .setAnnotationType(annotationClass, this); + + // Initialize retention, & inherited fields. Special treatment + // of the corresponding annotation types breaks infinite recursion. + if (annotationClass != Retention.class + && annotationClass != Inherited.class) { + Retention ret = annotationClass.getAnnotation(Retention.class); + retention = (ret == null ? RetentionPolicy.CLASS : ret.value()); + inherited = annotationClass.isAnnotationPresent(Inherited.class); + } + } + + /** + * Returns the type that must be returned by the invocation handler of a + * dynamic proxy in order to have the dynamic proxy return the specified type + * (which is assumed to be a legal member type for an annotation). + */ + public static Class invocationHandlerReturnType(Class type) { + // Translate primitives to wrappers + if (type == byte.class) + return Byte.class; + if (type == char.class) + return Character.class; + if (type == double.class) + return Double.class; + if (type == float.class) + return Float.class; + if (type == int.class) + return Integer.class; + if (type == long.class) + return Long.class; + if (type == short.class) + return Short.class; + if (type == boolean.class) + return Boolean.class; + + // Otherwise, just return declared type + return type; + } + + /** + * Returns member types for this annotation type (member name -> type + * mapping). + */ + public Map memberTypes() { + return memberTypes; + } + + /** + * Returns members of this annotation type (member name -> associated Method + * object mapping). + */ + public Map members() { + return members; + } + + /** + * Returns the default values for this annotation type (Member name -> default + * value mapping). + */ + public Map memberDefaults() { + return memberDefaults; + } + + /** + * Returns the retention policy for this annotation type. + */ + public RetentionPolicy retention() { + return retention; + } + + /** + * Returns true if this this annotation type is inherited. + */ + public boolean isInherited() { + return inherited; + } + + /** + * For debugging. + */ + public String toString() { + StringBuffer s = new StringBuffer("Annotation Type:" + "\n"); + s.append(" Member types: " + memberTypes + "\n"); + s.append(" Member defaults: " + memberDefaults + "\n"); + s.append(" Retention policy: " + retention + "\n"); + s.append(" Inherited: " + inherited); + return s.toString(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/action/GetPropertyAction.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/action/GetPropertyAction.java new file mode 100644 index 0000000..6ac78ee --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/action/GetPropertyAction.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.action; + +/** + * A convenience class for retrieving the string value of a system property as a + * privileged action. + * + *

+ * An instance of this class can be used as the argument of + * AccessController.doPrivileged. + * + *

+ * The following code retrieves the value of the system property named + * "prop" as a privileged action: + *

+ * + *

+ * String s = java.security.AccessController
+ *     .doPrivileged(new GetPropertyAction("prop"));
+ * 
+ * + * @author Roland Schemers + * @see java.security.PrivilegedAction + * @see java.security.AccessController + * @since 1.2 + */ + +public class GetPropertyAction + implements java.security.PrivilegedAction { + private String theProp; + + private String defaultVal; + + /** + * Constructor that takes the name of the system property whose string value + * needs to be determined. + * + * @param theProp + * the name of the system property. + */ + public GetPropertyAction(String theProp) { + this.theProp = theProp; + } + + /** + * Constructor that takes the name of the system property and the default + * value of that property. + * + * @param theProp + * the name of the system property. + * @param defaulVal + * the default value. + */ + public GetPropertyAction(String theProp, String defaultVal) { + this.theProp = theProp; + this.defaultVal = defaultVal; + } + + /** + * Determines the string value of the system property whose name was specified + * in the constructor. + * + * @return the string value of the system property, or the default value if + * there is no property with that key. + */ + public String run() { + String value = System.getProperty(theProp); + return (value == null) ? defaultVal : value; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/auth/PrincipalComparator.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/auth/PrincipalComparator.java new file mode 100644 index 0000000..857fce2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/auth/PrincipalComparator.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1999, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.auth; + +/** + * An object that implements the java.security.Principal interface + * typically also implements this interface to provide a means for comparing + * that object to a specified Subject. + * + *

+ * The comparison is achieved via the implies method. The + * implementation of the implies method determines whether this + * object "implies" the specified Subject. One example application + * of this method may be for a "group" object to imply a particular + * Subject if that Subject belongs to the group. + * Another example application of this method would be for "role" object to + * imply a particular Subject if that Subject is + * currently acting in that role. + * + *

+ * Although classes that implement this interface typically also implement the + * java.security.Principal interface, it is not required. In other + * words, classes may implement the java.security.Principal + * interface by itself, the PrincipalComparator interface by + * itself, or both at the same time. + * + * @see java.security.Principal + * @see javax.security.auth.Subject + */ +public interface PrincipalComparator { + /** + * Check if the specified Subject is implied by this object. + * + *

+ * + * @return true if the specified Subject is implied by this + * object, or false otherwise. + */ + boolean implies(javax.security.auth.Subject subject); +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/IdentityDatabase.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/IdentityDatabase.java new file mode 100644 index 0000000..3d01bed --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/IdentityDatabase.java @@ -0,0 +1,410 @@ +/* + * Copyright (c) 1996, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.provider; + +import java.io.*; +import java.util.*; +import java.security.*; + +/** + * An implementation of IdentityScope as a persistent identity database. + * + * @see Identity + * @see Key + * + * @author Benjamin Renaud + */ +public class IdentityDatabase extends IdentityScope implements Serializable { + + /** use serialVersionUID from JDK 1.1. for interoperability */ + private static final long serialVersionUID = 4923799573357658384L; + + /* Are we debugging? */ + private static final boolean debug = false; + + /* Are we printing out error messages? */ + private static final boolean error = true; + + /* The source file, if any, for this database. */ + File sourceFile; + + /* The private representation of the database. */ + Hashtable identities; + + IdentityDatabase() throws InvalidParameterException { + this("restoring..."); + } + + /** + * Construct a new, empty database with a specified source file. + * + * @param file + * the source file. + */ + public IdentityDatabase(File file) throws InvalidParameterException { + this(file.getName()); + sourceFile = file; + } + + /** + * Construct a new, empty database. + */ + public IdentityDatabase(String name) throws InvalidParameterException { + super(name); + identities = new Hashtable(); + } + + /** + * Initialize an identity database from a stream. The stream should contain + * data to initialized a serialized IdentityDatabase object. + * + * @param is + * the input stream from which to restore the database. + * + * @exception IOException + * if a stream IO exception occurs + */ + public static IdentityDatabase fromStream(InputStream is) throws IOException { + IdentityDatabase db = null; + try { + ObjectInputStream ois = new ObjectInputStream(is); + db = (IdentityDatabase) ois.readObject(); + } catch (ClassNotFoundException e) { + // this can't happen. + debug("This should not be happening.", e); + error("The version of the database is obsolete. Cannot initialize."); + + } catch (InvalidClassException e) { + // this may happen in developers workspaces happen. + debug("This should not be happening.", e); + error("Unable to initialize system identity scope: " + + " InvalidClassException. \nThis is most likely due to " + + "a serialization versioning problem: a class used in " + + "key management was obsoleted"); + + } catch (StreamCorruptedException e) { + debug("The serialization stream is corrupted. Unable to load.", e); + error("Unable to initialize system identity scope." + + " StreamCorruptedException."); + } + + if (db == null) { + db = new IdentityDatabase("uninitialized"); + } + + return db; + } + + /** + * Initialize an IdentityDatabase from file. + * + * @param f + * the filename where the identity database is stored. + * + * @exception IOException + * a file-related exception occurs (e.g. the directory of the + * file passed does not exists, etc. + * + * @IOException if a file IO exception occurs. + */ + public static IdentityDatabase fromFile(File f) throws IOException { + FileInputStream fis = new FileInputStream(f); + IdentityDatabase edb = fromStream(fis); + edb.sourceFile = f; + return edb; + } + + /** + * @return the number of identities in the database. + */ + public int size() { + return identities.size(); + } + + /** + * @param name + * the name of the identity to be retrieved. + * + * @return the identity named name, or null if there are no identities named + * name in the database. + */ + public Identity getIdentity(String name) { + Identity id = identities.get(name); + if (id instanceof Signer) { + localCheck("get.signer"); + } + return id; + } + + /** + * Get an identity by key. + * + * @param name + * the key of the identity to be retrieved. + * + * @return the identity with a given key, or null if there are no identities + * with that key in the database. + */ + public Identity getIdentity(PublicKey key) { + if (key == null) { + return null; + } + Enumeration e = identities(); + while (e.hasMoreElements()) { + Identity i = e.nextElement(); + PublicKey k = i.getPublicKey(); + if (k != null && keyEqual(k, key)) { + if (i instanceof Signer) { + localCheck("get.signer"); + } + return i; + } + } + return null; + } + + private boolean keyEqual(Key key1, Key key2) { + if (key1 == key2) { + return true; + } else { + return MessageDigest.isEqual(key1.getEncoded(), key2.getEncoded()); + } + } + + /** + * Adds an identity to the database. + * + * @param identity + * the identity to be added. + * + * @exception KeyManagementException + * if a name or key clash occurs, or if another exception occurs. + */ + public void addIdentity(Identity identity) throws KeyManagementException { + localCheck("add.identity"); + Identity byName = getIdentity(identity.getName()); + Identity byKey = getIdentity(identity.getPublicKey()); + String msg = null; + + if (byName != null) { + msg = "name conflict"; + } + if (byKey != null) { + msg = "key conflict"; + } + if (msg != null) { + throw new KeyManagementException(msg); + } + identities.put(identity.getName(), identity); + } + + /** + * Removes an identity to the database. + */ + public void removeIdentity(Identity identity) throws KeyManagementException { + localCheck("remove.identity"); + String name = identity.getName(); + if (identities.get(name) == null) { + throw new KeyManagementException( + "there is no identity named " + name + " in " + this); + } + identities.remove(name); + } + + /** + * @return an enumeration of all identities in the database. + */ + public Enumeration identities() { + return identities.elements(); + } + + /** + * Set the source file for this database. + */ + void setSourceFile(File f) { + sourceFile = f; + } + + /** + * @return the source file for this database. + */ + File getSourceFile() { + return sourceFile; + } + + /** + * Save the database in its current state to an output stream. + * + * @param os + * the output stream to which the database should be serialized. + * + * @exception IOException + * if an IO exception is raised by stream operations. + */ + public void save(OutputStream os) throws IOException { + try { + ObjectOutputStream oos = new ObjectOutputStream(os); + oos.writeObject(this); + oos.flush(); + } catch (InvalidClassException e) { + debug("This should not be happening.", e); + return; + } + } + + /** + * Save the database to a file. + * + * @exception IOException + * if an IO exception is raised by stream operations. + */ + void save(File f) throws IOException { + setSourceFile(f); + FileOutputStream fos = new FileOutputStream(f); + save(fos); + } + + /** + * Saves the database to the default source file. + * + * @exception KeyManagementException + * when there is no default source file specified for this + * database. + */ + public void save() throws IOException { + if (sourceFile == null) { + throw new IOException("this database has no source file"); + } + save(sourceFile); + } + + /** + * This method returns the file from which to initialize the system database. + */ + private static File systemDatabaseFile() { + + // First figure out where the identity database is hiding, if anywhere. + String dbPath = Security.getProperty("identity.database"); + // if nowhere, it's the canonical place. + if (dbPath == null) { + dbPath = System.getProperty("user.home") + File.separatorChar + + "identitydb.obj"; + } + return new File(dbPath); + } + + /* This block initializes the system database, if there is one. */ + static { + java.security.AccessController + .doPrivileged(new java.security.PrivilegedAction() { + public Void run() { + initializeSystem(); + return null; + } + }); + } + + /** + * This method initializes the system's identity database. The canonical + * location is /identitydatabase.obj. This is settable through the + * identity.database property. + */ + private static void initializeSystem() { + + IdentityDatabase systemDatabase; + File dbFile = systemDatabaseFile(); + + // Second figure out if it's there, and if it isn't, create one. + try { + if (dbFile.exists()) { + debug("loading system database from file: " + dbFile); + systemDatabase = fromFile(dbFile); + } else { + systemDatabase = new IdentityDatabase(dbFile); + } + IdentityScope.setSystemScope(systemDatabase); + debug("System database initialized: " + systemDatabase); + } catch (IOException e) { + debug("Error initializing identity database: " + dbFile, e); + return; + } catch (InvalidParameterException e) { + debug("Error trying to instantiate a system identities db in " + dbFile, + e); + return; + } + } + + /* + * private static File securityPropFile(String filename) { // maybe check for + * a system property which will specify where to // look. String sep = + * File.separator; return new File(System.getProperty("java.home") + sep + + * "lib" + sep + "security" + sep + filename); } + */ + + public String toString() { + return "sun.security.provider.IdentityDatabase, source file: " + sourceFile; + } + + private static void debug(String s) { + if (debug) { + System.err.println(s); + } + } + + private static void debug(String s, Throwable t) { + if (debug) { + t.printStackTrace(); + System.err.println(s); + } + } + + private static void error(String s) { + if (error) { + System.err.println(s); + } + } + + void localCheck(String directive) { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + directive = this.getClass().getName() + "." + directive + "." + + localFullName(); + security.checkSecurityAccess(directive); + } + } + + /** + * Returns a parsable name for identity: identityName.scopeName + */ + String localFullName() { + String parsable = getName(); + if (getScope() != null) { + parsable += "." + getScope().getName(); + } + return parsable; + } + + /** + * Serialization write. + */ + private synchronized void writeObject(java.io.ObjectOutputStream stream) + throws IOException { + localCheck("serialize.identity.database"); + stream.writeObject(identities); + stream.writeObject(sourceFile); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyFile.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyFile.java new file mode 100644 index 0000000..b5d1e40 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyFile.java @@ -0,0 +1,2407 @@ +/* + * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.provider; + +import java.io.*; +import java.lang.RuntimePermission; +import java.lang.reflect.*; +import java.lang.ref.*; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URI; +import java.util.*; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.StringTokenizer; +import java.util.PropertyPermission; +import java.util.ArrayList; +import java.util.ListIterator; +import java.util.WeakHashMap; +import java.text.MessageFormat; +//import com.sun.security.auth.PrincipalComparator; +import com.sun.ts.lib.util.sec.security.auth.PrincipalComparator; +import java.security.*; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import javax.security.auth.PrivateCredentialPermission; +import javax.security.auth.Subject; +import javax.security.auth.x500.X500Principal; +import java.io.FilePermission; +import java.net.SocketPermission; +import java.net.NetPermission; +import java.util.PropertyPermission; +import java.util.concurrent.atomic.AtomicReference; +import java.awt.AWTPermission; +/* +import javax.security.auth.AuthPermission; +import javax.security.auth.kerberos.ServicePermission; +import javax.security.auth.kerberos.DelegationPermission; +import java.io.SerializablePermission; +import java.util.logging.LoggingPermission; +import java.sql.SQLPermission; +import java.lang.reflect.ReflectPermission; +import javax.sound.sampled.AudioPermission; +import javax.net.ssl.SSLPermission; +*/ +import com.sun.ts.lib.util.sec.misc.JavaSecurityProtectionDomainAccess; +import static com.sun.ts.lib.util.sec.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; +import com.sun.ts.lib.util.sec.misc.SharedSecrets; +import com.sun.ts.lib.util.sec.security.util.Password; +import com.sun.ts.lib.util.sec.security.util.PolicyUtil; +import com.sun.ts.lib.util.sec.security.util.PropertyExpander; +import com.sun.ts.lib.util.sec.security.util.Debug; +import com.sun.ts.lib.util.sec.security.util.ResourcesMgr; +import com.sun.ts.lib.util.sec.security.util.SecurityConstants; +import com.sun.ts.lib.util.sec.net.www.ParseUtil; + +/** + * This class represents a default implementation for + * java.security.Policy. + * + * Note: For backward compatibility with JAAS 1.0 it loads both java.auth.policy + * and java.policy. However it is recommended that java.auth.policy be not used + * and the java.policy contain all grant entries including that contain + * principal-based entries. + * + * + *

+ * This object stores the policy for entire Java runtime, and is the + * amalgamation of multiple static policy configurations that resides in files. + * The algorithm for locating the policy file(s) and reading their information + * into this Policy object is: + * + *

    + *
  1. Loop through the java.security.Security properties, + * policy.url.1, policy.url.2, ..., policy.url.X" and + * auth.policy.url.1, auth.policy.url.2, ..., + * auth.policy.url.X". These properties are set in the Java security + * properties file, which is located in the file named + * <JAVA_HOME>/lib/security/java.security. <JAVA_HOME> refers to the + * value of the java.home system property, and specifies the directory where the + * JRE is installed. Each property value specifies a URL pointing + * to a policy file to be loaded. Read in and load each policy. + * + * auth.policy.url is supported only for backward compatibility. + * + *
  2. The java.lang.System property java.security.policy + * may also be set to a URL pointing to another policy file (which + * is the case when a user uses the -D switch at runtime). If this property is + * defined, and its use is allowed by the security property file (the Security + * property, policy.allowSystemProperty is set to true), also load + * that policy. + * + *
  3. The java.lang.System property + * java.security.auth.policy may also be set to a URL + * pointing to another policy file (which is the case when a user uses the -D + * switch at runtime). If this property is defined, and its use is allowed by + * the security property file (the Security property, + * policy.allowSystemProperty is set to true), also load that + * policy. + * + * java.security.auth.policy is supported only for backward + * compatibility. + * + * If the java.security.policy or java.security.auth.policy + * property is defined using "==" (rather than "="), then ignore all other + * specified policies and only load this policy. + *
+ * + * Each policy file consists of one or more grant entries, each of which + * consists of a number of permission entries. + * + *
+ *   grant signedBy "alias", codeBase "URL",
+ *         principal principalClass "principalName",
+ *         principal principalClass "principalName",
+ *         ... {
+ *
+ *     permission Type "name "action",
+ *         signedBy "alias";
+ *     permission Type "name "action",
+ *         signedBy "alias";
+ *     ....
+ *   };
+ * 
+ * + * All non-bold items above must appear as is (although case doesn't matter and + * some are optional, as noted below). principal entries are optional and need + * not be present. Italicized items represent variable values. + * + *

+ * A grant entry must begin with the word grant. The + * signedBy,codeBase and principal + * name/value pairs are optional. If they are not present, then any signer + * (including unsigned code) will match, and any codeBase will match. Note that + * the principalClass may be set to the wildcard value, *, which allows + * it to match any Principal class. In addition, the + * principalName may also be set to the wildcard value, *, allowing it to + * match any Principal name. When setting the principalName + * to the *, do not surround the * with quotes. + * + *

+ * A permission entry must begin with the word permission. The word + * Type in the template above is a specific permission type, + * such as java.io.FilePermission or + * java.lang.RuntimePermission. + * + *

+ * The "action" is required for many permission types, such as + * java.io.FilePermission (where it specifies what type of file + * access that is permitted). It is not required for categories such as + * java.lang.RuntimePermission where it is not necessary - you + * either have the permission specified by the "name" value + * following the type name or you don't. + * + *

+ * The signedBy name/value pair for a permission entry is optional. + * If present, it indicates a signed permission. That is, the permission class + * itself must be signed by the given alias in order for it to be granted. For + * example, suppose you have the following grant entry: + * + *

+ *   grant principal foo.com.Principal "Duke" {
+ *     permission Foo "foobar", signedBy "FooSoft";
+ *   }
+ * 
+ * + *

+ * Then this permission of type Foo is granted if the + * Foo.class permission has been signed by the "FooSoft" alias, or + * if XXX Foo.class is a system class (i.e., is found on the + * CLASSPATH). + * + * + *

+ * Items that appear in an entry must appear in the specified order + * (permission, Type, "name", and "action"). + * An entry is terminated with a semicolon. + * + *

+ * Case is unimportant for the identifiers (permission, + * signedBy, codeBase, etc.) but is significant for + * the Type or for any string that is passed in as a value. + *

+ * + *

+ * An example of two entries in a policy configuration file is + * + *

+ *   // if the code is comes from "foo.com" and is running as "Duke",
+ *   // grant it read/write to all files in /tmp.
+ *
+ *   grant codeBase "foo.com", principal foo.com.Principal "Duke" {
+ *              permission java.io.FilePermission "/tmp/*", "read,write";
+ *   };
+ *
+ *   // grant any code running as "Duke" permission to read
+ *   // the "java.vendor" Property.
+ *
+ *   grant principal foo.com.Principal "Duke" {
+ *         permission java.util.PropertyPermission "java.vendor";
+ *
+ *
+ * 
+ * + * This Policy implementation supports special handling of any permission that + * contains the string, "${{self}}", as part of its target name. When + * such a permission is evaluated (such as during a security check), + * ${{self}} is replaced with one or more Principal class/name pairs. The + * exact replacement performed depends upon the contents of the grant clause to + * which the permission belongs. + *

+ * + * If the grant clause does not contain any principal information, the + * permission will be ignored (permissions containing ${{self}} in their + * target names are only valid in the context of a principal-based grant + * clause). For example, BarPermission will always be ignored in the following + * grant clause: + * + *

+ *    grant codebase "www.foo.com", signedby "duke" {
+ *      permission BarPermission "... ${{self}} ...";
+ *    };
+ * 
+ * + * If the grant clause contains principal information, ${{self}} will be + * replaced with that same principal information. For example, ${{self}} + * in BarPermission will be replaced by + * javax.security.auth.x500.X500Principal "cn=Duke" in the following + * grant clause: + * + *
+ *    grant principal javax.security.auth.x500.X500Principal "cn=Duke" {
+ *      permission BarPermission "... ${{self}} ...";
+ *    };
+ * 
+ * + * If there is a comma-separated list of principals in the grant clause, then + * ${{self}} will be replaced by the same comma-separated list or + * principals. In the case where both the principal class and name are + * wildcarded in the grant clause, ${{self}} is replaced with all the + * principals associated with the Subject in the current + * AccessControlContext. + * + * + *

+ * For PrivateCredentialPermissions, you can also use "self" instead of + * "${{self}}". However the use of "self" is deprecated in favour + * of "${{self}}". + * + * @see java.security.CodeSource + * @see java.security.Permissions + * @see java.security.ProtectionDomain + */ +public class PolicyFile extends java.security.Policy { + + private static final Debug debug = Debug.getInstance("policy"); + + private static final String NONE = "NONE"; + + private static final String P11KEYSTORE = "PKCS11"; + + private static final String SELF = "${{self}}"; + + private static final String X500PRINCIPAL = "javax.security.auth.x500.X500Principal"; + + private static final String POLICY = "java.security.policy"; + + private static final String SECURITY_MANAGER = "java.security.manager"; + + private static final String POLICY_URL = "policy.url."; + + private static final String AUTH_POLICY = "java.security.auth.policy"; + + private static final String AUTH_POLICY_URL = "auth.policy.url."; + + private static final int DEFAULT_CACHE_SIZE = 1; + + /** the scope to check */ + private static IdentityScope scope = null; + + // contains the policy grant entries, PD cache, and alias mapping + private AtomicReference policyInfo = new AtomicReference(); + + private boolean constructed = false; + + private boolean expandProperties = true; + + private boolean ignoreIdentityScope = false; + + private boolean allowSystemProperties = true; + + private boolean notUtf8 = false; + + private URL url; + + // for use with the reflection API + + private static final Class[] PARAMS0 = {}; + + private static final Class[] PARAMS1 = { String.class }; + + private static final Class[] PARAMS2 = { String.class, String.class }; + + /** + * Initializes the Policy object and reads the default policy configuration + * file(s) into the Policy object. + */ + public PolicyFile() { + init((URL) null); + } + + /** + * Initializes the Policy object and reads the default policy from the + * specified URL only. + */ + public PolicyFile(URL url) { + this.url = url; + init(url); + } + + /** + * Initializes the Policy object and reads the default policy configuration + * file(s) into the Policy object. + * + * The algorithm for locating the policy file(s) and reading their information + * into the Policy object is: + * + *

+   *   loop through the Security Properties named "policy.url.1",
+   *  ""policy.url.2", "auth.policy.url.1",  "auth.policy.url.2" etc, until
+   *   you don't find one. Each of these specify a policy file.
+   *
+   *   if none of these could be loaded, use a builtin static policy
+   *      equivalent to the default lib/security/java.policy file.
+   *
+   *   if the system property "java.policy" or "java.auth.policy" is defined
+   * (which is the
+   *      case when the user uses the -D switch at runtime), and
+   *     its use is allowed by the security property file,
+   *     also load it.
+   * 
+ * + * Each policy file consists of one or more grant entries, each of which + * consists of a number of permission entries. + * + *
+   *   grant signedBy "alias", codeBase "URL" {
+   *     permission Type "name", "action",
+   *         signedBy "alias";
+   *     ....
+   *     permission Type "name", "action",
+   *         signedBy "alias";
+   *   };
+   *
+   * 
+ * + * All non-italicized items above must appear as is (although case doesn't + * matter and some are optional, as noted below). Italicized items represent + * variable values. + * + *

+ * A grant entry must begin with the word grant. The + * signedBy and codeBase name/value pairs are + * optional. If they are not present, then any signer (including unsigned + * code) will match, and any codeBase will match. + * + *

+ * A permission entry must begin with the word permission. The + * word Type in the template above would actually be a + * specific permission type, such as java.io.FilePermission or + * java.lang.RuntimePermission. + * + *

+ * The "action" is required for many permission types, such as + * java.io.FilePermission (where it specifies what type of file + * access is permitted). It is not required for categories such as + * java.lang.RuntimePermission where it is not necessary - you + * either have the permission specified by the "name" + * value following the type name or you don't. + * + *

+ * The signedBy name/value pair for a permission entry is + * optional. If present, it indicates a signed permission. That is, the + * permission class itself must be signed by the given alias in order for it + * to be granted. For example, suppose you have the following grant entry: + * + *

+   *   grant {
+   *     permission Foo "foobar", signedBy "FooSoft";
+   *   }
+   * 
+ * + *

+ * Then this permission of type Foo is granted if the + * Foo.class permission has been signed by the "FooSoft" alias, + * or if Foo.class is a system class (i.e., is found on the + * CLASSPATH). + * + *

+ * Items that appear in an entry must appear in the specified order + * (permission, Type, "name", and "action"). + * An entry is terminated with a semicolon. + * + *

+ * Case is unimportant for the identifiers (permission, + * signedBy, codeBase, etc.) but is significant for + * the Type or for any string that is passed in as a value. + *

+ * + *

+ * An example of two entries in a policy configuration file is + * + *

+   *   //  if the code is signed by "Duke", grant it read/write to all
+   *   // files in /tmp.
+   *
+   *   grant signedBy "Duke" {
+   *          permission java.io.FilePermission "/tmp/*", "read,write";
+   *   };
+   * 

+ * // grant everyone the following permission + * + * grant { + * permission java.util.PropertyPermission "java.vendor"; + * }; + *

+ */ + private void init(URL url) { + // Properties are set once for each init(); ignore changes between + // between diff invocations of initPolicyFile(policy, url, info). + String numCacheStr = AccessController + .doPrivileged(new PrivilegedAction() { + public String run() { + expandProperties = "true".equalsIgnoreCase( + Security.getProperty("policy.expandProperties")); + ignoreIdentityScope = "true".equalsIgnoreCase( + Security.getProperty("policy.ignoreIdentityScope")); + allowSystemProperties = "true".equalsIgnoreCase( + Security.getProperty("policy.allowSystemProperty")); + notUtf8 = "false".equalsIgnoreCase( + System.getProperty("sun.security.policy.utf8")); + return System.getProperty("sun.security.policy.numcaches"); + } + }); + + int numCaches; + if (numCacheStr != null) { + try { + numCaches = Integer.parseInt(numCacheStr); + } catch (NumberFormatException e) { + numCaches = DEFAULT_CACHE_SIZE; + } + } else { + numCaches = DEFAULT_CACHE_SIZE; + } + // System.out.println("number caches=" + numCaches); + PolicyInfo newInfo = new PolicyInfo(numCaches); + initPolicyFile(newInfo, url); + policyInfo.set(newInfo); + } + + private void initPolicyFile(final PolicyInfo newInfo, final URL url) { + + if (url != null) { + + /** + * If the caller specified a URL via Policy.getInstance, we only read from + * that URL + */ + + if (debug != null) { + debug.println("reading " + url); + } + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + if (init(url, newInfo) == false) { + // use static policy if all else fails + initStaticPolicy(newInfo); + } + return null; + } + }); + + } else { + + /** + * Caller did not specify URL via Policy.getInstance. Read from URLs + * listed in the java.security properties file. + * + * We call initPolicyFile with POLICY , POLICY_URL and then call it with + * AUTH_POLICY and AUTH_POLICY_URL So first we will process the JAVA + * standard policy and then process the JAVA AUTH Policy. This is for + * backward compatibility as well as to handle cases where the user has a + * single unified policyfile with both java policy entries and auth + * entries + */ + + boolean loaded_one = initPolicyFile(POLICY, POLICY_URL, newInfo); + // To maintain strict backward compatibility + // we load the static policy only if POLICY load failed + if (!loaded_one) { + // use static policy if all else fails + initStaticPolicy(newInfo); + } + + initPolicyFile(AUTH_POLICY, AUTH_POLICY_URL, newInfo); + } + } + + private boolean initPolicyFile(final String propname, final String urlname, + final PolicyInfo newInfo) { + Boolean loadedPolicy = AccessController + .doPrivileged(new PrivilegedAction() { + public Boolean run() { + boolean loaded_policy = false; + + if (allowSystemProperties) { + String extra_policy = System.getProperty(propname); + if (extra_policy != null) { + boolean overrideAll = false; + if (extra_policy.startsWith("=")) { + overrideAll = true; + extra_policy = extra_policy.substring(1); + } + try { + extra_policy = PropertyExpander.expand(extra_policy); + URL policyURL; + + File policyFile = new File(extra_policy); + if (policyFile.exists()) { + policyURL = ParseUtil.fileToEncodedURL( + new File(policyFile.getCanonicalPath())); + } else { + policyURL = new URL(extra_policy); + } + if (debug != null) + debug.println("reading " + policyURL); + if (init(policyURL, newInfo)) + loaded_policy = true; + } catch (Exception e) { + // ignore. + if (debug != null) { + debug.println("caught exception: " + e); + } + } + if (overrideAll) { + if (debug != null) { + debug.println("overriding other policies!"); + } + return Boolean.valueOf(loaded_policy); + } + } + } + + int n = 1; + String policy_uri; + + while ((policy_uri = Security.getProperty(urlname + n)) != null) { + try { + URL policy_url = null; + String expanded_uri = PropertyExpander.expand(policy_uri) + .replace(File.separatorChar, '/'); + + if (policy_uri.startsWith("file:${java.home}/") + || policy_uri.startsWith("file:${user.home}/")) { + + // this special case accommodates + // the situation java.home/user.home + // expand to a single slash, resulting in + // a file://foo URI + policy_url = new File(expanded_uri.substring(5)).toURI() + .toURL(); + } else { + policy_url = new URI(expanded_uri).toURL(); + } + + if (debug != null) + debug.println("reading " + policy_url); + if (init(policy_url, newInfo)) + loaded_policy = true; + } catch (Exception e) { + if (debug != null) { + debug.println("error reading policy " + e); + e.printStackTrace(); + } + // ignore that policy + } + n++; + } + return Boolean.valueOf(loaded_policy); + } + }); + + return loadedPolicy.booleanValue(); + } + + /** + * Reads a policy configuration into the Policy object using a Reader object. + * + * @param policyFile + * the policy Reader object. + */ + private boolean init(URL policy, PolicyInfo newInfo) { + boolean success = false; + PolicyParser pp = new PolicyParser(expandProperties); + InputStreamReader isr = null; + try { + + // read in policy using UTF-8 by default + // + // check non-standard system property to see if + // the default encoding should be used instead + + if (notUtf8) { + isr = new InputStreamReader(PolicyUtil.getInputStream(policy)); + } else { + isr = new InputStreamReader(PolicyUtil.getInputStream(policy), "UTF-8"); + } + + pp.read(isr); + + KeyStore keyStore = null; + try { + keyStore = PolicyUtil.getKeyStore(policy, pp.getKeyStoreUrl(), + pp.getKeyStoreType(), pp.getKeyStoreProvider(), + pp.getStorePassURL(), debug); + } catch (Exception e) { + // ignore, treat it like we have no keystore + if (debug != null) { + e.printStackTrace(); + } + } + + Enumeration enum_ = pp.grantElements(); + while (enum_.hasMoreElements()) { + PolicyParser.GrantEntry ge = enum_.nextElement(); + addGrantEntry(ge, keyStore, newInfo); + } + } catch (PolicyParser.ParsingException pe) { + MessageFormat form = new MessageFormat(ResourcesMgr + .getString(POLICY + ": error parsing policy:\n\tmessage")); + Object[] source = { policy, pe.getLocalizedMessage() }; + System.err.println(form.format(source)); + if (debug != null) + pe.printStackTrace(); + + } catch (Exception e) { + if (debug != null) { + debug.println("error parsing " + policy); + debug.println(e.toString()); + e.printStackTrace(); + } + } finally { + if (isr != null) { + try { + isr.close(); + success = true; + } catch (IOException e) { + // ignore the exception + } + } else { + success = true; + } + } + + return success; + } + + private void initStaticPolicy(final PolicyInfo newInfo) { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + PolicyEntry pe = new PolicyEntry( + new CodeSource(null, (Certificate[]) null)); + pe.add(SecurityConstants.LOCAL_LISTEN_PERMISSION); + pe.add(new PropertyPermission("java.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vendor", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vendor.url", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.class.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("os.name", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("os.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("os.arch", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("file.separator", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("path.separator", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("line.separator", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.specification.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.specification.vendor", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.specification.name", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.specification.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.specification.vendor", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.specification.name", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.version", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.vendor", + SecurityConstants.PROPERTY_READ_ACTION)); + pe.add(new PropertyPermission("java.vm.name", + SecurityConstants.PROPERTY_READ_ACTION)); + + // No need to sync because noone has access to newInfo yet + newInfo.policyEntries.add(pe); + + return null; + } + }); + } + + /** + * Given a GrantEntry, create a codeSource. + * + * @return null if signedBy alias is not recognized + */ + private CodeSource getCodeSource(PolicyParser.GrantEntry ge, + KeyStore keyStore, PolicyInfo newInfo) + throws java.net.MalformedURLException { + Certificate[] certs = null; + if (ge.signedBy != null) { + certs = getCertificates(keyStore, ge.signedBy, newInfo); + if (certs == null) { + // we don't have a key for this alias, + // just return + if (debug != null) { + debug.println( + " -- No certs for alias '" + ge.signedBy + "' - ignoring entry"); + } + return null; + } + } + + URL location; + + if (ge.codeBase != null) + location = new URL(ge.codeBase); + else + location = null; + + return (canonicalizeCodebase(new CodeSource(location, certs), false)); + } + + /** + * Add one policy entry to the list. + */ + private void addGrantEntry(PolicyParser.GrantEntry ge, KeyStore keyStore, + PolicyInfo newInfo) { + + if (debug != null) { + debug.println("Adding policy entry: "); + debug.println(" signedBy " + ge.signedBy); + debug.println(" codeBase " + ge.codeBase); + if (ge.principals != null && ge.principals.size() > 0) { + ListIterator li = ge.principals + .listIterator(); + while (li.hasNext()) { + PolicyParser.PrincipalEntry pppe = li.next(); + debug.println(" " + pppe.toString()); + } + } + } + + try { + CodeSource codesource = getCodeSource(ge, keyStore, newInfo); + // skip if signedBy alias was unknown... + if (codesource == null) + return; + + // perform keystore alias principal replacement. + // for example, if alias resolves to X509 certificate, + // replace principal with: + // -- skip if alias is unknown + if (replacePrincipals(ge.principals, keyStore) == false) + return; + PolicyEntry entry = new PolicyEntry(codesource, ge.principals); + Enumeration enum_ = ge.permissionElements(); + while (enum_.hasMoreElements()) { + PolicyParser.PermissionEntry pe = enum_.nextElement(); + + try { + // perform ${{ ... }} expansions within permission name + expandPermissionName(pe, keyStore); + + // XXX special case PrivateCredentialPermission-SELF + Permission perm; + if (pe.permission + .equals("javax.security.auth.PrivateCredentialPermission") + && pe.name.endsWith(" self")) { + pe.name = pe.name.substring(0, pe.name.indexOf("self")) + SELF; + } + // check for self + if (pe.name != null && pe.name.indexOf(SELF) != -1) { + // Create a "SelfPermission" , it could be an + // an unresolved permission which will be resolved + // when implies is called + // Add it to entry + Certificate certs[]; + if (pe.signedBy != null) { + certs = getCertificates(keyStore, pe.signedBy, newInfo); + } else { + certs = null; + } + perm = new SelfPermission(pe.permission, pe.name, pe.action, certs); + } else { + perm = getInstance(pe.permission, pe.name, pe.action); + } + entry.add(perm); + if (debug != null) { + debug.println(" " + perm); + } + } catch (ClassNotFoundException cnfe) { + Certificate certs[]; + if (pe.signedBy != null) { + certs = getCertificates(keyStore, pe.signedBy, newInfo); + } else { + certs = null; + } + + // only add if we had no signer or we had a + // a signer and found the keys for it. + if (certs != null || pe.signedBy == null) { + Permission perm = new UnresolvedPermission(pe.permission, pe.name, + pe.action, certs); + entry.add(perm); + if (debug != null) { + debug.println(" " + perm); + } + } + } catch (java.lang.reflect.InvocationTargetException ite) { + MessageFormat form = new MessageFormat(ResourcesMgr.getString( + POLICY + ": error adding Permission, perm:\n\tmessage")); + Object[] source = { pe.permission, + ite.getTargetException().toString() }; + System.err.println(form.format(source)); + } catch (Exception e) { + MessageFormat form = new MessageFormat(ResourcesMgr.getString( + POLICY + ": error adding Permission, perm:\n\tmessage")); + Object[] source = { pe.permission, e.toString() }; + System.err.println(form.format(source)); + } + } + + // No need to sync because noone has access to newInfo yet + newInfo.policyEntries.add(entry); + } catch (Exception e) { + MessageFormat form = new MessageFormat( + ResourcesMgr.getString(POLICY + ": error adding Entry:\n\tmessage")); + Object[] source = { e.toString() }; + System.err.println(form.format(source)); + } + if (debug != null) + debug.println(); + } + + /** + * Returns a new Permission object of the given Type. The Permission is + * created by getting the Class object using the Class.forName + * method, and using the reflection API to invoke the (String name, String + * actions) constructor on the object. + * + * @param type + * the type of Permission being created. + * @param name + * the name of the Permission being created. + * @param actions + * the actions of the Permission being created. + * + * @exception ClassNotFoundException + * if the particular Permission class could not be found. + * + * @exception IllegalAccessException + * if the class or initializer is not accessible. + * + * @exception InstantiationException + * if getInstance tries to instantiate an abstract class or an + * interface, or if the instantiation fails for some other + * reason. + * + * @exception NoSuchMethodException + * if the (String, String) constructor is not found. + * + * @exception InvocationTargetException + * if the underlying Permission constructor throws an exception. + * + */ + + private static final Permission getInstance(String type, String name, + String actions) throws ClassNotFoundException, InstantiationException, + IllegalAccessException, NoSuchMethodException, InvocationTargetException { + // XXX we might want to keep a hash of created factories... + Class pc = Class.forName(type); + Permission answer = getKnownInstance(pc, name, actions); + if (answer != null) { + return answer; + } + + if (name == null && actions == null) { + try { + Constructor c = pc.getConstructor(PARAMS0); + return (Permission) c.newInstance(new Object[] {}); + } catch (NoSuchMethodException ne) { + try { + Constructor c = pc.getConstructor(PARAMS1); + return (Permission) c.newInstance(new Object[] { name }); + } catch (NoSuchMethodException ne1) { + Constructor c = pc.getConstructor(PARAMS2); + return (Permission) c.newInstance(new Object[] { name, actions }); + } + } + } else { + if (name != null && actions == null) { + try { + Constructor c = pc.getConstructor(PARAMS1); + return (Permission) c.newInstance(new Object[] { name }); + } catch (NoSuchMethodException ne) { + Constructor c = pc.getConstructor(PARAMS2); + return (Permission) c.newInstance(new Object[] { name, actions }); + } + } else { + Constructor c = pc.getConstructor(PARAMS2); + return (Permission) c.newInstance(new Object[] { name, actions }); + } + } + } + + /** + * Creates one of the well-known permissions directly instead of via + * reflection. Keep list short to not penalize non-JDK-defined permissions. + */ + private static final Permission getKnownInstance(Class claz, String name, + String actions) { + // XXX shorten list to most popular ones? + if (claz.equals(FilePermission.class)) { + return new FilePermission(name, actions); + } else if (claz.equals(SocketPermission.class)) { + return new SocketPermission(name, actions); + } else if (claz.equals(RuntimePermission.class)) { + return new RuntimePermission(name, actions); + } else if (claz.equals(PropertyPermission.class)) { + return new PropertyPermission(name, actions); + } else if (claz.equals(NetPermission.class)) { + return new NetPermission(name, actions); + } else if (claz.equals(AllPermission.class)) { + return SecurityConstants.ALL_PERMISSION; + } else if (claz.equals(AWTPermission.class)) { + return new AWTPermission(name, actions); + /* + * } else if (claz.equals(ReflectPermission.class)) { return new + * ReflectPermission(name, actions); } else if + * (claz.equals(SecurityPermission.class)) { return new + * SecurityPermission(name, actions); } else if + * (claz.equals(PrivateCredentialPermission.class)) { return new + * PrivateCredentialPermission(name, actions); } else if + * (claz.equals(AuthPermission.class)) { return new AuthPermission(name, + * actions); } else if (claz.equals(ServicePermission.class)) { return new + * ServicePermission(name, actions); } else if + * (claz.equals(DelegationPermission.class)) { return new + * DelegationPermission(name, actions); } else if + * (claz.equals(SerializablePermission.class)) { return new + * SerializablePermission(name, actions); } else if + * (claz.equals(AudioPermission.class)) { return new AudioPermission(name, + * actions); } else if (claz.equals(SSLPermission.class)) { return new + * SSLPermission(name, actions); } else if + * (claz.equals(LoggingPermission.class)) { return new + * LoggingPermission(name, actions); } else if + * (claz.equals(SQLPermission.class)) { return new SQLPermission(name, + * actions); + */ + } else { + return null; + } + } + + /** + * Fetch all certs associated with this alias. + */ + private Certificate[] getCertificates(KeyStore keyStore, String aliases, + PolicyInfo newInfo) { + + List vcerts = null; + + StringTokenizer st = new StringTokenizer(aliases, ","); + int n = 0; + + while (st.hasMoreTokens()) { + String alias = st.nextToken().trim(); + n++; + Certificate cert = null; + // See if this alias's cert has already been cached + synchronized (newInfo.aliasMapping) { + cert = (Certificate) newInfo.aliasMapping.get(alias); + + if (cert == null && keyStore != null) { + + try { + cert = keyStore.getCertificate(alias); + } catch (KeyStoreException kse) { + // never happens, because keystore has already been loaded + // when we call this + } + if (cert != null) { + newInfo.aliasMapping.put(alias, cert); + newInfo.aliasMapping.put(cert, alias); + } + } + } + + if (cert != null) { + if (vcerts == null) + vcerts = new ArrayList(); + vcerts.add(cert); + } + } + + // make sure n == vcerts.size, since we are doing a logical *and* + if (vcerts != null && n == vcerts.size()) { + Certificate[] certs = new Certificate[vcerts.size()]; + vcerts.toArray(certs); + return certs; + } else { + return null; + } + } + + /** + * Refreshes the policy object by re-reading all the policy files. + */ + @Override + public void refresh() { + init(url); + } + + /** + * Evaluates the the global policy for the permissions granted to the + * ProtectionDomain and tests whether the permission is granted. + * + * @param domain + * the ProtectionDomain to test + * @param permission + * the Permission object to be tested for implication. + * + * @return true if "permission" is a proper subset of a permission granted to + * this ProtectionDomain. + * + * @see java.security.ProtectionDomain + */ + @Override + public boolean implies(ProtectionDomain pd, Permission p) { + PolicyInfo pi = policyInfo.get(); + ProtectionDomainCache pdMap = pi.getPdMapping(); + + PermissionCollection pc = pdMap.get(pd); + + if (pc != null) { + return pc.implies(p); + } + + pc = getPermissions(pd); + if (pc == null) { + return false; + } + + // cache mapping of protection domain to its PermissionCollection + pdMap.put(pd, pc); + return pc.implies(p); + } + + /** + * Examines this Policy and returns the permissions granted to + * the specified ProtectionDomain. This includes the permissions + * currently associated with the domain as well as the policy permissions + * granted to the domain's CodeSource, ClassLoader, and Principals. + * + *

+ * Note that this Policy implementation has special handling for + * PrivateCredentialPermissions. When this method encounters a + * PrivateCredentialPermission which specifies "self" as the + * Principal class and name, it does not add that + * Permission to the returned PermissionCollection. + * Instead, it builds a new PrivateCredentialPermission for each + * Principal associated with the provided Subject. + * Each new PrivateCredentialPermission contains the same + * Credential class as specified in the originally granted permission, as well + * as the Class and name for the respective Principal. + * + *

+ * + * @param domain + * the Permissions granted to this ProtectionDomain are + * returned. + * + * @return the Permissions granted to the provided + * ProtectionDomain. + */ + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + Permissions perms = new Permissions(); + + if (domain == null) + return perms; + + // first get policy perms + getPermissions(perms, domain); + + // add static perms + // - adding static perms after policy perms is necessary + // to avoid a regression for 4301064 + PermissionCollection pc = domain.getPermissions(); + if (pc != null) { + synchronized (pc) { + Enumeration e = pc.elements(); + while (e.hasMoreElements()) { + perms.add(e.nextElement()); + } + } + } + + return perms; + } + + /** + * Examines this Policy and creates a PermissionCollection object with the set + * of permissions for the specified CodeSource. + * + * @param CodeSource + * the codesource associated with the caller. This encapsulates the + * original location of the code (where the code came from) and the + * public key(s) of its signer. + * + * @return the set of permissions according to the policy. + */ + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return getPermissions(new Permissions(), codesource); + } + + /** + * Examines the global policy and returns the provided Permissions object with + * additional permissions granted to the specified ProtectionDomain. + * + * @param perm + * the Permissions to populate + * @param pd + * the ProtectionDomain associated with the caller. + * + * @return the set of Permissions according to the policy. + */ + private PermissionCollection getPermissions(Permissions perms, + ProtectionDomain pd) { + if (debug != null) { + debug.println("getPermissions:\n\t" + printPD(pd)); + } + + final CodeSource cs = pd.getCodeSource(); + if (cs == null) + return perms; + + CodeSource canonCodeSource = AccessController + .doPrivileged(new java.security.PrivilegedAction() { + public CodeSource run() { + return canonicalizeCodebase(cs, true); + } + }); + return getPermissions(perms, canonCodeSource, pd.getPrincipals()); + } + + /** + * Examines the global policy and returns the provided Permissions object with + * additional permissions granted to the specified CodeSource. + * + * @param permissions + * the permissions to populate + * @param codesource + * the codesource associated with the caller. This encapsulates the + * original location of the code (where the code came from) and the + * public key(s) of its signer. + * + * @return the set of permissions according to the policy. + */ + private PermissionCollection getPermissions(Permissions perms, + final CodeSource cs) { + + CodeSource canonCodeSource = AccessController + .doPrivileged(new java.security.PrivilegedAction() { + public CodeSource run() { + return canonicalizeCodebase(cs, true); + } + }); + + return getPermissions(perms, canonCodeSource, null); + } + + private Permissions getPermissions(Permissions perms, final CodeSource cs, + Principal[] principals) { + PolicyInfo pi = policyInfo.get(); + + for (PolicyEntry entry : pi.policyEntries) { + addPermissions(perms, cs, principals, entry); + } + + // Go through policyEntries gotten from identity db; sync required + // because checkForTrustedIdentity (below) might update list + synchronized (pi.identityPolicyEntries) { + for (PolicyEntry entry : pi.identityPolicyEntries) { + addPermissions(perms, cs, principals, entry); + } + } + + // now see if any of the keys are trusted ids. + if (!ignoreIdentityScope) { + Certificate certs[] = cs.getCertificates(); + if (certs != null) { + for (int k = 0; k < certs.length; k++) { + Object idMap = pi.aliasMapping.get(certs[k]); + if (idMap == null && checkForTrustedIdentity(certs[k], pi)) { + // checkForTrustedIdentity added it + // to the policy for us. next time + // around we'll find it. This time + // around we need to add it. + perms.add(SecurityConstants.ALL_PERMISSION); + } + } + } + } + return perms; + } + + private void addPermissions(Permissions perms, final CodeSource cs, + Principal[] principals, final PolicyEntry entry) { + + if (debug != null) { + debug.println("evaluate codesources:\n" + "\tPolicy CodeSource: " + + entry.getCodeSource() + "\n" + "\tActive CodeSource: " + cs); + } + + // check to see if the CodeSource implies + Boolean imp = AccessController + .doPrivileged(new PrivilegedAction() { + public Boolean run() { + return new Boolean(entry.getCodeSource().implies(cs)); + } + }); + if (!imp.booleanValue()) { + if (debug != null) { + debug.println("evaluation (codesource) failed"); + } + + // CodeSource does not imply - return and try next policy entry + return; + } + + // check to see if the Principals imply + + List entryPs = entry.getPrincipals(); + if (debug != null) { + ArrayList accPs = new ArrayList(); + if (principals != null) { + for (int i = 0; i < principals.length; i++) { + accPs.add(new PolicyParser.PrincipalEntry( + principals[i].getClass().getName(), principals[i].getName())); + } + } + debug.println("evaluate principals:\n" + "\tPolicy Principals: " + entryPs + + "\n" + "\tActive Principals: " + accPs); + } + + if (entryPs == null || entryPs.size() == 0) { + + // policy entry has no principals - + // add perms regardless of principals in current ACC + + addPerms(perms, principals, entry); + if (debug != null) { + debug.println("evaluation (codesource/principals) passed"); + } + return; + + } else if (principals == null || principals.length == 0) { + + // current thread has no principals but this policy entry + // has principals - perms are not added + + if (debug != null) { + debug.println("evaluation (principals) failed"); + } + return; + } + + // current thread has principals and this policy entry + // has principals. see if policy entry principals match + // principals in current ACC + + for (int i = 0; i < entryPs.size(); i++) { + PolicyParser.PrincipalEntry pppe = entryPs.get(i); + + // see if principal entry is a PrincipalComparator + + try { + Class pClass = Class.forName(pppe.principalClass, true, + Thread.currentThread().getContextClassLoader()); + + if (!PrincipalComparator.class.isAssignableFrom(pClass)) { + + // common case - dealing with regular Principal class. + // see if policy entry principal is in current ACC + + if (!checkEntryPs(principals, pppe)) { + if (debug != null) { + debug.println("evaluation (principals) failed"); + } + + // policy entry principal not in current ACC - + // immediately return and go to next policy entry + return; + } + + } else { + + // dealing with a PrincipalComparator + + Constructor c = pClass.getConstructor(PARAMS1); + PrincipalComparator pc = (PrincipalComparator) c + .newInstance(new Object[] { pppe.principalName }); + + if (debug != null) { + debug.println( + "found PrincipalComparator " + pc.getClass().getName()); + } + + // check if the PrincipalComparator + // implies the current thread's principals + + Set pSet = new HashSet(principals.length); + for (int j = 0; j < principals.length; j++) { + pSet.add(principals[j]); + } + Subject subject = new Subject(true, pSet, Collections.EMPTY_SET, + Collections.EMPTY_SET); + + if (!pc.implies(subject)) { + if (debug != null) { + debug.println("evaluation (principal comparator) failed"); + } + + // policy principal does not imply the current Subject - + // immediately return and go to next policy entry + return; + } + } + } catch (Exception e) { + // fall back to regular principal comparison. + // see if policy entry principal is in current ACC + + if (debug != null) { + e.printStackTrace(); + } + + if (!checkEntryPs(principals, pppe)) { + if (debug != null) { + debug.println("evaluation (principals) failed"); + } + + // policy entry principal not in current ACC - + // immediately return and go to next policy entry + return; + } + } + + // either the principal information matched, + // or the PrincipalComparator.implies succeeded. + // continue loop and test the next policy principal + } + + // all policy entry principals were found in the current ACC - + // grant the policy permissions + + if (debug != null) { + debug.println("evaluation (codesource/principals) passed"); + } + addPerms(perms, principals, entry); + } + + private void addPerms(Permissions perms, Principal[] accPs, + PolicyEntry entry) { + for (int i = 0; i < entry.permissions.size(); i++) { + Permission p = entry.permissions.get(i); + if (debug != null) { + debug.println(" granting " + p); + } + + if (p instanceof SelfPermission) { + // handle "SELF" permissions + expandSelf((SelfPermission) p, entry.getPrincipals(), accPs, perms); + } else { + perms.add(p); + } + } + } + + /** + * This method returns, true, if the principal in the policy entry, pppe, is + * part of the current thread's principal array, pList. This method also + * returns, true, if the policy entry's principal is appropriately wildcarded. + * + * Note that the provided pppe argument may have wildcards (*) for both + * the Principal class and name. + * + * @param pList + * an array of principals from the current thread's + * AccessControlContext. + * + * @param pppe + * a Principal specified in a policy grant entry. + * + * @return true if the current thread's pList "contains" the principal in the + * policy entry, pppe. This method also returns true if the policy + * entry's principal appropriately wildcarded. + */ + private boolean checkEntryPs(Principal[] pList, + PolicyParser.PrincipalEntry pppe) { + + for (int i = 0; i < pList.length; i++) { + + if (pppe.principalClass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) + || pppe.principalClass.equals(pList[i].getClass().getName())) { + + if (pppe.principalName.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME) + || pppe.principalName.equals(pList[i].getName())) { + + return true; + } + } + } + return false; + } + + /** + *

+ * + * @param sp + * the SelfPermission that needs to be expanded + *

+ * + * @param entryPs + * list of principals for the Policy entry. + * + * @param pdp + * Principal array from the current ProtectionDomain. + * + * @param perms + * the PermissionCollection where the individual Permissions will be + * added after expansion. + */ + + private void expandSelf(SelfPermission sp, + List entryPs, Principal[] pdp, + Permissions perms) { + + if (entryPs == null || entryPs.size() == 0) { + // No principals in the grant to substitute + if (debug != null) { + debug.println("Ignoring permission " + sp.getSelfType() + + " with target name (" + sp.getSelfName() + "). " + + "No Principal(s) specified " + "in the grant clause. " + + "SELF-based target names are " + "only valid in the context " + + "of a Principal-based grant entry."); + } + return; + } + int startIndex = 0; + int v; + StringBuilder sb = new StringBuilder(); + while ((v = sp.getSelfName().indexOf(SELF, startIndex)) != -1) { + + // add non-SELF string + sb.append(sp.getSelfName().substring(startIndex, v)); + + // expand SELF + ListIterator pli = entryPs.listIterator(); + while (pli.hasNext()) { + PolicyParser.PrincipalEntry pppe = pli.next(); + String[][] principalInfo = getPrincipalInfo(pppe, pdp); + for (int i = 0; i < principalInfo.length; i++) { + if (i != 0) { + sb.append(", "); + } + sb.append( + principalInfo[i][0] + " " + "\"" + principalInfo[i][1] + "\""); + } + if (pli.hasNext()) { + sb.append(", "); + } + } + startIndex = v + SELF.length(); + } + // add remaining string (might be the entire string) + sb.append(sp.getSelfName().substring(startIndex)); + + if (debug != null) { + debug.println(" expanded:\n\t" + sp.getSelfName() + "\n into:\n\t" + + sb.toString()); + } + try { + // first try to instantiate the permission + perms.add( + getInstance(sp.getSelfType(), sb.toString(), sp.getSelfActions())); + } catch (ClassNotFoundException cnfe) { + // ok, the permission is not in the bootclasspath. + // before we add an UnresolvedPermission, check to see + // whether this perm already belongs to the collection. + // if so, use that perm's ClassLoader to create a new + // one. + Class pc = null; + synchronized (perms) { + Enumeration e = perms.elements(); + while (e.hasMoreElements()) { + Permission pElement = e.nextElement(); + if (pElement.getClass().getName().equals(sp.getSelfType())) { + pc = pElement.getClass(); + break; + } + } + } + if (pc == null) { + // create an UnresolvedPermission + perms.add(new UnresolvedPermission(sp.getSelfType(), sb.toString(), + sp.getSelfActions(), sp.getCerts())); + } else { + try { + // we found an instantiated permission. + // use its class loader to instantiate a new permission. + Constructor c; + // name parameter can not be null + if (sp.getSelfActions() == null) { + try { + c = pc.getConstructor(PARAMS1); + perms.add( + (Permission) c.newInstance(new Object[] { sb.toString() })); + } catch (NoSuchMethodException ne) { + c = pc.getConstructor(PARAMS2); + perms.add((Permission) c.newInstance( + new Object[] { sb.toString(), sp.getSelfActions() })); + } + } else { + c = pc.getConstructor(PARAMS2); + perms.add((Permission) c.newInstance( + new Object[] { sb.toString(), sp.getSelfActions() })); + } + } catch (Exception nme) { + if (debug != null) { + debug.println("self entry expansion " + " instantiation failed: " + + nme.toString()); + } + } + } + } catch (Exception e) { + if (debug != null) { + debug.println(e.toString()); + } + } + } + + /** + * return the principal class/name pair in the 2D array. array[x][y]: x + * corresponds to the array length. if (y == 0), it's the principal class. if + * (y == 1), it's the principal name. + */ + private String[][] getPrincipalInfo(PolicyParser.PrincipalEntry pe, + Principal[] pdp) { + + // there are 3 possibilities: + // 1) the entry's Principal class and name are not wildcarded + // 2) the entry's Principal name is wildcarded only + // 3) the entry's Principal class and name are wildcarded + + if (!pe.principalClass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) + && !pe.principalName + .equals(PolicyParser.PrincipalEntry.WILDCARD_NAME)) { + + // build an info array for the principal + // from the Policy entry + String[][] info = new String[1][2]; + info[0][0] = pe.principalClass; + info[0][1] = pe.principalName; + return info; + + } else if (!pe.principalClass + .equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) + && pe.principalName.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME)) { + + // build an info array for every principal + // in the current domain which has a principal class + // that is equal to policy entry principal class name + List plist = new ArrayList(); + for (int i = 0; i < pdp.length; i++) { + if (pe.principalClass.equals(pdp[i].getClass().getName())) + plist.add(pdp[i]); + } + String[][] info = new String[plist.size()][2]; + int i = 0; + java.util.Iterator pIterator = plist.iterator(); + while (pIterator.hasNext()) { + Principal p = pIterator.next(); + info[i][0] = p.getClass().getName(); + info[i][1] = p.getName(); + i++; + } + return info; + + } else { + + // build an info array for every + // one of the current Domain's principals + + String[][] info = new String[pdp.length][2]; + + for (int i = 0; i < pdp.length; i++) { + info[i][0] = pdp[i].getClass().getName(); + info[i][1] = pdp[i].getName(); + } + return info; + } + } + + /* + * Returns the signer certificates from the list of certificates associated + * with the given code source. + * + * The signer certificates are those certificates that were used to + * verifysigned code originating from the codesource location. + * + * This method assumes that in the given code source, each signer certificate + * is followed by its supporting certificate chain (which may be empty), and + * that the signer certificate and its supporting certificate chain are + * ordered bottom-to-top (i.e., with the signer certificate first and the + * (root) certificate authority last). + */ + protected Certificate[] getSignerCertificates(CodeSource cs) { + Certificate[] certs = null; + if ((certs = cs.getCertificates()) == null) + return null; + for (int i = 0; i < certs.length; i++) { + if (!(certs[i] instanceof X509Certificate)) + return cs.getCertificates(); + } + + // Do we have to do anything? + int i = 0; + int count = 0; + while (i < certs.length) { + count++; + while (((i + 1) < certs.length) + && ((X509Certificate) certs[i]).getIssuerDN() + .equals(((X509Certificate) certs[i + 1]).getSubjectDN())) { + i++; + } + i++; + } + if (count == certs.length) + // Done + return certs; + + ArrayList userCertList = new ArrayList(); + i = 0; + while (i < certs.length) { + userCertList.add(certs[i]); + while (((i + 1) < certs.length) + && ((X509Certificate) certs[i]).getIssuerDN() + .equals(((X509Certificate) certs[i + 1]).getSubjectDN())) { + i++; + } + i++; + } + Certificate[] userCerts = new Certificate[userCertList.size()]; + userCertList.toArray(userCerts); + return userCerts; + } + + private CodeSource canonicalizeCodebase(CodeSource cs, + boolean extractSignerCerts) { + + String path = null; + + CodeSource canonCs = cs; + URL u = cs.getLocation(); + if (u != null && u.getProtocol().equals("file")) { + boolean isLocalFile = false; + String host = u.getHost(); + isLocalFile = (host == null || host.equals("") || host.equals("~") + || host.equalsIgnoreCase("localhost")); + + if (isLocalFile) { + path = u.getFile().replace('/', File.separatorChar); + path = ParseUtil.decode(path); + } + } + + if (path != null) { + try { + URL csUrl = null; + path = canonPath(path); + csUrl = ParseUtil.fileToEncodedURL(new File(path)); + + if (extractSignerCerts) { + canonCs = new CodeSource(csUrl, getSignerCertificates(cs)); + } else { + canonCs = new CodeSource(csUrl, cs.getCertificates()); + } + } catch (IOException ioe) { + // leave codesource as it is, unless we have to extract its + // signer certificates + if (extractSignerCerts) { + canonCs = new CodeSource(cs.getLocation(), getSignerCertificates(cs)); + } + } + } else { + if (extractSignerCerts) { + canonCs = new CodeSource(cs.getLocation(), getSignerCertificates(cs)); + } + } + return canonCs; + } + + // public for java.io.FilePermission + public static String canonPath(String path) throws IOException { + if (path.endsWith("*")) { + path = path.substring(0, path.length() - 1) + "-"; + path = new File(path).getCanonicalPath(); + return path.substring(0, path.length() - 1) + "*"; + } else { + return new File(path).getCanonicalPath(); + } + } + + private String printPD(ProtectionDomain pd) { + Principal[] principals = pd.getPrincipals(); + String pals = ""; + if (principals != null && principals.length > 0) { + StringBuilder palBuf = new StringBuilder("(principals "); + for (int i = 0; i < principals.length; i++) { + palBuf.append(principals[i].getClass().getName() + " \"" + + principals[i].getName() + "\""); + if (i < principals.length - 1) + palBuf.append(", "); + else + palBuf.append(")"); + } + pals = palBuf.toString(); + } + return "PD CodeSource: " + pd.getCodeSource() + "\n\t" + "PD ClassLoader: " + + pd.getClassLoader() + "\n\t" + "PD Principals: " + pals; + } + + /** + * return true if no replacement was performed, or if replacement succeeded. + */ + private boolean replacePrincipals( + List principals, KeyStore keystore) { + + if (principals == null || principals.size() == 0 || keystore == null) + return true; + + ListIterator i = principals.listIterator(); + while (i.hasNext()) { + PolicyParser.PrincipalEntry pppe = i.next(); + if (pppe.principalClass.equals(PolicyParser.REPLACE_NAME)) { + + // perform replacement + // (only X509 replacement is possible now) + String name; + if ((name = getDN(pppe.principalName, keystore)) == null) { + return false; + } + + if (debug != null) { + debug.println(" Replacing \"" + pppe.principalName + "\" with " + + X500PRINCIPAL + "/\"" + name + "\""); + } + + pppe.principalClass = X500PRINCIPAL; + pppe.principalName = name; + } + } + // return true if no replacement was performed, + // or if replacement succeeded + return true; + } + + private void expandPermissionName(PolicyParser.PermissionEntry pe, + KeyStore keystore) throws Exception { + // short cut the common case + if (pe.name == null || pe.name.indexOf("${{", 0) == -1) { + return; + } + + int startIndex = 0; + int b, e; + StringBuilder sb = new StringBuilder(); + while ((b = pe.name.indexOf("${{", startIndex)) != -1) { + e = pe.name.indexOf("}}", b); + if (e < 1) { + break; + } + sb.append(pe.name.substring(startIndex, b)); + + // get the value in ${{...}} + String value = pe.name.substring(b + 3, e); + + // parse up to the first ':' + int colonIndex; + String prefix = value; + String suffix; + if ((colonIndex = value.indexOf(":")) != -1) { + prefix = value.substring(0, colonIndex); + } + + // handle different prefix possibilities + if (prefix.equalsIgnoreCase("self")) { + // do nothing - handled later + sb.append(pe.name.substring(b, e + 2)); + startIndex = e + 2; + continue; + } else if (prefix.equalsIgnoreCase("alias")) { + // get the suffix and perform keystore alias replacement + if (colonIndex == -1) { + MessageFormat form = new MessageFormat( + ResourcesMgr.getString("alias name not provided (pe.name)")); + Object[] source = { pe.name }; + throw new Exception(form.format(source)); + } + suffix = value.substring(colonIndex + 1); + if ((suffix = getDN(suffix, keystore)) == null) { + MessageFormat form = new MessageFormat(ResourcesMgr + .getString("unable to perform substitution on alias, suffix")); + Object[] source = { value.substring(colonIndex + 1) }; + throw new Exception(form.format(source)); + } + + sb.append(X500PRINCIPAL + " \"" + suffix + "\""); + startIndex = e + 2; + } else { + MessageFormat form = new MessageFormat( + ResourcesMgr.getString("substitution value, prefix, unsupported")); + Object[] source = { prefix }; + throw new Exception(form.format(source)); + } + } + + // copy the rest of the value + sb.append(pe.name.substring(startIndex)); + + // replace the name with expanded value + if (debug != null) { + debug.println(" Permission name expanded from:\n\t" + pe.name + + "\nto\n\t" + sb.toString()); + } + pe.name = sb.toString(); + } + + private String getDN(String alias, KeyStore keystore) { + Certificate cert = null; + try { + cert = keystore.getCertificate(alias); + } catch (Exception e) { + if (debug != null) { + debug.println(" Error retrieving certificate for '" + alias + "': " + + e.toString()); + } + return null; + } + + if (cert == null || !(cert instanceof X509Certificate)) { + if (debug != null) { + debug.println( + " -- No certificate for '" + alias + "' - ignoring entry"); + } + return null; + } else { + X509Certificate x509Cert = (X509Certificate) cert; + + // 4702543: X500 names with an EmailAddress + // were encoded incorrectly. create new + // X500Principal name with correct encoding + + X500Principal p = new X500Principal( + x509Cert.getSubjectX500Principal().toString()); + return p.getName(); + } + } + + /** + * Checks public key. If it is marked as trusted in the identity database, add + * it to the policy with the AllPermission. + */ + private boolean checkForTrustedIdentity(final Certificate cert, + PolicyInfo myInfo) { + if (cert == null) + return false; + + // see if we are ignoring the identity scope or not + if (ignoreIdentityScope) + return false; + + // try to initialize scope + synchronized (PolicyFile.class) { + if (scope == null) { + IdentityScope is = IdentityScope.getSystemScope(); + + if (is instanceof com.sun.ts.lib.util.sec.security.provider.IdentityDatabase) { + scope = is; + } else { + // leave scope null + } + } + } + + if (scope == null) { + ignoreIdentityScope = true; + return false; + } + + // need privileged block for getIdentity in case we are trying + // to get a signer + final Identity id = AccessController + .doPrivileged(new java.security.PrivilegedAction() { + public Identity run() { + return scope.getIdentity(cert.getPublicKey()); + } + }); + + if (isTrusted(id)) { + if (debug != null) { + debug.println("Adding policy entry for trusted Identity: "); + // needed for identity toString! + AccessController + .doPrivileged(new java.security.PrivilegedAction() { + public Void run() { + debug.println(" identity = " + id); + return null; + } + }); + debug.println(""); + } + + // add it to the policy for future reference + Certificate certs[] = new Certificate[] { cert }; + PolicyEntry pe = new PolicyEntry(new CodeSource(null, certs)); + pe.add(SecurityConstants.ALL_PERMISSION); + + myInfo.identityPolicyEntries.add(pe); + + // add it to the mapping as well so + // we don't have to go through this again + myInfo.aliasMapping.put(cert, id.getName()); + + return true; + } + return false; + } + + private static boolean isTrusted(Identity id) { + if (id instanceof SystemIdentity) { + SystemIdentity sysid = (SystemIdentity) id; + if (sysid.isTrusted()) { + return true; + } + } else if (id instanceof SystemSigner) { + SystemSigner sysid = (SystemSigner) id; + if (sysid.isTrusted()) { + return true; + } + } + return false; + } + + /** + * Each entry in the policy configuration file is represented by a PolicyEntry + * object. + *

+ * + * A PolicyEntry is a (CodeSource,Permission) pair. The CodeSource contains + * the (URL, PublicKey) that together identify where the Java bytecodes come + * from and who (if anyone) signed them. The URL could refer to localhost. The + * URL could also be null, meaning that this policy entry is given to all + * comers, as long as they match the signer field. The signer could be null, + * meaning the code is not signed. + *

+ * + * The Permission contains the (Type, Name, Action) triplet. + *

+ * + * For now, the Policy object retrieves the public key from the X.509 + * certificate on disk that corresponds to the signedBy alias specified in the + * Policy config file. For reasons of efficiency, the Policy object keeps a + * hashtable of certs already read in. This could be replaced by a secure + * internal key store. + * + *

+ * For example, the entry + * + *

+   *          permission java.io.File "/tmp", "read,write",
+   *          signedBy "Duke";
+   * 
+ * + * is represented internally + * + *
+   *
+   * FilePermission f = new FilePermission("/tmp", "read,write");
+   * PublicKey p = publickeys.get("Duke");
+   * URL u = InetAddress.getLocalHost();
+   * CodeBase c = new CodeBase(p, u);
+   * pe = new PolicyEntry(f, c);
+   * 
+ * + * @author Marianne Mueller + * @author Roland Schemers + * @see java.security.CodeSource + * @see java.security.Policy + * @see java.security.Permissions + * @see java.security.ProtectionDomain + */ + private static class PolicyEntry { + + private final CodeSource codesource; + + final List permissions; + + private final List principals; + + /** + * Given a Permission and a CodeSource, create a policy entry. + * + * XXX Decide if/how to add validity fields and "purpose" fields to XXX + * policy entries + * + * @param cs + * the CodeSource, which encapsulates the URL and the public key + * attributes from the policy config file. Validity checks are + * performed on the public key before PolicyEntry is called. + * + */ + PolicyEntry(CodeSource cs, List principals) { + this.codesource = cs; + this.permissions = new ArrayList(); + this.principals = principals; // can be null + } + + PolicyEntry(CodeSource cs) { + this(cs, null); + } + + List getPrincipals() { + return principals; // can be null + } + + /** + * add a Permission object to this entry. No need to sync add op because + * perms are added to entry only while entry is being initialized + */ + void add(Permission p) { + permissions.add(p); + } + + /** + * Return the CodeSource for this policy entry + */ + CodeSource getCodeSource() { + return codesource; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(ResourcesMgr.getString("(")); + sb.append(getCodeSource()); + sb.append("\n"); + for (int j = 0; j < permissions.size(); j++) { + Permission p = permissions.get(j); + sb.append(ResourcesMgr.getString(" ")); + sb.append(ResourcesMgr.getString(" ")); + sb.append(p); + sb.append(ResourcesMgr.getString("\n")); + } + sb.append(ResourcesMgr.getString(")")); + sb.append(ResourcesMgr.getString("\n")); + return sb.toString(); + } + } + + private static class SelfPermission extends Permission { + + private static final long serialVersionUID = -8315562579967246806L; + + /** + * The class name of the Permission class that will be created when this + * self permission is expanded . + * + * @serial + */ + private String type; + + /** + * The permission name. + * + * @serial + */ + private String name; + + /** + * The actions of the permission. + * + * @serial + */ + private String actions; + + /** + * The certs of the permission. + * + * @serial + */ + private Certificate certs[]; + + /** + * Creates a new SelfPermission containing the permission information needed + * later to expand the self + * + * @param type + * the class name of the Permission class that will be created when + * this permission is expanded and if necessary resolved. + * @param name + * the name of the permission. + * @param actions + * the actions of the permission. + * @param certs + * the certificates the permission's class was signed with. This is + * a list of certificate chains, where each chain is composed of a + * signer certificate and optionally its supporting certificate + * chain. Each chain is ordered bottom-to-top (i.e., with the + * signer certificate first and the (root) certificate authority + * last). + */ + public SelfPermission(String type, String name, String actions, + Certificate certs[]) { + super(type); + if (type == null) { + throw new NullPointerException( + ResourcesMgr.getString("type can't be null")); + } + this.type = type; + this.name = name; + this.actions = actions; + if (certs != null) { + // Extract the signer certs from the list of certificates. + for (int i = 0; i < certs.length; i++) { + if (!(certs[i] instanceof X509Certificate)) { + // there is no concept of signer certs, so we store the + // entire cert array + this.certs = certs.clone(); + break; + } + } + + if (this.certs == null) { + // Go through the list of certs and see if all the certs are + // signer certs. + int i = 0; + int count = 0; + while (i < certs.length) { + count++; + while (((i + 1) < certs.length) + && ((X509Certificate) certs[i]).getIssuerDN() + .equals(((X509Certificate) certs[i + 1]).getSubjectDN())) { + i++; + } + i++; + } + if (count == certs.length) { + // All the certs are signer certs, so we store the + // entire array + this.certs = certs.clone(); + } + + if (this.certs == null) { + // extract the signer certs + ArrayList signerCerts = new ArrayList(); + i = 0; + while (i < certs.length) { + signerCerts.add(certs[i]); + while (((i + 1) < certs.length) + && ((X509Certificate) certs[i]).getIssuerDN().equals( + ((X509Certificate) certs[i + 1]).getSubjectDN())) { + i++; + } + i++; + } + this.certs = new Certificate[signerCerts.size()]; + signerCerts.toArray(this.certs); + } + } + } + } + + /** + * This method always returns false for SelfPermission permissions. That is, + * an SelfPermission never considered to imply another permission. + * + * @param p + * the permission to check against. + * + * @return false. + */ + @Override + public boolean implies(Permission p) { + return false; + } + + /** + * Checks two SelfPermission objects for equality. + * + * Checks that obj is an SelfPermission, and has the same type + * (class) name, permission name, actions, and certificates as this object. + * + * @param obj + * the object we are testing for equality with this object. + * + * @return true if obj is an SelfPermission, and has the same type (class) + * name, permission name, actions, and certificates as this object. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) + return true; + + if (!(obj instanceof SelfPermission)) + return false; + SelfPermission that = (SelfPermission) obj; + + if (!(this.type.equals(that.type) && this.name.equals(that.name) + && this.actions.equals(that.actions))) + return false; + + if (this.certs.length != that.certs.length) + return false; + + int i, j; + boolean match; + + for (i = 0; i < this.certs.length; i++) { + match = false; + for (j = 0; j < that.certs.length; j++) { + if (this.certs[i].equals(that.certs[j])) { + match = true; + break; + } + } + if (!match) + return false; + } + + for (i = 0; i < that.certs.length; i++) { + match = false; + for (j = 0; j < this.certs.length; j++) { + if (that.certs[i].equals(this.certs[j])) { + match = true; + break; + } + } + if (!match) + return false; + } + return true; + } + + /** + * Returns the hash code value for this object. + * + * @return a hash code value for this object. + */ + @Override + public int hashCode() { + int hash = type.hashCode(); + if (name != null) + hash ^= name.hashCode(); + if (actions != null) + hash ^= actions.hashCode(); + return hash; + } + + /** + * Returns the canonical string representation of the actions, which + * currently is the empty string "", since there are no actions for an + * SelfPermission. That is, the actions for the permission that will be + * created when this SelfPermission is resolved may be non-null, but an + * SelfPermission itself is never considered to have any actions. + * + * @return the empty string "". + */ + @Override + public String getActions() { + return ""; + } + + public String getSelfType() { + return type; + } + + public String getSelfName() { + return name; + } + + public String getSelfActions() { + return actions; + } + + public Certificate[] getCerts() { + return certs; + } + + /** + * Returns a string describing this SelfPermission. The convention is to + * specify the class name, the permission name, and the actions, in the + * following format: '(unresolved "ClassName" "name" "actions")'. + * + * @return information about this SelfPermission. + */ + @Override + public String toString() { + return "(SelfPermission " + type + " " + name + " " + actions + ")"; + } + } + + /** + * holds policy information that we need to synch on + */ + private static class PolicyInfo { + private static final boolean verbose = false; + + // Stores grant entries in the policy + final List policyEntries; + + // Stores grant entries gotten from identity database + // Use separate lists to avoid sync on policyEntries + final List identityPolicyEntries; + + // Maps aliases to certs + final Map aliasMapping; + + // Maps ProtectionDomain to PermissionCollection + private final ProtectionDomainCache[] pdMapping; + + private java.util.Random random; + + PolicyInfo(int numCaches) { + policyEntries = new ArrayList(); + identityPolicyEntries = Collections + .synchronizedList(new ArrayList(2)); + aliasMapping = Collections.synchronizedMap(new HashMap(11)); + + pdMapping = new ProtectionDomainCache[numCaches]; + JavaSecurityProtectionDomainAccess jspda = SharedSecrets + .getJavaSecurityProtectionDomainAccess(); + for (int i = 0; i < numCaches; i++) { + pdMapping[i] = jspda.getProtectionDomainCache(); + } + if (numCaches > 1) { + random = new java.util.Random(); + } + } + + ProtectionDomainCache getPdMapping() { + if (pdMapping.length == 1) { + return pdMapping[0]; + } else { + int i = java.lang.Math.abs(random.nextInt() % pdMapping.length); + return pdMapping[i]; + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyParser.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyParser.java new file mode 100644 index 0000000..e411438 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/PolicyParser.java @@ -0,0 +1,1157 @@ +/* + * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.provider; + +import java.io.*; +import java.lang.RuntimePermission; +import java.net.SocketPermission; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.ListIterator; +import java.util.Vector; +import java.util.StringTokenizer; +import java.text.MessageFormat; +import javax.security.auth.x500.X500Principal; + +import java.security.GeneralSecurityException; +import com.sun.ts.lib.util.sec.security.util.Debug; +import com.sun.ts.lib.util.sec.security.util.PropertyExpander; +import com.sun.ts.lib.util.sec.security.util.ResourcesMgr; + +/** + * The policy for a Java runtime (specifying which permissions are available for + * code from various principals) is represented as a separate persistent + * configuration. The configuration may be stored as a flat ASCII file, as a + * serialized binary file of the Policy class, or as a database. + *

+ * + *

+ * The Java runtime creates one global Policy object, which is used to represent + * the static policy configuration file. It is consulted by a ProtectionDomain + * when the protection domain initializes its set of permissions. + *

+ * + *

+ * The Policy init method parses the policy configuration file, and + * then populates the Policy object. The Policy object is agnostic in that it is + * not involved in making policy decisions. It is merely the Java runtime + * representation of the persistent policy configuration file. + *

+ * + *

+ * When a protection domain needs to initialize its set of permissions, it + * executes code such as the following to ask the global Policy object to + * populate a Permissions object with the appropriate permissions: + * + *

+ *  policy = Policy.getPolicy();
+ *  Permissions perms = policy.getPermissions(protectiondomain)
+ * 
+ * + *

+ * The protection domain contains CodeSource object, which encapsulates its + * codebase (URL) and public key attributes. It also contains the principals + * associated with the domain. The Policy object evaluates the global policy in + * light of who the principal is and what the code source is and returns an + * appropriate Permissions object. + * + * @author Roland Schemers + * @author Ram Marti + * + * @since 1.2 + */ + +public class PolicyParser { + + // needs to be public for PolicyTool + public static final String REPLACE_NAME = "PolicyParser.REPLACE_NAME"; + + private Vector grantEntries; + + // Convenience variables for parsing + private static final Debug debug = Debug.getInstance("parser", + "\t[Policy Parser]"); + + private StreamTokenizer st; + + private int lookahead; + + private boolean expandProp = false; + + private String keyStoreUrlString = null; // unexpanded + + private String keyStoreType = null; + + private String keyStoreProvider = null; + + private String storePassURL = null; + + private String expand(String value) throws PropertyExpander.ExpandException { + return expand(value, false); + } + + private String expand(String value, boolean encodeURL) + throws PropertyExpander.ExpandException { + if (!expandProp) { + return value; + } else { + return PropertyExpander.expand(value, encodeURL); + } + } + + /** + * Creates a PolicyParser object. + */ + + public PolicyParser() { + grantEntries = new Vector(); + } + + public PolicyParser(boolean expandProp) { + this(); + this.expandProp = expandProp; + } + + /** + * Reads a policy configuration into the Policy object using a Reader object. + *

+ * + * @param policy + * the policy Reader object. + * + * @exception ParsingException + * if the policy configuration contains a syntax error. + * + * @exception IOException + * if an error occurs while reading the policy configuration. + */ + + public void read(Reader policy) throws ParsingException, IOException { + if (!(policy instanceof BufferedReader)) { + policy = new BufferedReader(policy); + } + + /** + * Configure the stream tokenizer: Recognize strings between "..." Don't + * convert words to lowercase Recognize both C-style and C++-style comments + * Treat end-of-line as white space, not as a token + */ + st = new StreamTokenizer(policy); + + st.resetSyntax(); + st.wordChars('a', 'z'); + st.wordChars('A', 'Z'); + st.wordChars('.', '.'); + st.wordChars('0', '9'); + st.wordChars('_', '_'); + st.wordChars('$', '$'); + st.wordChars(128 + 32, 255); + st.whitespaceChars(0, ' '); + st.commentChar('/'); + st.quoteChar('\''); + st.quoteChar('"'); + st.lowerCaseMode(false); + st.ordinaryChar('/'); + st.slashSlashComments(true); + st.slashStarComments(true); + + /** + * The main parsing loop. The loop is executed once for each entry in the + * config file. The entries are delimited by semicolons. Once we've read in + * the information for an entry, go ahead and try to add it to the policy + * vector. + * + */ + + lookahead = st.nextToken(); + while (lookahead != StreamTokenizer.TT_EOF) { + if (peek("grant")) { + GrantEntry ge = parseGrantEntry(); + // could be null if we couldn't expand a property + if (ge != null) + add(ge); + } else if (peek("keystore") && keyStoreUrlString == null) { + // only one keystore entry per policy file, others will be + // ignored + parseKeyStoreEntry(); + } else if (peek("keystorePasswordURL") && storePassURL == null) { + // only one keystore passwordURL per policy file, others will be + // ignored + parseStorePassURL(); + } else { + // error? + } + match(";"); + } + + if (keyStoreUrlString == null && storePassURL != null) { + throw new ParsingException(ResourcesMgr + .getString("keystorePasswordURL can not be specified without also " + + "specifying keystore")); + } + } + + public void add(GrantEntry ge) { + grantEntries.addElement(ge); + } + + public void replace(GrantEntry origGe, GrantEntry newGe) { + grantEntries.setElementAt(newGe, grantEntries.indexOf(origGe)); + } + + public boolean remove(GrantEntry ge) { + return grantEntries.removeElement(ge); + } + + /** + * Returns the (possibly expanded) keystore location, or null if the expansion + * fails. + */ + public String getKeyStoreUrl() { + try { + if (keyStoreUrlString != null && keyStoreUrlString.length() != 0) { + return expand(keyStoreUrlString, true).replace(File.separatorChar, '/'); + } + } catch (PropertyExpander.ExpandException peee) { + if (debug != null) { + debug.println(peee.toString()); + } + return null; + } + return null; + } + + public void setKeyStoreUrl(String url) { + keyStoreUrlString = url; + } + + public String getKeyStoreType() { + return keyStoreType; + } + + public void setKeyStoreType(String type) { + keyStoreType = type; + } + + public String getKeyStoreProvider() { + return keyStoreProvider; + } + + public void setKeyStoreProvider(String provider) { + keyStoreProvider = provider; + } + + public String getStorePassURL() { + try { + if (storePassURL != null && storePassURL.length() != 0) { + return expand(storePassURL, true).replace(File.separatorChar, '/'); + } + } catch (PropertyExpander.ExpandException peee) { + if (debug != null) { + debug.println(peee.toString()); + } + return null; + } + return null; + } + + public void setStorePassURL(String storePassURL) { + this.storePassURL = storePassURL; + } + + /** + * Enumerate all the entries in the global policy object. This method is used + * by policy admin tools. The tools should use the Enumeration methods on the + * returned object to fetch the elements sequentially. + */ + public Enumeration grantElements() { + return grantEntries.elements(); + } + + /** + * write out the policy + */ + + public void write(Writer policy) { + PrintWriter out = new PrintWriter(new BufferedWriter(policy)); + + Enumeration enum_ = grantElements(); + + out.println( + "/* AUTOMATICALLY GENERATED ON " + (new java.util.Date()) + "*/"); + out.println("/* DO NOT EDIT */"); + out.println(); + + // write the (unexpanded) keystore entry as the first entry of the + // policy file + if (keyStoreUrlString != null) { + writeKeyStoreEntry(out); + } + if (storePassURL != null) { + writeStorePassURL(out); + } + + // write "grant" entries + while (enum_.hasMoreElements()) { + GrantEntry ge = enum_.nextElement(); + ge.write(out); + out.println(); + } + out.flush(); + } + + /** + * parses a keystore entry + */ + private void parseKeyStoreEntry() throws ParsingException, IOException { + match("keystore"); + keyStoreUrlString = match("quoted string"); + + // parse keystore type + if (!peek(",")) { + return; // default type + } + match(","); + + if (peek("\"")) { + keyStoreType = match("quoted string"); + } else { + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("expected keystore type")); + } + + // parse keystore provider + if (!peek(",")) { + return; // provider optional + } + match(","); + + if (peek("\"")) { + keyStoreProvider = match("quoted string"); + } else { + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("expected keystore provider")); + } + } + + private void parseStorePassURL() throws ParsingException, IOException { + match("keyStorePasswordURL"); + storePassURL = match("quoted string"); + } + + /** + * writes the (unexpanded) keystore entry + */ + private void writeKeyStoreEntry(PrintWriter out) { + out.print("keystore \""); + out.print(keyStoreUrlString); + out.print('"'); + if (keyStoreType != null && keyStoreType.length() > 0) + out.print(", \"" + keyStoreType + "\""); + if (keyStoreProvider != null && keyStoreProvider.length() > 0) + out.print(", \"" + keyStoreProvider + "\""); + out.println(";"); + out.println(); + } + + private void writeStorePassURL(PrintWriter out) { + out.print("keystorePasswordURL \""); + out.print(storePassURL); + out.print('"'); + out.println(";"); + out.println(); + } + + /** + * parse a Grant entry + */ + private GrantEntry parseGrantEntry() throws ParsingException, IOException { + GrantEntry e = new GrantEntry(); + LinkedList principals = null; + boolean ignoreEntry = false; + + match("grant"); + + while (!peek("{")) { + + if (peekAndMatch("Codebase")) { + if (e.codeBase != null) + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("multiple Codebase expressions")); + e.codeBase = match("quoted string"); + peekAndMatch(","); + } else if (peekAndMatch("SignedBy")) { + if (e.signedBy != null) + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("multiple SignedBy expressions")); + e.signedBy = match("quoted string"); + + // verify syntax of the aliases + StringTokenizer aliases = new StringTokenizer(e.signedBy, ",", true); + int actr = 0; + int cctr = 0; + while (aliases.hasMoreTokens()) { + String alias = aliases.nextToken().trim(); + if (alias.equals(",")) + cctr++; + else if (alias.length() > 0) + actr++; + } + if (actr <= cctr) + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("SignedBy has empty alias")); + + peekAndMatch(","); + } else if (peekAndMatch("Principal")) { + if (principals == null) { + principals = new LinkedList(); + } + + String principalClass; + String principalName; + + if (peek("\"")) { + // both the principalClass and principalName + // will be replaced later + principalClass = REPLACE_NAME; + principalName = match("principal type"); + } else { + // check for principalClass wildcard + if (peek("*")) { + match("*"); + principalClass = PrincipalEntry.WILDCARD_CLASS; + } else { + principalClass = match("principal type"); + } + + // check for principalName wildcard + if (peek("*")) { + match("*"); + principalName = PrincipalEntry.WILDCARD_NAME; + } else { + principalName = match("quoted string"); + } + + // disallow WILDCARD_CLASS && actual name + if (principalClass.equals(PrincipalEntry.WILDCARD_CLASS) + && !principalName.equals(PrincipalEntry.WILDCARD_NAME)) { + if (debug != null) { + debug.println("disallowing principal that " + + "has WILDCARD class but no WILDCARD name"); + } + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("can not specify Principal with a " + + "wildcard class without a wildcard name")); + } + } + + try { + principalName = expand(principalName); + + if (principalClass.equals("javax.security.auth.x500.X500Principal") + && !principalName.equals(PrincipalEntry.WILDCARD_NAME)) { + + // 4702543: X500 names with an EmailAddress + // were encoded incorrectly. construct a new + // X500Principal with correct encoding. + + X500Principal p = new X500Principal( + (new X500Principal(principalName)).toString()); + principalName = p.getName(); + } + + principals.add(new PrincipalEntry(principalClass, principalName)); + } catch (PropertyExpander.ExpandException peee) { + // ignore the entire policy entry + // but continue parsing all the info + // so we can get to the next entry + if (debug != null) { + debug.println("principal name expansion failed: " + principalName); + } + ignoreEntry = true; + } + peekAndMatch(","); + + } else { + throw new ParsingException(st.lineno(), ResourcesMgr + .getString("expected codeBase or SignedBy or " + "Principal")); + } + } + + if (principals != null) + e.principals = principals; + match("{"); + + while (!peek("}")) { + if (peek("Permission")) { + try { + PermissionEntry pe = parsePermissionEntry(); + e.add(pe); + } catch (PropertyExpander.ExpandException peee) { + // ignore. The add never happened + if (debug != null) { + debug.println(peee.toString()); + } + skipEntry(); // BugId 4219343 + } + match(";"); + } else { + throw new ParsingException(st.lineno(), + ResourcesMgr.getString("expected permission entry")); + } + } + match("}"); + + try { + if (e.signedBy != null) + e.signedBy = expand(e.signedBy); + if (e.codeBase != null) { + + + e.codeBase = expand(e.codeBase, true).replace(File.separatorChar, + '/'); + } + } catch (PropertyExpander.ExpandException peee) { + if (debug != null) { + debug.println(peee.toString()); + } + return null; + } + + return (ignoreEntry == true) ? null : e; + } + + /** + * parse a Permission entry + */ + private PermissionEntry parsePermissionEntry() + throws ParsingException, IOException, PropertyExpander.ExpandException { + PermissionEntry e = new PermissionEntry(); + + // Permission + match("Permission"); + e.permission = match("permission type"); + + if (peek("\"")) { + // Permission name + e.name = expand(match("quoted string")); + } + + if (!peek(",")) { + return e; + } + match(","); + + if (peek("\"")) { + e.action = expand(match("quoted string")); + if (!peek(",")) { + return e; + } + match(","); + } + + if (peekAndMatch("SignedBy")) { + e.signedBy = expand(match("quoted string")); + } + return e; + } + + // package-private: used by PolicyFile for static policy + static String[] parseExtDirs(String codebase, int start) { + return null; + } + + private boolean peekAndMatch(String expect) + throws ParsingException, IOException { + if (peek(expect)) { + match(expect); + return true; + } else { + return false; + } + } + + private boolean peek(String expect) { + boolean found = false; + + switch (lookahead) { + + case StreamTokenizer.TT_WORD: + if (expect.equalsIgnoreCase(st.sval)) + found = true; + break; + case ',': + if (expect.equalsIgnoreCase(",")) + found = true; + break; + case '{': + if (expect.equalsIgnoreCase("{")) + found = true; + break; + case '}': + if (expect.equalsIgnoreCase("}")) + found = true; + break; + case '"': + if (expect.equalsIgnoreCase("\"")) + found = true; + break; + case '*': + if (expect.equalsIgnoreCase("*")) + found = true; + break; + default: + + } + return found; + } + + private String match(String expect) throws ParsingException, IOException { + String value = null; + + switch (lookahead) { + case StreamTokenizer.TT_NUMBER: + throw new ParsingException(st.lineno(), expect, + ResourcesMgr.getString("number ") + String.valueOf(st.nval)); + case StreamTokenizer.TT_EOF: + MessageFormat form = new MessageFormat( + ResourcesMgr.getString("expected [expect], read [end of file]")); + Object[] source = { expect }; + throw new ParsingException(form.format(source)); + case StreamTokenizer.TT_WORD: + if (expect.equalsIgnoreCase(st.sval)) { + lookahead = st.nextToken(); + } else if (expect.equalsIgnoreCase("permission type")) { + value = st.sval; + lookahead = st.nextToken(); + } else if (expect.equalsIgnoreCase("principal type")) { + value = st.sval; + lookahead = st.nextToken(); + } else { + throw new ParsingException(st.lineno(), expect, st.sval); + } + break; + case '"': + if (expect.equalsIgnoreCase("quoted string")) { + value = st.sval; + lookahead = st.nextToken(); + } else if (expect.equalsIgnoreCase("permission type")) { + value = st.sval; + lookahead = st.nextToken(); + } else if (expect.equalsIgnoreCase("principal type")) { + value = st.sval; + lookahead = st.nextToken(); + } else { + throw new ParsingException(st.lineno(), expect, st.sval); + } + break; + case ',': + if (expect.equalsIgnoreCase(",")) + lookahead = st.nextToken(); + else + throw new ParsingException(st.lineno(), expect, ","); + break; + case '{': + if (expect.equalsIgnoreCase("{")) + lookahead = st.nextToken(); + else + throw new ParsingException(st.lineno(), expect, "{"); + break; + case '}': + if (expect.equalsIgnoreCase("}")) + lookahead = st.nextToken(); + else + throw new ParsingException(st.lineno(), expect, "}"); + break; + case ';': + if (expect.equalsIgnoreCase(";")) + lookahead = st.nextToken(); + else + throw new ParsingException(st.lineno(), expect, ";"); + break; + case '*': + if (expect.equalsIgnoreCase("*")) + lookahead = st.nextToken(); + else + throw new ParsingException(st.lineno(), expect, "*"); + break; + default: + throw new ParsingException(st.lineno(), expect, + new String(new char[] { (char) lookahead })); + } + return value; + } + + /** + * skip all tokens for this entry leaving the delimiter ";" in the stream. + */ + private void skipEntry() throws ParsingException, IOException { + while (lookahead != ';') { + switch (lookahead) { + case StreamTokenizer.TT_NUMBER: + throw new ParsingException(st.lineno(), ";", + ResourcesMgr.getString("number ") + String.valueOf(st.nval)); + case StreamTokenizer.TT_EOF: + throw new ParsingException( + ResourcesMgr.getString("expected [;], read [end of file]")); + default: + lookahead = st.nextToken(); + } + } + } + + /** + * Each grant entry in the policy configuration file is represented by a + * GrantEntry object. + *

+ * + *

+ * For example, the entry + * + *

+   *      grant signedBy "Duke" {
+   *          permission java.io.FilePermission "/tmp", "read,write";
+   *      };
+   *
+   * 
+ * + * is represented internally + * + *
+   *
+   * pe = new PermissionEntry("java.io.FilePermission", "/tmp", "read,write");
+   *
+   * ge = new GrantEntry("Duke", null);
+   *
+   * ge.add(pe);
+   *
+   * 
+ * + * @author Roland Schemers + * + * version 1.19, 05/21/98 + */ + + public static class GrantEntry { + + public String signedBy; + + public String codeBase; + + public LinkedList principals; + + public Vector permissionEntries; + + public GrantEntry() { + principals = new LinkedList(); + permissionEntries = new Vector(); + } + + public GrantEntry(String signedBy, String codeBase) { + this.codeBase = codeBase; + this.signedBy = signedBy; + principals = new LinkedList(); + permissionEntries = new Vector(); + } + + public void add(PermissionEntry pe) { + permissionEntries.addElement(pe); + } + + public boolean remove(PrincipalEntry pe) { + return principals.remove(pe); + } + + public boolean remove(PermissionEntry pe) { + return permissionEntries.removeElement(pe); + } + + public boolean contains(PrincipalEntry pe) { + return principals.contains(pe); + } + + public boolean contains(PermissionEntry pe) { + return permissionEntries.contains(pe); + } + + /** + * Enumerate all the permission entries in this GrantEntry. + */ + public Enumeration permissionElements() { + return permissionEntries.elements(); + } + + public void write(PrintWriter out) { + out.print("grant"); + if (signedBy != null) { + out.print(" signedBy \""); + out.print(signedBy); + out.print('"'); + if (codeBase != null) + out.print(", "); + } + if (codeBase != null) { + out.print(" codeBase \""); + out.print(codeBase); + out.print('"'); + if (principals != null && principals.size() > 0) + out.print(",\n"); + } + if (principals != null && principals.size() > 0) { + ListIterator pli = principals.listIterator(); + while (pli.hasNext()) { + out.print(" "); + PrincipalEntry pe = pli.next(); + pe.write(out); + if (pli.hasNext()) + out.print(",\n"); + } + } + out.println(" {"); + Enumeration enum_ = permissionEntries.elements(); + while (enum_.hasMoreElements()) { + PermissionEntry pe = enum_.nextElement(); + out.write(" "); + pe.write(out); + } + out.println("};"); + } + + public Object clone() { + GrantEntry ge = new GrantEntry(); + ge.codeBase = this.codeBase; + ge.signedBy = this.signedBy; + ge.principals = new LinkedList(this.principals); + ge.permissionEntries = new Vector( + this.permissionEntries); + return ge; + } + } + + /** + * Principal info (class and name) in a grant entry + */ + public static class PrincipalEntry { + + public static final String WILDCARD_CLASS = "WILDCARD_PRINCIPAL_CLASS"; + + public static final String WILDCARD_NAME = "WILDCARD_PRINCIPAL_NAME"; + + String principalClass; + + String principalName; + + /** + * A PrincipalEntry consists of the Principal class and + * Principal name. + * + *

+ * + * @param principalClass + * the Principal class. + *

+ * + * @param principalName + * the Principal name. + *

+ */ + public PrincipalEntry(String principalClass, String principalName) { + if (principalClass == null || principalName == null) + throw new NullPointerException( + ResourcesMgr.getString("null principalClass or principalName")); + this.principalClass = principalClass; + this.principalName = principalName; + } + + public String getPrincipalClass() { + return principalClass; + } + + public String getPrincipalName() { + return principalName; + } + + public String getDisplayClass() { + if (principalClass.equals(WILDCARD_CLASS)) { + return "*"; + } else if (principalClass.equals(REPLACE_NAME)) { + return ""; + } else + return principalClass; + } + + public String getDisplayName() { + return getDisplayName(false); + } + + public String getDisplayName(boolean addQuote) { + if (principalName.equals(WILDCARD_NAME)) { + return "*"; + } else { + if (addQuote) + return "\"" + principalName + "\""; + else + return principalName; + } + } + + public String toString() { + if (!principalClass.equals(REPLACE_NAME)) { + return getDisplayClass() + "/" + getDisplayName(); + } else { + return getDisplayName(); + } + } + + /** + * Test for equality between the specified object and this object. Two + * PrincipalEntries are equal if their PrincipalClass and PrincipalName + * values are equal. + * + *

+ * + * @param obj + * the object to test for equality with this object. + * + * @return true if the objects are equal, false otherwise. + */ + public boolean equals(Object obj) { + if (this == obj) + return true; + + if (!(obj instanceof PrincipalEntry)) + return false; + + PrincipalEntry that = (PrincipalEntry) obj; + if (this.principalClass.equals(that.principalClass) + && this.principalName.equals(that.principalName)) { + return true; + } + + return false; + } + + /** + * Return a hashcode for this PrincipalEntry. + * + *

+ * + * @return a hashcode for this PrincipalEntry. + */ + public int hashCode() { + return principalClass.hashCode(); + } + + public void write(PrintWriter out) { + out.print("principal " + getDisplayClass() + " " + getDisplayName(true)); + } + } + + /** + * Each permission entry in the policy configuration file is represented by a + * PermissionEntry object. + *

+ * + *

+ * For example, the entry + * + *

+   *          permission java.io.FilePermission "/tmp", "read,write";
+   * 
+ * + * is represented internally + * + *
+   *
+   * pe = new PermissionEntry("java.io.FilePermission", "/tmp", "read,write");
+   * 
+ * + * @author Roland Schemers + * + * version 1.19, 05/21/98 + */ + + public static class PermissionEntry { + + public String permission; + + public String name; + + public String action; + + public String signedBy; + + public PermissionEntry() { + } + + public PermissionEntry(String permission, String name, String action) { + this.permission = permission; + this.name = name; + this.action = action; + } + + /** + * Calculates a hash code value for the object. Objects which are equal will + * also have the same hashcode. + */ + public int hashCode() { + int retval = permission.hashCode(); + if (name != null) + retval ^= name.hashCode(); + if (action != null) + retval ^= action.hashCode(); + return retval; + } + + public boolean equals(Object obj) { + if (obj == this) + return true; + + if (!(obj instanceof PermissionEntry)) + return false; + + PermissionEntry that = (PermissionEntry) obj; + + if (this.permission == null) { + if (that.permission != null) + return false; + } else { + if (!this.permission.equals(that.permission)) + return false; + } + + if (this.name == null) { + if (that.name != null) + return false; + } else { + if (!this.name.equals(that.name)) + return false; + } + + if (this.action == null) { + if (that.action != null) + return false; + } else { + if (!this.action.equals(that.action)) + return false; + } + + if (this.signedBy == null) { + if (that.signedBy != null) + return false; + } else { + if (!this.signedBy.equals(that.signedBy)) + return false; + } + + // everything matched -- the 2 objects are equal + return true; + } + + public void write(PrintWriter out) { + out.print("permission "); + out.print(permission); + if (name != null) { + out.print(" \""); + + // ATTENTION: regex with double escaping, + // the normal forms look like: + // $name =~ s/\\/\\\\/g; and + // $name =~ s/\"/\\\"/g; + // and then in a java string, it's escaped again + + out.print( + name.replaceAll("\\\\", "\\\\\\\\").replaceAll("\\\"", "\\\\\\\"")); + out.print('"'); + } + if (action != null) { + out.print(", \""); + out.print(action); + out.print('"'); + } + if (signedBy != null) { + out.print(", signedBy \""); + out.print(signedBy); + out.print('"'); + } + out.println(";"); + } + } + + public static class ParsingException extends GeneralSecurityException { + + private static final long serialVersionUID = -4330692689482574072L; + + private String i18nMessage; + + /** + * Constructs a ParsingException with the specified detail message. A detail + * message is a String that describes this particular exception, which may, + * for example, specify which algorithm is not available. + * + * @param msg + * the detail message. + */ + public ParsingException(String msg) { + super(msg); + i18nMessage = msg; + } + + public ParsingException(int line, String msg) { + super("line " + line + ": " + msg); + MessageFormat form = new MessageFormat( + ResourcesMgr.getString("line number: msg")); + Object[] source = { new Integer(line), msg }; + i18nMessage = form.format(source); + } + + public ParsingException(int line, String expect, String actual) { + super("line " + line + ": expected [" + expect + "], found [" + actual + + "]"); + MessageFormat form = new MessageFormat(ResourcesMgr + .getString("line number: expected [expect], found [actual]")); + Object[] source = { new Integer(line), expect, actual }; + i18nMessage = form.format(source); + } + + public String getLocalizedMessage() { + return i18nMessage; + } + } + + public static void main(String arg[]) throws Exception { + FileReader fr = null; + FileWriter fw = null; + try { + PolicyParser pp = new PolicyParser(true); + fr = new FileReader(arg[0]); + pp.read(fr); + fw = new FileWriter(arg[1]); + pp.write(fw); + } finally { + if (fr != null) { + fr.close(); + } + + if (fw != null) { + fw.close(); + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemIdentity.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemIdentity.java new file mode 100644 index 0000000..4a71073 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemIdentity.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1996, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.provider; + +import java.io.Serializable; +import java.util.Enumeration; +import java.security.*; + +/** + * An identity with a very simple trust mechanism. + * + * @author Benjamin Renaud + */ + +public class SystemIdentity extends Identity implements Serializable { + + /** use serialVersionUID from JDK 1.1. for interoperability */ + private static final long serialVersionUID = 9060648952088498478L; + + /* This should be changed to ACL */ + boolean trusted = false; + + /* Free form additional information about this identity. */ + private String info; + + public SystemIdentity(String name, IdentityScope scope) + throws InvalidParameterException, KeyManagementException { + super(name, scope); + } + + /** + * Is this identity trusted by sun.* facilities? + */ + public boolean isTrusted() { + return trusted; + } + + /** + * Set the trust status of this identity. + */ + protected void setTrusted(boolean trusted) { + this.trusted = trusted; + } + + void setIdentityInfo(String info) { + super.setInfo(info); + } + + String getIndentityInfo() { + return super.getInfo(); + } + + /** + * Call back method into a protected method for package friends. + */ + void setIdentityPublicKey(PublicKey key) throws KeyManagementException { + setPublicKey(key); + } + + /** + * Call back method into a protected method for package friends. + */ + void addIdentityCertificate(Certificate cert) throws KeyManagementException { + addCertificate(cert); + } + + void clearCertificates() throws KeyManagementException { + Certificate[] certs = certificates(); + for (int i = 0; i < certs.length; i++) { + removeCertificate(certs[i]); + } + } + + public String toString() { + String trustedString = "not trusted"; + if (trusted) { + trustedString = "trusted"; + } + return super.toString() + "[" + trustedString + "]"; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemSigner.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemSigner.java new file mode 100644 index 0000000..d356952 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/provider/SystemSigner.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 1996, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.provider; + +import java.util.*; +import java.security.*; + +/** + * SunSecurity signer. Like SystemIdentity, it has a trust bit, which can be set + * by SunSecurity classes, and a set of accessors for other classes in + * sun.security.*. + * + * @author Benjamin Renaud + */ + +public class SystemSigner extends Signer { + + /** use serialVersionUID from JDK 1.1. for interoperability */ + private static final long serialVersionUID = -2127743304301557711L; + + /* Is this signer trusted */ + private boolean trusted = false; + + /** + * Construct a signer with a given name. + */ + public SystemSigner(String name) { + super(name); + } + + /** + * Construct a signer with a name and a scope. + * + * @param name + * the signer's name. + * + * @param scope + * the scope for this signer. + */ + public SystemSigner(String name, IdentityScope scope) + throws KeyManagementException { + + super(name, scope); + } + + /* Set the trust status of this signer */ + void setTrusted(boolean trusted) { + this.trusted = trusted; + } + + /** + * Returns true if this signer is trusted. + */ + public boolean isTrusted() { + return trusted; + } + + /* friendly callback for set keys */ + void setSignerKeyPair(KeyPair pair) + throws InvalidParameterException, KeyException { + setKeyPair(pair); + } + + /* friendly callback for getting private keys */ + PrivateKey getSignerPrivateKey() { + return getPrivateKey(); + } + + void setSignerInfo(String s) { + setInfo(s); + } + + /** + * Call back method into a protected method for package friends. + */ + void addSignerCertificate(Certificate cert) throws KeyManagementException { + addCertificate(cert); + } + + void clearCertificates() throws KeyManagementException { + Certificate[] certs = certificates(); + for (int i = 0; i < certs.length; i++) { + removeCertificate(certs[i]); + } + } + + public String toString() { + String trustedString = "not trusted"; + if (trusted) { + trustedString = "trusted"; + } + return super.toString() + "[" + trustedString + "]"; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Debug.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Debug.java new file mode 100644 index 0000000..0c9f6f7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Debug.java @@ -0,0 +1,274 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +import java.math.BigInteger; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +/** + * A utility class for debuging. + * + * @author Roland Schemers + */ +public class Debug { + + private String prefix; + + private static String args; + + static { + args = java.security.AccessController.doPrivileged( + new com.sun.ts.lib.util.sec.security.action.GetPropertyAction( + "java.security.debug")); + + String args2 = java.security.AccessController.doPrivileged( + new com.sun.ts.lib.util.sec.security.action.GetPropertyAction( + "java.security.auth.debug")); + + if (args == null) { + args = args2; + } else { + if (args2 != null) + args = args + "," + args2; + } + + if (args != null) { + args = marshal(args); + if (args.equals("help")) { + Help(); + } + } + } + + public static void Help() { + System.err.println(); + System.err.println("all turn on all debugging"); + System.err.println("access print all checkPermission results"); + System.err.println("combiner SubjectDomainCombiner debugging"); + System.err.println("gssloginconfig"); + System.err.println("configfile JAAS ConfigFile loading"); + System.err.println("configparser JAAS ConfigFile parsing"); + System.err.println(" GSS LoginConfigImpl debugging"); + System.err.println("jar jar verification"); + System.err.println("logincontext login context results"); + System.err.println("policy loading and granting"); + System.err.println("provider security provider debugging"); + System.err.println("scl permissions SecureClassLoader assigns"); + System.err.println(); + System.err.println("The following can be used with access:"); + System.err.println(); + System.err.println("stack include stack trace"); + System.err.println("domain dump all domains in context"); + System.err.println("failure before throwing exception, dump stack"); + System.err.println(" and domain that didn't have permission"); + System.err.println(); + System.err.println("The following can be used with stack and domain:"); + System.err.println(); + System.err.println("permission="); + System.err + .println(" only dump output if specified permission"); + System.err.println(" is being checked"); + System.err.println("codebase="); + System.err.println(" only dump output if specified codebase"); + System.err.println(" is being checked"); + + System.err.println(); + System.err.println("Note: Separate multiple options with a comma"); + System.exit(0); + } + + /** + * Get a Debug object corresponding to whether or not the given option is set. + * Set the prefix to be the same as option. + */ + + public static Debug getInstance(String option) { + return getInstance(option, option); + } + + /** + * Get a Debug object corresponding to whether or not the given option is set. + * Set the prefix to be prefix. + */ + public static Debug getInstance(String option, String prefix) { + if (isOn(option)) { + Debug d = new Debug(); + d.prefix = prefix; + return d; + } else { + return null; + } + } + + /** + * True if the system property "security.debug" contains the string "option". + */ + public static boolean isOn(String option) { + if (args == null) + return false; + else { + if (args.indexOf("all") != -1) + return true; + else + return (args.indexOf(option) != -1); + } + } + + /** + * print a message to stderr that is prefixed with the prefix created from the + * call to getInstance. + */ + + public void println(String message) { + System.err.println(prefix + ": " + message); + } + + /** + * print a blank line to stderr that is prefixed with the prefix. + */ + + public void println() { + System.err.println(prefix + ":"); + } + + /** + * print a message to stderr that is prefixed with the prefix. + */ + + public static void println(String prefix, String message) { + System.err.println(prefix + ": " + message); + } + + /** + * return a hexadecimal printed representation of the specified BigInteger + * object. the value is formatted to fit on lines of at least 75 characters, + * with embedded newlines. Words are separated for readability, with eight + * words (32 bytes) per line. + */ + public static String toHexString(BigInteger b) { + String hexValue = b.toString(16); + StringBuffer buf = new StringBuffer(hexValue.length() * 2); + + if (hexValue.startsWith("-")) { + buf.append(" -"); + hexValue = hexValue.substring(1); + } else { + buf.append(" "); // four spaces + } + if ((hexValue.length() % 2) != 0) { + // add back the leading 0 + hexValue = "0" + hexValue; + } + int i = 0; + while (i < hexValue.length()) { + // one byte at a time + buf.append(hexValue.substring(i, i + 2)); + i += 2; + if (i != hexValue.length()) { + if ((i % 64) == 0) { + buf.append("\n "); // line after eight words + } else if (i % 8 == 0) { + buf.append(" "); // space between words + } + } + } + return buf.toString(); + } + + /** + * change a string into lower case except permission classes and URLs. + */ + private static String marshal(String args) { + if (args != null) { + StringBuffer target = new StringBuffer(); + StringBuffer source = new StringBuffer(args); + + // obtain the "permission=" options + // the syntax of classname: IDENTIFIER.IDENTIFIER + // the regular express to match a class name: + // "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*" + String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]="; + String keyStr = "permission="; + String reg = keyReg + + "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(source); + StringBuffer left = new StringBuffer(); + while (matcher.find()) { + String matched = matcher.group(); + target.append(matched.replaceFirst(keyReg, keyStr)); + target.append(" "); + + // delete the matched sequence + matcher.appendReplacement(left, ""); + } + matcher.appendTail(left); + source = left; + + // obtain the "codebase=" options + // the syntax of URL is too flexible, and here assumes that the + // URL contains no space, comma(','), and semicolon(';'). That + // also means those characters also could be used as separator + // after codebase option. + // However, the assumption is incorrect in some special situation + // when the URL contains comma or semicolon + keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]="; + keyStr = "codebase="; + reg = keyReg + "[^, ;]*"; + pattern = Pattern.compile(reg); + matcher = pattern.matcher(source); + left = new StringBuffer(); + while (matcher.find()) { + String matched = matcher.group(); + target.append(matched.replaceFirst(keyReg, keyStr)); + target.append(" "); + + // delete the matched sequence + matcher.appendReplacement(left, ""); + } + matcher.appendTail(left); + source = left; + + // convert the rest to lower-case characters + target.append(source.toString().toLowerCase()); + + return target.toString(); + } + + return null; + } + + private final static char[] hexDigits = "0123456789abcdef".toCharArray(); + + public static String toString(byte[] b) { + if (b == null) { + return "(null)"; + } + StringBuilder sb = new StringBuilder(b.length * 3); + for (int i = 0; i < b.length; i++) { + int k = b[i] & 0xff; + if (i != 0) { + sb.append(':'); + } + sb.append(hexDigits[k >>> 4]); + sb.append(hexDigits[k & 0xf]); + } + return sb.toString(); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Password.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Password.java new file mode 100644 index 0000000..24aeba2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/Password.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +import java.io.*; +import java.nio.*; +import java.nio.charset.*; +import java.util.Arrays; + +/** + * A utility class for reading passwords + * + */ +public class Password { + /** Reads user password from given input stream. */ + public static char[] readPassword(InputStream in) throws IOException { + + char[] consoleEntered = null; + byte[] consoleBytes = null; + + try { + // Use the new java.io.Console class + Console con = null; + if (in == System.in && ((con = System.console()) != null)) { + consoleEntered = con.readPassword(); + // readPassword returns "" if you just print ENTER, + // to be compatible with old Password class, change to null + if (consoleEntered != null && consoleEntered.length == 0) { + return null; + } + consoleBytes = convertToBytes(consoleEntered); + in = new ByteArrayInputStream(consoleBytes); + } + + // Rest of the lines still necessary for KeyStoreLoginModule + // and when there is no console. + + char[] lineBuffer; + char[] buf; + int i; + + buf = lineBuffer = new char[128]; + + int room = buf.length; + int offset = 0; + int c; + + boolean done = false; + while (!done) { + switch (c = in.read()) { + case -1: + case '\n': + done = true; + break; + + case '\r': + int c2 = in.read(); + if ((c2 != '\n') && (c2 != -1)) { + if (!(in instanceof PushbackInputStream)) { + in = new PushbackInputStream(in); + } + ((PushbackInputStream) in).unread(c2); + } else { + done = true; + break; + } + + default: + if (--room < 0) { + buf = new char[offset + 128]; + room = buf.length - offset - 1; + System.arraycopy(lineBuffer, 0, buf, 0, offset); + Arrays.fill(lineBuffer, ' '); + lineBuffer = buf; + } + buf[offset++] = (char) c; + break; + } + } + + if (offset == 0) { + return null; + } + + char[] ret = new char[offset]; + System.arraycopy(buf, 0, ret, 0, offset); + Arrays.fill(buf, ' '); + + return ret; + } finally { + if (consoleEntered != null) { + Arrays.fill(consoleEntered, ' '); + } + if (consoleBytes != null) { + Arrays.fill(consoleBytes, (byte) 0); + } + } + } + + /** + * Change a password read from Console.readPassword() into its original bytes. + * + * @param pass + * a char[] + * @return its byte[] format, similar to new String(pass).getBytes() + */ + private static byte[] convertToBytes(char[] pass) { + if (enc == null) { + synchronized (Password.class) { + enc = com.sun.ts.lib.util.sec.misc.SharedSecrets.getJavaIOAccess() + .charset().newEncoder().onMalformedInput(CodingErrorAction.REPLACE) + .onUnmappableCharacter(CodingErrorAction.REPLACE); + } + } + byte[] ba = new byte[(int) (enc.maxBytesPerChar() * pass.length)]; + ByteBuffer bb = ByteBuffer.wrap(ba); + synchronized (enc) { + enc.reset().encode(CharBuffer.wrap(pass), bb, true); + } + if (bb.position() < ba.length) { + ba[bb.position()] = '\n'; + } + return ba; + } + + private static volatile CharsetEncoder enc; +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PolicyUtil.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PolicyUtil.java new file mode 100644 index 0000000..dc4d544 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PolicyUtil.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +import java.io.*; +import java.net.*; +import java.security.*; +import java.util.Arrays; + +import com.sun.ts.lib.util.sec.net.www.ParseUtil; + +/** + * A utility class for getting a KeyStore instance from policy information. In + * addition, a supporting getInputStream method. + * + */ +public class PolicyUtil { + + // standard PKCS11 KeyStore type + private static final String P11KEYSTORE = "PKCS11"; + + // reserved word + private static final String NONE = "NONE"; + + /* + * Fast path reading from file urls in order to avoid calling + * FileURLConnection.connect() which can be quite slow the first time it is + * called. We really should clean up FileURLConnection so that this is not a + * problem but in the meantime this fix helps reduce start up time noticeably + * for the new launcher. -- DAC + */ + public static InputStream getInputStream(URL url) throws IOException { + if ("file".equals(url.getProtocol())) { + String path = url.getFile().replace('/', File.separatorChar); + path = ParseUtil.decode(path); + return new FileInputStream(path); + } else { + return url.openStream(); + } + } + + /** + * this is intended for use by policytool and the policy parser to instantiate + * a KeyStore from the information in the GUI/policy file + */ + public static KeyStore getKeyStore(URL policyUrl, // URL of policy file + String keyStoreName, // input: keyStore URL + String keyStoreType, // input: keyStore type + String keyStoreProvider, // input: keyStore provider + String storePassURL, // input: keyStore password + Debug debug) throws KeyStoreException, MalformedURLException, IOException, + NoSuchProviderException, NoSuchAlgorithmException, + java.security.cert.CertificateException { + + if (keyStoreName == null) { + throw new IllegalArgumentException("null KeyStore name"); + } + + char[] keyStorePassword = null; + try { + KeyStore ks; + if (keyStoreType == null) { + keyStoreType = KeyStore.getDefaultType(); + } + + if (P11KEYSTORE.equalsIgnoreCase(keyStoreType) + && !NONE.equals(keyStoreName)) { + throw new IllegalArgumentException("Invalid value (" + keyStoreName + + ") for keystore URL. If the keystore type is \"" + P11KEYSTORE + + "\", the keystore url must be \"" + NONE + "\""); + } + + if (keyStoreProvider != null) { + ks = KeyStore.getInstance(keyStoreType, keyStoreProvider); + } else { + ks = KeyStore.getInstance(keyStoreType); + } + + if (storePassURL != null) { + URL passURL; + try { + passURL = new URL(storePassURL); + // absolute URL + } catch (MalformedURLException e) { + // relative URL + if (policyUrl == null) { + throw e; + } + passURL = new URL(policyUrl, storePassURL); + } + + if (debug != null) { + debug.println("reading password" + passURL); + } + + InputStream in = null; + try { + in = passURL.openStream(); + keyStorePassword = Password.readPassword(in); + } finally { + if (in != null) { + in.close(); + } + } + } + + if (NONE.equals(keyStoreName)) { + ks.load(null, keyStorePassword); + return ks; + } else { + /* + * location of keystore is specified as absolute URL in policy file, or + * is relative to URL of policy file + */ + URL keyStoreUrl = null; + try { + keyStoreUrl = new URL(keyStoreName); + // absolute URL + } catch (MalformedURLException e) { + // relative URL + if (policyUrl == null) { + throw e; + } + keyStoreUrl = new URL(policyUrl, keyStoreName); + } + + if (debug != null) { + debug.println("reading keystore" + keyStoreUrl); + } + + InputStream inStream = null; + try { + inStream = new BufferedInputStream(getInputStream(keyStoreUrl)); + ks.load(inStream, keyStorePassword); + } finally { + inStream.close(); + } + return ks; + } + } finally { + if (keyStorePassword != null) { + Arrays.fill(keyStorePassword, ' '); + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PropertyExpander.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PropertyExpander.java new file mode 100644 index 0000000..644970a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/PropertyExpander.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +import java.net.URI; +import java.net.URISyntaxException; +import java.security.GeneralSecurityException; + +/** + * A utility class to expand properties embedded in a string. Strings of the + * form ${some.property.name} are expanded to be the value of the property. + * Also, the special ${/} property is expanded to be the same as file.separator. + * If a property is not set, a GeneralSecurityException will be thrown. + * + * @author Roland Schemers + */ +public class PropertyExpander { + + public static class ExpandException extends GeneralSecurityException { + + private static final long serialVersionUID = -7941948581406161702L; + + public ExpandException(String msg) { + super(msg); + } + } + + public static String expand(String value) throws ExpandException { + return expand(value, false); + } + + public static String expand(String value, boolean encodeURL) + throws ExpandException { + if (value == null) + return null; + + int p = value.indexOf("${", 0); + + // no special characters + if (p == -1) + return value; + + StringBuffer sb = new StringBuffer(value.length()); + int max = value.length(); + int i = 0; // index of last character we copied + + scanner: while (p < max) { + if (p > i) { + // copy in anything before the special stuff + sb.append(value.substring(i, p)); + i = p; + } + int pe = p + 2; + + // do not expand ${{ ... }} + if (pe < max && value.charAt(pe) == '{') { + pe = value.indexOf("}}", pe); + if (pe == -1 || pe + 2 == max) { + // append remaining chars + sb.append(value.substring(p)); + break scanner; + } else { + // append as normal text + pe++; + sb.append(value.substring(p, pe + 1)); + } + } else { + while ((pe < max) && (value.charAt(pe) != '}')) { + pe++; + } + if (pe == max) { + // no matching '}' found, just add in as normal text + sb.append(value.substring(p, pe)); + break scanner; + } + String prop = value.substring(p + 2, pe); + if (prop.equals("/")) { + sb.append(java.io.File.separatorChar); + } else { + String val = System.getProperty(prop); + if (val != null) { + if (encodeURL) { + // encode 'val' unless it's an absolute URI + // at the beginning of the string buffer + try { + if (sb.length() > 0 || !(new URI(val)).isAbsolute()) { + val = com.sun.ts.lib.util.sec.net.www.ParseUtil + .encodePath(val); + } + } catch (URISyntaxException use) { + val = com.sun.ts.lib.util.sec.net.www.ParseUtil.encodePath(val); + } + } + sb.append(val); + } else { + throw new ExpandException("unable to expand property " + prop); + } + } + } + i = pe + 1; + p = value.indexOf("${", i); + if (p == -1) { + // no more to expand. copy in any extra + if (i < max) { + sb.append(value.substring(i, max)); + } + // break out of loop + break scanner; + } + } + return sb.toString(); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/ResourcesMgr.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/ResourcesMgr.java new file mode 100644 index 0000000..c84a927 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/ResourcesMgr.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2000, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +/** + */ +public class ResourcesMgr { + + // intended for java.security, javax.security and sun.security resources + private static java.util.ResourceBundle bundle; + + // intended for com.sun.security resources + private static java.util.ResourceBundle altBundle; + + public static String getString(String s) { + + if (bundle == null) { + + // only load if/when needed + bundle = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public java.util.ResourceBundle run() { + return (java.util.ResourceBundle + .getBundle("sun.security.util.Resources")); + } + }); + } + + return bundle.getString(s); + } + + public static String getString(String s, final String altBundleName) { + + if (altBundle == null) { + + // only load if/when needed + altBundle = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public java.util.ResourceBundle run() { + return (java.util.ResourceBundle.getBundle(altBundleName)); + } + }); + } + + return altBundle.getString(s); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/SecurityConstants.java b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/SecurityConstants.java new file mode 100644 index 0000000..7bc5472 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/lib/util/sec/security/util/SecurityConstants.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2003, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.lib.util.sec.security.util; + +import java.io.FilePermission; +import java.awt.AWTPermission; +import java.util.PropertyPermission; +import java.lang.RuntimePermission; +import java.net.SocketPermission; +import java.net.NetPermission; +import java.security.SecurityPermission; +import java.security.AllPermission; +import javax.security.auth.AuthPermission; + +/** + * Permission constants and string constants used to create permissions used + * throughout the JDK. + */ +public final class SecurityConstants { + // Cannot create one of these + private SecurityConstants() { + } + + // Commonly used string constants for permission actions used by + // SecurityManager. Declare here for shortcut when checking permissions + // in FilePermission, SocketPermission, and PropertyPermission. + + public static final String FILE_DELETE_ACTION = "delete"; + + public static final String FILE_EXECUTE_ACTION = "execute"; + + public static final String FILE_READ_ACTION = "read"; + + public static final String FILE_WRITE_ACTION = "write"; + + public static final String SOCKET_RESOLVE_ACTION = "resolve"; + + public static final String SOCKET_CONNECT_ACTION = "connect"; + + public static final String SOCKET_LISTEN_ACTION = "listen"; + + public static final String SOCKET_ACCEPT_ACTION = "accept"; + + public static final String SOCKET_CONNECT_ACCEPT_ACTION = "connect,accept"; + + public static final String PROPERTY_RW_ACTION = "read,write"; + + public static final String PROPERTY_READ_ACTION = "read"; + + public static final String PROPERTY_WRITE_ACTION = "write"; + + // Permission constants used in the various checkPermission() calls in JDK. + + // java.lang.Class, java.lang.SecurityManager, java.lang.System, + // java.net.URLConnection, java.security.AllPermission, java.security.Policy, + // sun.security.provider.PolicyFile + public static final AllPermission ALL_PERMISSION = new AllPermission(); + + // java.lang.SecurityManager + public static final AWTPermission TOPLEVEL_WINDOW_PERMISSION = new AWTPermission( + "showWindowWithoutWarningBanner"); + + // java.lang.SecurityManager + public static final AWTPermission ACCESS_CLIPBOARD_PERMISSION = new AWTPermission( + "accessClipboard"); + + // java.lang.SecurityManager + public static final AWTPermission CHECK_AWT_EVENTQUEUE_PERMISSION = new AWTPermission( + "accessEventQueue"); + + // java.awt.Dialog + public static final AWTPermission TOOLKIT_MODALITY_PERMISSION = new AWTPermission( + "toolkitModality"); + + // java.awt.Robot + public static final AWTPermission READ_DISPLAY_PIXELS_PERMISSION = new AWTPermission( + "readDisplayPixels"); + + // java.awt.Robot + public static final AWTPermission CREATE_ROBOT_PERMISSION = new AWTPermission( + "createRobot"); + + // java.awt.MouseInfo + public static final AWTPermission WATCH_MOUSE_PERMISSION = new AWTPermission( + "watchMousePointer"); + + // java.awt.Window + public static final AWTPermission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION = new AWTPermission( + "setWindowAlwaysOnTop"); + + // java.awt.Toolkit + public static final AWTPermission ALL_AWT_EVENTS_PERMISSION = new AWTPermission( + "listenToAllAWTEvents"); + + // java.awt.SystemTray + public static final AWTPermission ACCESS_SYSTEM_TRAY_PERMISSION = new AWTPermission( + "accessSystemTray"); + + // java.net.URL + public static final NetPermission SPECIFY_HANDLER_PERMISSION = new NetPermission( + "specifyStreamHandler"); + + // java.net.ProxySelector + public static final NetPermission SET_PROXYSELECTOR_PERMISSION = new NetPermission( + "setProxySelector"); + + // java.net.ProxySelector + public static final NetPermission GET_PROXYSELECTOR_PERMISSION = new NetPermission( + "getProxySelector"); + + // java.net.CookieHandler + public static final NetPermission SET_COOKIEHANDLER_PERMISSION = new NetPermission( + "setCookieHandler"); + + // java.net.CookieHandler + public static final NetPermission GET_COOKIEHANDLER_PERMISSION = new NetPermission( + "getCookieHandler"); + + // java.net.ResponseCache + public static final NetPermission SET_RESPONSECACHE_PERMISSION = new NetPermission( + "setResponseCache"); + + // java.net.ResponseCache + public static final NetPermission GET_RESPONSECACHE_PERMISSION = new NetPermission( + "getResponseCache"); + + // java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher + public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION = new RuntimePermission( + "createClassLoader"); + + // java.lang.SecurityManager + public static final RuntimePermission CHECK_MEMBER_ACCESS_PERMISSION = new RuntimePermission( + "accessDeclaredMembers"); + + // java.lang.SecurityManager, sun.applet.AppletSecurity + public static final RuntimePermission MODIFY_THREAD_PERMISSION = new RuntimePermission( + "modifyThread"); + + // java.lang.SecurityManager, sun.applet.AppletSecurity + public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION = new RuntimePermission( + "modifyThreadGroup"); + + // java.lang.Class + public static final RuntimePermission GET_PD_PERMISSION = new RuntimePermission( + "getProtectionDomain"); + + // java.lang.Class, java.lang.ClassLoader, java.lang.Thread + public static final RuntimePermission GET_CLASSLOADER_PERMISSION = new RuntimePermission( + "getClassLoader"); + + // java.lang.Thread + public static final RuntimePermission STOP_THREAD_PERMISSION = new RuntimePermission( + "stopThread"); + + // java.lang.Thread + public static final RuntimePermission GET_STACK_TRACE_PERMISSION = new RuntimePermission( + "getStackTrace"); + + // java.security.AccessControlContext + public static final SecurityPermission CREATE_ACC_PERMISSION = new SecurityPermission( + "createAccessControlContext"); + + // java.security.AccessControlContext + public static final SecurityPermission GET_COMBINER_PERMISSION = new SecurityPermission( + "getDomainCombiner"); + + // java.security.Policy, java.security.ProtectionDomain + public static final SecurityPermission GET_POLICY_PERMISSION = new SecurityPermission( + "getPolicy"); + + // java.lang.SecurityManager + public static final SocketPermission LOCAL_LISTEN_PERMISSION = new SocketPermission( + "localhost:1024-", SOCKET_LISTEN_ACTION); + + // javax.security.auth.Subject + public static final AuthPermission DO_AS_PERMISSION = new AuthPermission( + "doAs"); + + // javax.security.auth.Subject + public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION = new AuthPermission( + "doAsPrivileged"); +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/build.xml new file mode 100644 index 0000000..6a2f0b4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/build.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/EmptyVehicleRunner.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/EmptyVehicleRunner.java new file mode 100644 index 0000000..f049512 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/EmptyVehicleRunner.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.tests.common.vehicle; + +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.ServiceEETest; +import com.sun.ts.lib.util.TestUtil; + +public class EmptyVehicleRunner implements VehicleRunnable { + + public Status run(String[] argv, Properties p) { + + ServiceEETest theTestClient; + Status sTestStatus = Status.passed(""); + + // create an instance of the test client and run here + try { + Class c = Class.forName(p.getProperty("test_classname")); + theTestClient = (ServiceEETest) c.newInstance(); + theTestClient.setSharedObject(VehicleClient.getClientSharedObject()); + sTestStatus = theTestClient.run(argv, p); + } catch (ClassNotFoundException cnfe) { + TestUtil.logErr("Failed to create the EETest instance", cnfe); + sTestStatus = Status.failed("Failed to create the EETest instance"); + } catch (InstantiationException ie) { + TestUtil.logErr("Failed to create the EETest instance", ie); + sTestStatus = Status.failed("Failed to create the EETest instance"); + } catch (Exception e) { + TestUtil.logErr("Failed running in a client side vehicle", e); + sTestStatus = Status.failed("Failed running in a client side vehicle"); + } + + return sTestStatus; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleClient.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleClient.java new file mode 100644 index 0000000..f637102 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleClient.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.tests.common.vehicle; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.ServiceEETest; + +/** + * Class used as a client of all vehicle tests. + */ +public class VehicleClient extends ServiceEETest { + String[] sVehicles; + + private static Object theSharedObject = null; + + /* Run test in standalone mode */ + public static void main(String[] args) { + VehicleClient client = new VehicleClient(); + Status s = client.run(args, System.out, System.err); + s.exit(); + } + + /* + * Set shared object + */ + public static void setClientSharedObject(Object o) { + theSharedObject = o; + } + + /* + * Get shared object + */ + public static Object getClientSharedObject() { + return theSharedObject; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnable.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnable.java new file mode 100644 index 0000000..8d71227 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnable.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.tests.common.vehicle; + +import java.util.Properties; + +import com.sun.javatest.Status; + +public interface VehicleRunnable { + public Status run(String[] argv, Properties p); +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnerFactory.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnerFactory.java new file mode 100644 index 0000000..61d8bed --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/VehicleRunnerFactory.java @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.tests.common.vehicle; + +import com.sun.ts.lib.util.TestUtil; + +public final class VehicleRunnerFactory { + private static VehicleRunnable ejbRunner; + + private static VehicleRunnable servletRunner; + + private static VehicleRunnable jspRunner; + + private static VehicleRunnable ejbEmbedRunner; + + private static VehicleRunnable ejbLiteJsfRunner; + + private static VehicleRunnable ejbLiteJspRunner; + + private static VehicleRunnable ejbLiteSecuredJspRunner; + + private static VehicleRunnable emptyRunner; + + private static VehicleRunnable stateless3Runner; + + private static VehicleRunnable stateful3Runner; + + private static VehicleRunnable appmanagedRunner; + + private static VehicleRunnable appmanagedNoTxRunner; + + private static VehicleRunnable wsejbRunner; + + private static VehicleRunnable wsservletRunner; + + private static VehicleRunnable pmservletRunner; + + private static VehicleRunnable puservletRunner; + + private static VehicleRunnable connectorServletRunner; + + private static VehicleRunnable jaspicServletRunner; + + private static VehicleRunnable customVehicleRunner; + + private static VehicleRunnable webRunner; + + private VehicleRunnerFactory() { + } + + private static VehicleRunnable getEJBRunner() { + if (ejbRunner == null) { + try { + Class c = Class + .forName("com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRunner"); + ejbRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return ejbRunner; + } + + private static VehicleRunnable getServletRunner() { + if (servletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.servlet.ServletVehicleRunner"); + servletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return servletRunner; + } + + private static VehicleRunnable getJSPRunner() { + if (jspRunner == null) { + try { + Class c = Class + .forName("com.sun.ts.tests.common.vehicle.jsp.JSPVehicleRunner"); + jspRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return jspRunner; + } + + private static VehicleRunnable getEJBEmbedRunner() { + if (ejbEmbedRunner == null) { + try { + Class c = Class + .forName("com.sun.ts.tests.common.vehicle.ejbembed.EJBEmbedRunner"); + ejbEmbedRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return ejbEmbedRunner; + } + + private static VehicleRunnable getEJBLiteJSFRunner() { + if (ejbLiteJsfRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.ejblitejsf.EJBLiteJSFVehicleRunner"); + ejbLiteJsfRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return ejbLiteJsfRunner; + } + + private static VehicleRunnable getEJBLiteWebRunner() { + if (ejbLiteJspRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.ejbliteshare.EJBLiteWebVehicleRunner"); + ejbLiteJspRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return ejbLiteJspRunner; + } + + private static VehicleRunnable getEJBLiteSecuredWebRunner() { + if (ejbLiteSecuredJspRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.ejbliteshare.EJBLiteSecuredWebVehicleRunner"); + ejbLiteSecuredJspRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return ejbLiteSecuredJspRunner; + } + + private static VehicleRunnable getWebRunner() { + if (webRunner == null) { + try { + Class c = Class + .forName("com.sun.ts.tests.common.vehicle.web.WebVehicleRunner"); + webRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return webRunner; + } + + private static VehicleRunnable getEmptyRunner() { + if (emptyRunner == null) { + try { + Class c = Class + .forName("com.sun.ts.tests.common.vehicle.EmptyVehicleRunner"); + emptyRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return emptyRunner; + } + + private static VehicleRunnable getStateless3Runner() { + if (stateless3Runner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.stateless3.Stateless3VehicleRunner"); + stateless3Runner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return stateless3Runner; + } + + private static VehicleRunnable getStateful3Runner() { + if (stateful3Runner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.stateful3.Stateful3VehicleRunner"); + stateful3Runner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return stateful3Runner; + } + + private static VehicleRunnable getAppManagedRunner() { + if (appmanagedRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.appmanaged.AppManagedVehicleRunner"); + appmanagedRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return appmanagedRunner; + } + + private static VehicleRunnable getAppManagedNoTxRunner() { + if (appmanagedNoTxRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.appmanagedNoTx.AppManagedNoTxVehicleRunner"); + appmanagedNoTxRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return appmanagedNoTxRunner; + } + + private static VehicleRunnable getWSEJBRunner() { + if (wsejbRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.wsejb.WSEJBVehicleRunner"); + wsejbRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return wsejbRunner; + } + + private static VehicleRunnable getWSServletRunner() { + if (wsservletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.wsservlet.WSServletVehicleRunner"); + wsservletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return wsservletRunner; + } + + private static VehicleRunnable getPMServletRunner() { + if (pmservletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.pmservlet.PMServletVehicleRunner"); + pmservletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return pmservletRunner; + } + + private static VehicleRunnable getPUServletRunner() { + if (puservletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.puservlet.PUServletVehicleRunner"); + puservletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return puservletRunner; + } + + private static VehicleRunnable getConnectorServletRunner() { + if (connectorServletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.connectorservlet.ConnectorServletVehicleRunner"); + connectorServletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return connectorServletRunner; + } + + private static VehicleRunnable getJaspicServletRunner() { + if (jaspicServletRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.jaspicservlet.JaspicServletVehicleRunner"); + jaspicServletRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return jaspicServletRunner; + } + + // this supports the rare case of a user defined custome vehicle + private static VehicleRunnable getCustomVehicleRunner() { + if (customVehicleRunner == null) { + try { + Class c = Class.forName( + "com.sun.ts.tests.common.vehicle.customvehicle.CustomVehicleRunner"); + customVehicleRunner = (VehicleRunnable) c.newInstance(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return customVehicleRunner; + } + + // runners are stateless and thus can be cached and reused. + // But we cannot have reference to ejb vehicle directory in + // order to compile this class in any tck's. + public static VehicleRunnable getVehicleRunner(String vtype) { + if (vtype.equalsIgnoreCase("ejb")) { + return getEJBRunner(); + } else if (vtype.equalsIgnoreCase("servlet")) { + return getServletRunner(); + } else if (vtype.equalsIgnoreCase("jsp")) { + return getJSPRunner(); + } else if (vtype.equalsIgnoreCase("web")) { + return getWebRunner(); + } else if (vtype.equalsIgnoreCase("stateless3")) { + return getStateless3Runner(); + } else if (vtype.equalsIgnoreCase("stateful3")) { + return getStateful3Runner(); + } else if (vtype.equalsIgnoreCase("appmanaged")) { + return getAppManagedRunner(); + } else if (vtype.equalsIgnoreCase("appmanagedNoTx")) { + return getAppManagedNoTxRunner(); + } else if (vtype.equalsIgnoreCase("wsejb")) { + return getWSEJBRunner(); + } else if (vtype.equalsIgnoreCase("wsservlet")) { + return getWSServletRunner(); + } else if (vtype.equalsIgnoreCase("pmservlet")) { + return getPMServletRunner(); + } else if (vtype.equalsIgnoreCase("puservlet")) { + return getPUServletRunner(); + } else if (vtype.equalsIgnoreCase("connectorservlet")) { + return getConnectorServletRunner(); + } else if (vtype.equalsIgnoreCase("jaspicservlet")) { + return getJaspicServletRunner(); + } else if (vtype.equalsIgnoreCase("customvehicle")) { + return getCustomVehicleRunner(); + } else if (vtype.equalsIgnoreCase("ejblitejsf")) { + return getEJBLiteJSFRunner(); + } else if (vtype.equalsIgnoreCase("ejbembed")) { + return getEJBEmbedRunner(); + } else if (vtype.equalsIgnoreCase("ejblitejsp") + || vtype.equalsIgnoreCase("ejbliteservlet") + || vtype.equalsIgnoreCase("ejbliteservlet2") + || vtype.equalsIgnoreCase("ejbliteservletcal")) { + return getEJBLiteWebRunner(); + } else if (vtype.equalsIgnoreCase("ejblitesecuredjsp")) { + return getEJBLiteSecuredWebRunner(); + } else { + if (!vtype.equalsIgnoreCase("appclient") + && !vtype.equalsIgnoreCase("wsappclient") + && !vtype.equalsIgnoreCase("standalone")) { + TestUtil + .logMsg("Invalid vehicle " + vtype + ". Will run test directly."); + } + return getEmptyRunner(); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/build.xml new file mode 100644 index 0000000..ab8a489 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/CustomVehicleRunner.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/CustomVehicleRunner.java new file mode 100644 index 0000000..73e18dc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/CustomVehicleRunner.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.common.vehicle.customvehicle; + +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.tests.common.vehicle.VehicleRunnable; + +/** + * This class is to be modified and rebuilt by any vendor needing to build their + * own custom vehicles. This should only be used as allowed on a case by case + * basis and must be explicitly stated as a viable option in the TCK user guide. + * + * This class should be edited, compiled, and packaged as needed for the + * environment it is to be used in. This vehicle will be recognized as the + * "customvehicle" and it will be necessary to make appropriate changes to the + * TS_HOME/src/vehicle.properties file to indicate the use of this vehicle. + * + * It is suggested that you use other vehicles as a model for implementing this. + * Additional information for using this class should be referenced in the TCK + * user guides for those technologies that support the definition and use of a + * custom vehicle. + * + */ +public class CustomVehicleRunner implements VehicleRunnable { + + protected final String sVehicle = "customvehicle"; + + public Status run(String[] argv, Properties p) { + + // XXXX: implement your code to wrap and execute each test here + // such that each test will run in a customvehicle and return + // the result from each test. + + return Status.failed("not implemented yet."); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/build.xml new file mode 100644 index 0000000..b00d662 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/customvehicle/build.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicle.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicle.java new file mode 100644 index 0000000..04c5193 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicle.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.common.vehicle.jaspicservlet; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.rmi.RemoteException; +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.harness.RemoteStatus; +import com.sun.ts.lib.util.TestUtil; + +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +public class JaspicServletVehicle extends HttpServlet { + protected Properties properties = null; + + protected String[] arguments = null; + + protected EETest testObj = null; + + public void init(ServletConfig config) throws ServletException { + TestUtil.logTrace("init " + this.getClass().getName() + " ..."); + super.init(config); + } + + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + try { + // get the inputstream and read any objects passed from the + // client, e.g. properties, args, etc. + // wrap the Inputstream in an ObjectInputstream and read + // the properties and args. + TestUtil.logTrace("JaspicServletVehicle - In doGet"); + + ObjectInputStream objInStream = new ObjectInputStream( + new BufferedInputStream(req.getInputStream())); + System.out.println("JaspicServletVehicle - got InputStream"); + TestUtil.logTrace("JaspicServletVehicle - got InputStream"); + properties = (Properties) objInStream.readObject(); + System.out.println("read properties!!!"); + + // create an instance of the test client and run here + Class c = Class.forName(properties.getProperty("test_classname")); + testObj = (EETest) c.newInstance(); + + // Thread.currentThread().dumpStack(); + arguments = (String[]) objInStream.readObject(); + // arguments = new String[1]; + // arguments[0] = ""; + TestUtil.logTrace("JaspicServletVehicle - read Objects"); + try { + TestUtil.init(properties); + TestUtil.logTrace("Remote logging set for Servlet Vehicle"); + TestUtil.logTrace("JaspicServletVehicle - Here are the props"); + TestUtil.list(properties); + } catch (Exception e) { + throw new ServletException("unable to initialize remote logging"); + } + ObjectOutputStream objOutStream = new ObjectOutputStream( + res.getOutputStream()); + System.out.println("got outputstream"); + // now run the test and return the result + RemoteStatus finalStatus = runTest(); + System.out.println("ran test"); + objOutStream.writeObject(finalStatus); + objOutStream.flush(); + objOutStream.close(); + + } catch (Throwable t) { + System.out.println(t.getMessage()); + TestUtil.logTrace(t.getMessage()); + t.printStackTrace(); + throw new ServletException( + "test failed to run within the Servlet Vehicle"); + } + + } + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + System.out.println("In doPost!"); + TestUtil.logTrace("In doPost"); + doGet(req, res); + } + + protected RemoteStatus runTest() throws RemoteException { + RemoteStatus sTestStatus = new RemoteStatus(Status.passed("")); + + try { + // call EETest impl's run method + sTestStatus = new RemoteStatus(testObj.run(arguments, properties)); + + if (sTestStatus.getType() == Status.PASSED) + TestUtil.logMsg("Test running in servlet vehicle passed"); + else + TestUtil.logMsg("Test running in servlet vehicle failed"); + } catch (Throwable e) { + TestUtil.logErr("Test running in servlet vehicle failed", e); + sTestStatus = new RemoteStatus( + Status.failed("Test running in servlet vehicle failed")); + } + return sTestStatus; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicleRunner.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicleRunner.java new file mode 100644 index 0000000..5d1f57e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicServletVehicleRunner.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.common.vehicle.jaspicservlet; + +import com.sun.javatest.Status; +import com.sun.ts.lib.util.TestUtil; + +/* + * This is the class that is different for each vehicle. + * This should lookup and invoke the vehicle in the container (if there is one). + */ +public class JaspicServletVehicleRunner extends JaspicVehicleRunner { + protected Status run() { + // run in a jaspicservlet + sTestStatus = runWebVehicleTest(sVehicle); + + TestUtil.logMsg("Test: returning from running in a jaspicservlet vehicle"); + + return sTestStatus; + }// run +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicVehicleRunner.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicVehicleRunner.java new file mode 100644 index 0000000..b440653 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/JaspicVehicleRunner.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.common.vehicle.jaspicservlet; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.RemoteStatus; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.common.vehicle.VehicleRunnable; + +public class JaspicVehicleRunner implements VehicleRunnable { + + protected String sVehicle = "jaspicservlet"; + + protected Status sTestStatus = Status.passed(""); + + String urlSuffix = ""; + + Status sServletStatus = Status.passed(""); + + String sVehicleArchiveName = ""; + + String contextRootPrefix; + + String[] argv; + + Properties p; + + public Status run(String[] argv, Properties p) { + this.argv = argv; + this.p = p; + sVehicle = p.getProperty("vehicle"); + + // use this name for the context root or jndi name to eliminate + // naming conflicts for apps deployed at the same time + sVehicleArchiveName = p.getProperty("vehicle_archive_name"); + + if (sVehicleArchiveName.indexOf("_vehicles") != -1) { + contextRootPrefix = sVehicleArchiveName.substring(0, + sVehicleArchiveName.indexOf("_vehicles") + 1) + sVehicle + + "_vehicle_web"; + } else { + if (sVehicleArchiveName.endsWith("_web")) { + contextRootPrefix = sVehicleArchiveName; + } else { + contextRootPrefix = sVehicleArchiveName + "_web"; + } + } + + // default urlSuffix + urlSuffix = "/" + contextRootPrefix + "/" + sVehicle + "_vehicle"; + + return run(); + } // run + + protected Status run() { + // run in a jaspicservlet + urlSuffix = "/" + contextRootPrefix + "/jaspicservlet_vehicle"; + sServletStatus = runWebVehicleTest("jaspicservlet"); + + TestUtil.logMsg("Test: returning from running in jaspicservlet vehicles"); + + if (sServletStatus.isPassed()) { + sTestStatus = Status.passed("Test passed in a jaspicservlet "); + } else { + sTestStatus = Status.failed("Test failed in a jaspicservlet "); + } + return sTestStatus; + } + + protected Status runWebVehicleTest(String vehicle) { + URLConnection connection = null; + URL url = null; + ObjectOutputStream objOut = null; + ObjectInputStream objIn = null; + Status status; + + try { + TSURL ctsURL = new TSURL(); + url = ctsURL.getURL("http", p.getProperty("webServerHost"), + Integer.parseInt(p.getProperty("webServerPort")), urlSuffix); + connection = url.openConnection(); + TestUtil.logMsg("Opened connection to " + url); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(false); + connection.setRequestProperty("Content-Type", + "java-internal/" + p.getClass().getName()); + // connection.connect(); + objOut = new ObjectOutputStream(connection.getOutputStream()); + TestUtil.logTrace("got outputstream"); + objOut.writeObject(p); + objOut.writeObject(argv); + TestUtil.logTrace("wrote objects to the " + vehicle + " vehicle"); + objOut.flush(); + objOut.close(); + objOut = null; + + // read the status when it comes back + objIn = new ObjectInputStream(connection.getInputStream()); + status = ((RemoteStatus) objIn.readObject()).toStatus(); + TestUtil.logMsg("Test status from a " + vehicle + ": " + status.getType() + + ":" + status.getReason()); + + } catch (MalformedURLException e) { + e.printStackTrace(); + status = Status.failed("Fatal: Improper URL"); + } catch (NumberFormatException e) { + e.printStackTrace(); + status = Status.failed( + "Please set an appropriate value for the property: webServerPort"); + } catch (IOException e) { + e.printStackTrace(); + status = Status.failed("Fatal: Problem with connection: " + e); + } catch (Exception e) { + e.printStackTrace(); + status = Status.failed( + "ServiceTest failed inside a " + vehicle + ": " + e.getMessage()); + } finally { + + if (objOut != null) { + try { + objOut.close(); + } catch (Exception e) { + } + } + + if (objIn != null) { + try { + objIn.close(); + } catch (Exception e) { + } + } + } + return status; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/build.xml new file mode 100644 index 0000000..3af7d20 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/build.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/jaspicservlet_vehicle_web.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/jaspicservlet_vehicle_web.xml new file mode 100644 index 0000000..d8646b2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/jaspicservlet/jaspicservlet_vehicle_web.xml @@ -0,0 +1,33 @@ + + + + + jaspicservlet_vehicle + + JaspicServlet_VehicleLogicalName + com.sun.ts.tests.common.vehicle.jaspicservlet.JaspicServletVehicle + + + JaspicServlet_VehicleLogicalName + /jaspicservlet_vehicle + + + 54 + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/standalone/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/standalone/build.xml new file mode 100644 index 0000000..9474336 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/standalone/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/WebVehicleRunner.java b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/WebVehicleRunner.java new file mode 100644 index 0000000..776d419 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/WebVehicleRunner.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/* + * $Id$ + */ + +package com.sun.ts.tests.common.vehicle.web; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.RemoteStatus; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.common.vehicle.VehicleRunnable; + +public class WebVehicleRunner implements VehicleRunnable { + + protected String sVehicle = ""; + + protected Status sTestStatus = Status.passed(""); + + String urlSuffix = ""; + + Status sServletStatus = Status.passed(""); + + Status sJspStatus = Status.passed(""); + + String sVehicleArchiveName = ""; + + String contextRootPrefix; + + String[] argv; + + Properties p; + + public Status run(String[] argv, Properties p) { + this.argv = argv; + this.p = p; + sVehicle = p.getProperty("vehicle"); + + // use this name for the context root or jndi name to eliminate + // naming conflicts for apps deployed at the same time + sVehicleArchiveName = p.getProperty("vehicle_archive_name"); + + if (sVehicleArchiveName.indexOf("_vehicles") != -1) { + contextRootPrefix = sVehicleArchiveName.substring(0, + sVehicleArchiveName.indexOf("_vehicles") + 1) + sVehicle + + "_vehicle_web"; + } else { + if (sVehicleArchiveName.endsWith("_web")) { + contextRootPrefix = sVehicleArchiveName; + } else { + contextRootPrefix = sVehicleArchiveName + "_web"; + } + } + + // default urlSuffix + urlSuffix = "/" + contextRootPrefix + "/" + sVehicle + "_vehicle"; + + return run(); + }// run + + protected Status run() { + if (sVehicle.equalsIgnoreCase("web")) { + // run in a servlet + urlSuffix = "/" + contextRootPrefix + "/servlet_vehicle"; + sServletStatus = runWebVehicleTest("servlet"); + + // run in a Jsp + urlSuffix = "/" + contextRootPrefix + "/jsp_vehicle"; + sJspStatus = runWebVehicleTest("jsp"); + + TestUtil.logMsg("Test: returning from running in web vehicles"); + } + + if (sServletStatus.isPassed() && sJspStatus.isPassed()) { + sTestStatus = Status.passed("Test passed in a servlet and in a jsp"); + } else if (sServletStatus.isFailed() && sServletStatus.isFailed()) { + sTestStatus = Status.failed("Test failed in a servlet and in a jsp"); + } else if (sJspStatus.isFailed()) { + sTestStatus = Status + .failed("Test passed in a jsp but failed in a servlet"); + } else { + sTestStatus = Status + .failed("Test passed in a servlet but failed in a jsp"); + } + return sTestStatus; + } + + protected Status runWebVehicleTest(String vehicle) { + URLConnection connection = null; + URL url = null; + ObjectOutputStream objOut = null; + ObjectInputStream objIn = null; + Status status; + + try { + if (vehicle.indexOf("jsp") != -1) { + urlSuffix += ".jsp"; + } + + TSURL ctsURL = new TSURL(); + url = ctsURL.getURL("http", p.getProperty("webServerHost"), + Integer.parseInt(p.getProperty("webServerPort")), urlSuffix); + connection = url.openConnection(); + TestUtil.logMsg("Opened connection to " + url); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(false); + connection.setRequestProperty("Content-Type", + "java-internal/" + p.getClass().getName()); + // connection.connect(); + objOut = new ObjectOutputStream(connection.getOutputStream()); + TestUtil.logTrace("got outputstream"); + objOut.writeObject(p); + objOut.writeObject(argv); + TestUtil.logTrace("wrote objects to the " + vehicle + " vehicle"); + objOut.flush(); + objOut.close(); + objOut = null; + + // read the status when it comes back + if (vehicle.indexOf("jsp") != -1) { + Properties sprop = TestUtil.getResponseProperties(connection); + int type = Integer.parseInt(sprop.getProperty("type")); + String reason = sprop.getProperty("reason"); + status = new Status(type, reason); + } else { + objIn = new ObjectInputStream(connection.getInputStream()); + status = ((RemoteStatus) objIn.readObject()).toStatus(); + } + TestUtil.logMsg("Test status from a " + vehicle + ": " + status.getType() + + ":" + status.getReason()); + + } catch (MalformedURLException e) { + e.printStackTrace(); + status = Status.failed("Fatal: Improper URL"); + } catch (NumberFormatException e) { + e.printStackTrace(); + status = Status.failed( + "Please set an appropriate value for the property: webServerPort"); + } catch (IOException e) { + e.printStackTrace(); + status = Status.failed("Fatal: Problem with connection: " + e); + } catch (Exception e) { + e.printStackTrace(); + status = Status.failed( + "ServiceTest failed inside a " + vehicle + ": " + e.getMessage()); + } finally { + + if (objOut != null) { + try { + objOut.close(); + } catch (Exception e) { + } + } + + if (objIn != null) { + try { + objIn.close(); + } catch (Exception e) { + } + } + } + return status; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/web_vehicle_web.xml b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/web_vehicle_web.xml new file mode 100644 index 0000000..a72336d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/common/vehicle/web/web_vehicle_web.xml @@ -0,0 +1,39 @@ + + + + + web_vehicle + + Servlet_VehicleLogicalName + com.sun.ts.tests.common.vehicle.servlet.ServletVehicle + + + Servlet_VehicleLogicalName + /servlet_vehicle + + + jsp_vehicle + /jsp_vehicle.jsp + 0 + + + 54 + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/build.xml new file mode 100644 index 0000000..bb2e239 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHello.ear.sun-application.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHello.ear.sun-application.xml new file mode 100644 index 0000000..87fa703 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHello.ear.sun-application.xml @@ -0,0 +1,27 @@ + + + + + + 0 + + Administrator + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloImpl.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloImpl.java new file mode 100644 index 0000000..1323780 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.authexception; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService(name = "AuthExceptionHello", serviceName = "AuthExceptionHelloService") +public class AuthExceptionHelloImpl { + + @WebMethod + public String sayHelloProtected(String param) { + + return "Hello " + param; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService.wsdl b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService.wsdl new file mode 100644 index 0000000..921bc29 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService_schema1.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService_schema1.xsd new file mode 100644 index 0000000..4a33d1c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/AuthExceptionHelloService_schema1.xsd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/Client.java new file mode 100644 index 0000000..e531743 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/Client.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.authexception; + +import java.net.URL; +import java.util.Map; +import java.util.Properties; + +import javax.xml.namespace.QName; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; +import com.sun.ts.tests.jaspic.util.WebServiceUtils; + +import jakarta.security.auth.message.AuthException; +import jakarta.xml.ws.BindingProvider; +import jakarta.xml.ws.WebServiceRef; + +/** + * + * @author Raja Perumal + */ +public class Client extends EETest { + @WebServiceRef(name = "AuthExceptionHelloService") + static AuthExceptionHelloService service; + + private AuthExceptionHello port; + + private Properties props = null; + + private static final String UserNameProp = "user"; + + private static final String UserPasswordProp = "password"; + + private String username = ""; + + private String password = ""; + + private TSURL ctsurl = new TSURL(); + + private String hostname = "localhost"; + + private String logicalHostName = "server"; + + private String PROTOCOL = "http"; + + private String urlString = null; + + private int portnum = 8000; + + private String platformMode = null; + + private LogFileProcessor logProcessor = null; + + // ServiceName and PortName mapping configuration going java-to-wsdl + private static final String SERVICE_NAME = "AuthExceptionHelloService"; + + private static final String PORT_NAME = "AuthExceptionHelloPort"; + + private static final String NAMESPACEURI = "http://authexception.authstatus.spi.jaspic.tests.ts.sun.com/"; + + private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME); + + private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME); + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; webServerHost; webServerPort; user; + * password; logical.hostname.soap; platform.mode; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + try { + username = props.getProperty(UserNameProp); + password = props.getProperty(UserPasswordProp); + hostname = props.getProperty("webServerHost"); + platformMode = props.getProperty("platform.mode"); + logicalHostName = props.getProperty("logical.hostname.soap"); + portnum = Integer.parseInt(props.getProperty("webServerPort")); + urlString = ctsurl.getURLString(PROTOCOL, hostname, portnum, + "/AuthExceptionHello_web/AuthExceptionHello"); + + // create LogProcessor + logProcessor = new LogFileProcessor(props); + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + } catch (Exception e) { + throw new Fault("Setup failed:", e); + } + + TestUtil.logMsg("setup ok"); + } + + /* + * sayHelloProtected + * + * This method is invoked first by all tests, as a result of this client and + * server soap runtime generates corresponding messages in the log and the + * other tests verify those messages. + */ + private void sayHelloProtected() throws AuthException, Exception { + + AuthExceptionHello port = null; + + if (platformMode.equals("jakartaEE")) { + port = (AuthExceptionHello) getJavaEEPort(); + } else { + port = (AuthExceptionHello) getStandAlonePort(); + } + + BindingProvider bindingProvider = (BindingProvider) port; + Map map = bindingProvider.getRequestContext(); + + TestUtil + .logMsg("Setting the target endpoint address on WS port: " + urlString); + map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString); + + TestUtil.logMsg("Invoking sayHelloProtected on Hello port"); + String text = port.sayHelloProtected("Raja"); + TestUtil.logMsg("Got Output : " + text); + } + + /** + * @keywords: jaspic_soap + * + * @testName: AuthStatusAuthException + * + * @assertion_ids: JASPIC:SPEC:138; JASPIC:SPEC:144; JASPIC:SPEC:167; + * JASPIC:JAVADOC:6 + * + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Invoke sayHelloProtected and make sure AuthException is + * received in the client + * + * Description: Throws an AuthException The runtime should use + * the exception to convey to the client runtime that the + * request failed + * + * + */ + public void AuthStatusAuthException() throws Fault { + boolean verified = false; + + try { + sayHelloProtected(); + } catch (AuthException ae) { + TestUtil.logMsg("Got expected Authexception :" + ae.getMessage()); + TestUtil.printStackTrace(ae); + return; + } catch (Exception e) { + TestUtil.logMsg("Got expected exception :" + e.getMessage()); + TestUtil.printStackTrace(e); + return; + } + + // Control shouldn't come here. + throw new Fault("AuthStatusAuthException failed"); + } + + public Object getJavaEEPort() throws Exception { + TestUtil.logMsg("Get AuthException Port from AuthExceptionHelloService"); + Object port = service.getPort(AuthExceptionHello.class); + return port; + } + + public Object getStandAlonePort() throws Exception { + URL wsdlurl = new URL(urlString + "?WSDL"); + return WebServiceUtils.getPort(wsdlurl, SERVICE_QNAME, + AuthExceptionHelloService.class, PORT_QNAME, AuthExceptionHello.class); + } + + public void cleanup() throws Fault { + logMsg("cleanup ok"); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/build.xml new file mode 100644 index 0000000..8eb6d9f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/build.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/jakartaEE.web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/jakartaEE.web.xml new file mode 100644 index 0000000..00fac62 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/authexception/jakartaEE.web.xml @@ -0,0 +1,42 @@ + + + + + soap_app + + AuthExceptionHello + com.sun.ts.tests.jaspic.spi.authstatus.authexception.AuthExceptionHelloImpl + 0 + + ADM + Administrator + + + + AuthExceptionHello + /AuthExceptionHello + + + 54 + + + the administrator role + Administrator + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/build.xml new file mode 100644 index 0000000..e694160 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/Client.java new file mode 100644 index 0000000..95bde1a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/Client.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.failure; + +import java.net.URL; +import java.util.Map; +import java.util.Properties; + +import javax.xml.namespace.QName; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; +import com.sun.ts.tests.jaspic.util.WebServiceUtils; + +import jakarta.xml.ws.BindingProvider; +import jakarta.xml.ws.WebServiceRef; + +/** + * + * @author Raja Perumal + */ +public class Client extends EETest { + @WebServiceRef(name = "service/FailureHelloService") + static FailureHelloService service; + + private FailureHello port; + + private Properties props = null; + + private static final String UserNameProp = "user"; + + private static final String UserPasswordProp = "password"; + + private String username = ""; + + private String password = ""; + + private TSURL ctsurl = new TSURL(); + + private String hostname = "localhost"; + + private String logicalHostName = "server"; + + private String PROTOCOL = "http"; + + private String urlString = null; + + private int portnum = 8000; + + private String platformMode = null; + + private LogFileProcessor logProcessor = null; + + // ServiceName and PortName mapping configuration going java-to-wsdl + private static final String SERVICE_NAME = "FailureHelloService"; + + private static final String PORT_NAME = "FailureHelloPort"; + + private static final String NAMESPACEURI = "http://failure.authstatus.spi.jaspic.tests.ts.sun.com/"; + + private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME); + + private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME); + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; webServerHost; webServerPort; user; + * password; logical.hostname.soap; platform.mode; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + try { + username = props.getProperty(UserNameProp); + password = props.getProperty(UserPasswordProp); + hostname = props.getProperty("webServerHost"); + platformMode = props.getProperty("platform.mode"); + logicalHostName = props.getProperty("logical.hostname.soap"); + portnum = Integer.parseInt(props.getProperty("webServerPort")); + urlString = ctsurl.getURLString(PROTOCOL, hostname, portnum, + "/FailureHello_web/FailureHello"); + + // create LogProcessor + logProcessor = new LogFileProcessor(props); + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + } catch (Exception e) { + throw new Fault("Setup failed:", e); + } + + TestUtil.logMsg("setup ok"); + } + + /* + * sayHelloProtected + * + * During this method invocation, client and server soap runtime generates + * corresponding log messages in the log file. + * + * The log files are later analyzed by each test to verify the correctness of + * SPI contract. + */ + private void sayHelloProtected() throws Fault { + + try { + FailureHello port = null; + + if (platformMode.equals("jakartaEE")) { + port = (FailureHello) getJavaEEPort(); + } else { + port = (FailureHello) getStandAlonePort(); + } + + BindingProvider bindingProvider = (BindingProvider) port; + Map map = bindingProvider.getRequestContext(); + + TestUtil.logMsg( + "Setting the target endpoint address on WS port: " + urlString); + map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString); + + TestUtil.logMsg("Invoking sayHelloProtected on Hello port"); + String text = port.sayHelloProtected("Raja"); + TestUtil.logMsg("Got Output : " + text); + + } catch (Exception e) { + // flow should come here! so eat the exception + TestUtil.logMsg("sayHelloProtected invocation failed - as expected."); + e.printStackTrace(); + return; + } + + // + throw new Fault("Test sayHelloProtected failed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: AuthStatusFailure + * + * @assertion_ids: JASPIC:SPEC:137; JASPIC:SPEC:143; JASPIC:JAVADOC:8 + * + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify SecureResponse() method is not called from + * TSFailureServerAuthModule. + * + * Description: AuthStatus.FAILURE The runtime should return + * an error to the client application. The runtime should + * derive the returned error from the response message + * acquired by calling messageInfo.getResponseMessage. + * + * + */ + public void AuthStatusFailure() throws Fault { + boolean verified = false; + + try { + sayHelloProtected(); + } catch (Exception e) { + // Control shouldn't come here. + TestUtil.logMsg("Got exception :" + e.getMessage()); + TestUtil.printStackTrace(e); + throw new Fault("AuthStatusFailure failed"); + } + + return; + } + + public Object getJavaEEPort() throws Exception { + TestUtil.logMsg("Get FailureHello Port from FailureHelloService"); + Object port = service.getPort(FailureHello.class); + return port; + } + + public Object getStandAlonePort() throws Exception { + URL wsdlurl = new URL(urlString + "?WSDL"); + return WebServiceUtils.getPort(wsdlurl, SERVICE_QNAME, + FailureHelloService.class, PORT_QNAME, FailureHello.class); + } + + public void cleanup() throws Fault { + logMsg("cleanup ok"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHello.ear.sun-application.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHello.ear.sun-application.xml new file mode 100644 index 0000000..87fa703 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHello.ear.sun-application.xml @@ -0,0 +1,27 @@ + + + + + + 0 + + Administrator + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloImpl.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloImpl.java new file mode 100644 index 0000000..28ce213 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.failure; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService(name = "FailureHello", serviceName = "FailureHelloService") +public class FailureHelloImpl { + + @WebMethod + public String sayHelloProtected(String param) { + + return "Hello " + param; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService.wsdl b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService.wsdl new file mode 100644 index 0000000..99a4109 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService_schema1.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService_schema1.xsd new file mode 100644 index 0000000..e8100f4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/FailureHelloService_schema1.xsd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/build.xml new file mode 100644 index 0000000..5f2161d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/build.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/jakartaEE.web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/jakartaEE.web.xml new file mode 100644 index 0000000..bad5a84 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/failure/jakartaEE.web.xml @@ -0,0 +1,42 @@ + + + + + soap_app + + FailureHello + com.sun.ts.tests.jaspic.spi.authstatus.failure.FailureHelloImpl + 0 + + ADM + Administrator + + + + FailureHello + /FailureHello + + + 54 + + + the administrator role + Administrator + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/Client.java new file mode 100644 index 0000000..a576edd --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/Client.java @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.sendfailure; + +import java.net.URL; +import java.util.Map; +import java.util.Properties; + +import javax.xml.namespace.QName; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; +import com.sun.ts.tests.jaspic.util.WebServiceUtils; + +import jakarta.xml.ws.BindingProvider; +import jakarta.xml.ws.WebServiceRef; + +/** + * + * @author Raja Perumal + */ +public class Client extends EETest { + @WebServiceRef(name = "service/SendFailureHelloService") + static SendFailureHelloService service; + + private SendFailureHello port; + + private Properties props = null; + + private static final String UserNameProp = "user"; + + private static final String UserPasswordProp = "password"; + + private String username = ""; + + private String password = ""; + + private TSURL ctsurl = new TSURL(); + + private String hostname = "localhost"; + + private String logicalHostName = "server"; + + private String PROTOCOL = "http"; + + private String urlString = null; + + private int portnum = 8000; + + private String platformMode = null; + + private LogFileProcessor logProcessor = null; + + // ServiceName and PortName mapping configuration going java-to-wsdl + private static final String SERVICE_NAME = "SendFailureHelloService"; + + private static final String PORT_NAME = "SendFailureHelloPort"; + + private static final String NAMESPACEURI = "http://sendfailure.authstatus.spi.jaspic.tests.ts.sun.com/"; + + private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME); + + private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME); + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; webServerHost; webServerPort; user; + * password; logical.hostname.soap; platform.mode; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + try { + username = props.getProperty(UserNameProp); + password = props.getProperty(UserPasswordProp); + hostname = props.getProperty("webServerHost"); + platformMode = props.getProperty("platform.mode"); + logicalHostName = props.getProperty("logical.hostname.soap"); + portnum = Integer.parseInt(props.getProperty("webServerPort")); + urlString = ctsurl.getURLString(PROTOCOL, hostname, portnum, + "/SendFailureHello_web/SendFailureHello"); + + // create LogProcessor + logProcessor = new LogFileProcessor(props); + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + } catch (Exception e) { + throw new Fault("Setup failed:", e); + } + + TestUtil.logMsg("setup ok"); + } + + /* + * sayHelloProtected + * + * This method is invoked first by all tests, as a result of this client and + * server soap runtime generates corresponding messages in the log and the + * other tests verify those messages. + */ + private void sayHelloProtected() throws Fault { + + try { + SendFailureHello port = null; + + if (platformMode.equals("jakartaEE")) { + port = (SendFailureHello) getJavaEEPort(); + } else { + port = (SendFailureHello) getStandAlonePort(); + } + + BindingProvider bindingProvider = (BindingProvider) port; + Map map = bindingProvider.getRequestContext(); + + TestUtil.logMsg( + "Setting the target endpoint address on WS port: " + urlString); + map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString); + + TestUtil.logMsg("Invoking sayHelloProtected on Hello port"); + String text = port.sayHelloProtected("Raja"); + TestUtil.logMsg("Got Output : " + text); + + } catch (Exception e) { + e.printStackTrace(); + throw new Fault("Test sayHelloProtected failed"); + } + } + + /** + * @keywords: jaspic_soap + * + * @testName: AuthStatusSendFailure + * + * @assertion_ids: JASPIC:SPEC:172; JASPIC:SPEC:165; JASPIC:SPEC:166; + * JASPIC:SPEC:57; JASPIC:SPEC:315 + * + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * + * Description: AuthStatus.SEND_FAILURE If the request + * validation failed, and whenthe module has established a + * SOAP message containing a fault element (available to the + * runtime by calling messageInfo.getResponseMessage) that may + * be sent by the runtime to inform the client that the + * request failed. + * + */ + public void AuthStatusSendFailure() throws Fault { + boolean verified = false; + + try { + sayHelloProtected(); + } catch (Exception e) { + TestUtil.logMsg("Got expected exception :" + e.getMessage()); + TestUtil.printStackTrace(e); + return; + } + + // Control shouldn't come here. + throw new Fault("AuthStatusSendFailure failed"); + } + + public Object getJavaEEPort() throws Exception { + TestUtil.logMsg("Get SendFailureHello Port from SendFailureHelloService"); + Object port = service.getPort(SendFailureHello.class); + return port; + } + + public Object getStandAlonePort() throws Exception { + URL wsdlurl = new URL(urlString + "?WSDL"); + return WebServiceUtils.getPort(wsdlurl, SERVICE_QNAME, + SendFailureHelloService.class, PORT_QNAME, SendFailureHello.class); + } + + public void cleanup() throws Fault { + logMsg("cleanup ok"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHello.ear.sun-application.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHello.ear.sun-application.xml new file mode 100644 index 0000000..87fa703 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHello.ear.sun-application.xml @@ -0,0 +1,27 @@ + + + + + + 0 + + Administrator + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloImpl.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloImpl.java new file mode 100644 index 0000000..a57692a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.sendfailure; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService(name = "SendFailureHello", serviceName = "SendFailureHelloService") +public class SendFailureHelloImpl { + + @WebMethod + public String sayHelloProtected(String param) { + + return "Hello " + param; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService.wsdl b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService.wsdl new file mode 100644 index 0000000..c69aa5c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService_schema1.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService_schema1.xsd new file mode 100644 index 0000000..e36c098 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/SendFailureHelloService_schema1.xsd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/build.xml new file mode 100644 index 0000000..803a87a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/build.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/jakartaEE.web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/jakartaEE.web.xml new file mode 100644 index 0000000..2bd2673 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendfailure/jakartaEE.web.xml @@ -0,0 +1,42 @@ + + + + + soap_app + + SendFailureHello + com.sun.ts.tests.jaspic.spi.authstatus.sendfailure.SendFailureHelloImpl + 0 + + ADM + Administrator + + + + SendFailureHello + /SendFailureHello + + + 54 + + + the administrator role + Administrator + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/Client.java new file mode 100644 index 0000000..19b5721 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/Client.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.sendsuccess; + +import java.net.URL; +import java.util.Map; +import java.util.Properties; + +import javax.xml.namespace.QName; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; +import com.sun.ts.tests.jaspic.util.WebServiceUtils; + +import jakarta.xml.ws.BindingProvider; +import jakarta.xml.ws.WebServiceRef; + +/** + * + * @author Raja Perumal + */ +public class Client extends EETest { + @WebServiceRef(name = "service/SendSuccessHelloService") + static SendSuccessHelloService service; + + private SendSuccessHello port; + + private Properties props = null; + + private static final String UserNameProp = "user"; + + private static final String UserPasswordProp = "password"; + + private String username = ""; + + private String password = ""; + + private TSURL ctsurl = new TSURL(); + + private String hostname = "localhost"; + + private String logicalHostName = "server"; + + private String PROTOCOL = "http"; + + private String urlString = null; + + private int portnum = 8000; + + private String platformMode = null; + + private LogFileProcessor logProcessor = null; + + // ServiceName and PortName mapping configuration going java-to-wsdl + private static final String SERVICE_NAME = "SendSuccessHelloService"; + + private static final String PORT_NAME = "SendSuccessHelloPort"; + + private static final String NAMESPACEURI = "http://sendsuccess.authstatus.spi.jaspic.tests.ts.sun.com/"; + + private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME); + + private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME); + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; webServerHost; webServerPort; user; + * password; logical.hostname.soap; platform.mode; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + try { + username = props.getProperty(UserNameProp); + password = props.getProperty(UserPasswordProp); + hostname = props.getProperty("webServerHost"); + platformMode = props.getProperty("platform.mode"); + logicalHostName = props.getProperty("logical.hostname.soap"); + portnum = Integer.parseInt(props.getProperty("webServerPort")); + urlString = ctsurl.getURLString(PROTOCOL, hostname, portnum, + "/SendSuccessHello_web/SendSuccessHello"); + + sayHelloProtected(); + + // create LogProcessor + logProcessor = new LogFileProcessor(props); + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + } catch (Exception e) { + throw new Fault("Setup failed:", e); + } + + TestUtil.logMsg("setup ok"); + } + + /* + * sayHelloProtected + * + * This method is invoked first by all tests, as a result of this client and + * server soap runtime generates corresponding messages in the log and the + * other tests verify those messages. + */ + private void sayHelloProtected() throws Fault { + + try { + SendSuccessHello port = null; + + if (platformMode.equals("jakartaEE")) { + port = (SendSuccessHello) getJavaEEPort(); + } else { + port = (SendSuccessHello) getStandAlonePort(); + } + + BindingProvider bindingProvider = (BindingProvider) port; + Map map = bindingProvider.getRequestContext(); + + TestUtil.logMsg( + "Setting the target endpoint address on WS port: " + urlString); + map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString); + + TestUtil.logMsg("Invoking sayHelloProtected on Hello port"); + String text = port.sayHelloProtected("Raja"); + TestUtil.logMsg("Got Output : " + text); + + } catch (Exception e) { + e.printStackTrace(); + throw new Fault("Test sayHelloProtected failed"); + } + + } + + public Object getJavaEEPort() throws Exception { + TestUtil.logMsg("Get SendSuccessHello Port from SendSuccessHelloService"); + Object port = service.getPort(SendSuccessHello.class); + return port; + } + + public Object getStandAlonePort() throws Exception { + URL wsdlurl = new URL(urlString + "?WSDL"); + return WebServiceUtils.getPort(wsdlurl, SERVICE_QNAME, + SendSuccessHelloService.class, PORT_QNAME, SendSuccessHello.class); + } + + public void cleanup() throws Fault { + logMsg("cleanup ok"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHello.ear.sun-application.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHello.ear.sun-application.xml new file mode 100644 index 0000000..87fa703 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHello.ear.sun-application.xml @@ -0,0 +1,27 @@ + + + + + + 0 + + Administrator + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloImpl.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloImpl.java new file mode 100644 index 0000000..e502211 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.authstatus.sendsuccess; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService(name = "SendSuccessHello", serviceName = "SendSuccessHelloService") +public class SendSuccessHelloImpl { + + @WebMethod + public String sayHelloProtected(String param) { + + return "Hello " + param; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService.wsdl b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService.wsdl new file mode 100644 index 0000000..f8b15db --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService_schema1.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService_schema1.xsd new file mode 100644 index 0000000..3b95230 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/SendSuccessHelloService_schema1.xsd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/build.xml new file mode 100644 index 0000000..6e5c72d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/build.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/jakartaEE.web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/jakartaEE.web.xml new file mode 100644 index 0000000..1de7bb0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/authstatus/sendsuccess/jakartaEE.web.xml @@ -0,0 +1,42 @@ + + + + + soap_app + + SendSuccessHello + com.sun.ts.tests.jaspic.spi.authstatus.sendsuccess.SendSuccessHelloImpl + 0 + + ADM + Administrator + + + + SendSuccessHello + /SendSuccessHello + + + 54 + + + the administrator role + Administrator + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/Client.java new file mode 100644 index 0000000..f6d0db0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/Client.java @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.baseline; + +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.ServiceEETest; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.spi.common.CommonTests; + +/** + * These tests are to be run for the case of no Profile - where there is NO + * Servlet and NO SOAP Profile support. When there is no profile, we call that + * the baseline requirements. Executing these tests assumes the implementation + * of Custom Vehicle Porting Package. By default, the jaspicservlet is used + * (where jaspicserver requires a web server). + * + * Again, these tests only need to be run when there is no profile being tested + * (ie No SOAP and No Servlet Profile being tested) + * + * @author Oracle + */ +public class Client extends ServiceEETest { + + private Properties props = null; + + private String logFileLocation; + + private String providerConfigFilePath; + + private String vendorACFClass; + + private transient CommonTests commonTests; + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; provider.configuration.file; + * vendor.authconfig.factory; webServerHost; webServerPort; user; password; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + + logFileLocation = props.getProperty("log.file.location"); + TestUtil.logMsg("Log file location = " + logFileLocation); + + providerConfigFilePath = props.getProperty("provider.configuration.file"); + TestUtil + .logMsg("TestSuite Provider ConfigFile = " + providerConfigFilePath); + + vendorACFClass = props.getProperty("vendor.authconfig.factory"); + TestUtil.logMsg("Vendor AuthConfigFactory class = " + vendorACFClass); + + commonTests = new CommonTests(); + + TestUtil.logMsg("setup ok"); + } + + /** + * @testName: ACF_getFactory + * + * @assertion_ids: JASPIC:SPEC:329 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. 1st use SetFactory, then test GetFactory to make sure it + * gets set. + * + * + * Description Test getFactory() that if a non-null + * system-wide factory instance is defined at the time of the + * call, for example, with setFactory, it will be returned. + * + */ + public void ACF_getFactory() throws Fault { + try { + commonTests._ACF_getFactory(); + TestUtil.logMsg("ACF_getFactory : PASSED"); + } catch (Exception e) { + throw new Fault("ACF_getFactory : FAILED"); + } + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: ACFSwitchFactorys + * + * @assertion_ids: + * + * + * @test_Strategy: This test does the following: - gets current (CTS) factory + * - sets the vendors ACF thus replacing the CTS ACF - verify + * ACF's were correctly set - reset factory back to the + * original CTS factory + * + * 1. Use the static setFactory method to set an ACF and this + * should always work. and use the getFactory to verify it + * worked. + * + * Description + * + */ + public void ACFSwitchFactorys() throws Fault { + try { + commonTests._ACFSwitchFactorys(vendorACFClass); + TestUtil.logMsg("ACFSwitchFactorys : PASSED"); + } catch (Exception e) { + throw new Fault("ACFSwitchFactorys : FAILED"); + } + } + + /** + * @testName: testACFComesFromSecFile + * + * @assertion_ids: JASPIC:SPEC:330 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. use getFactory and very the name of the JASPIC ACF class + * and if it matches our known ACF class, that means the + * runtime must have picked it up from the security property. + * + * Description test getFactory() that the fully qualified + * class name of the default factory impl class is obtained + * from the value of the authconfigprovider.factory security + * property. + * + */ + public void testACFComesFromSecFile() throws Fault { + + try { + commonTests._testACFComesFromSecFile(); + TestUtil.logMsg("testACFComesFromSecFile : PASSED"); + } catch (Exception e) { + throw new Fault("testACFComesFromSecFile : FAILED"); + } + } + + /** + * @testName: ACFPersistentRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:331; JASPIC:SPEC:332; + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. test the vendors ACF to verify that we can register our + * providers within their ACF AND that only one registration + * may exist within their ACF for a given msg layer and + * appContext combnation. + * + * Description registerConfigProvider(class, props, layer, + * appContext, description): At most one registration may + * exist within the factory for a given combination of message + * layer and appContext. Any pre-existing registration with + * identical values for layer and appContext is replaced by a + * subsequent registration. (this is for persisitent + * registration) + */ + public void ACFPersistentRegisterOnlyOneACP() throws Fault { + + try { + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFilePath, vendorACFClass, true); + TestUtil.logMsg("ACFPersistentRegisterOnlyOneACP : PASSED"); + } catch (Exception e) { + throw new Fault("ACFPersistentRegisterOnlyOneACP : FAILED"); + } + } + + /** + * @testName: ACFInMemoryRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:331; JASPIC:SPEC:332; + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. test the vendors ACF to verify that we can register our + * providers within their ACF AND that only one registration + * may exist within their ACF for a given msg layer and + * appContext combnation. + * + * Description registerConfigProvider(ACP, layer, appContext, + * description): At most one registration may exist within the + * factory for a given combination of message layer and + * appContext. Any pre-existing registration with identical + * values for layer and appContext is replaced by a subsequent + * registration. (this is for in-memory registration) + */ + public void ACFInMemoryRegisterOnlyOneACP() throws Fault { + + try { + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFilePath, vendorACFClass, false); + TestUtil.logMsg("ACFInMemoryRegisterOnlyOneACP : PASSED"); + } catch (Exception e) { + throw new Fault("ACFInMemoryRegisterOnlyOneACP : FAILED"); + } + } + + /** + * @testName: ACFUnregisterACP + * + * @assertion_ids: JASPIC:SPEC:334; JASPIC:SPEC:335; JASPIC:SPEC:344; + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. test the vendors ACF to verify that we can register our + * providers within their ACF AND then unregister it. + * + * Description registerConfigProvider(ACP, layer, appContext, + * description): At most one registration may exist within the + * factory for a given combination of message layer and + * appContext. After registering a non-persistent ACP, we want + * to validate the unregistering of that ACP. + * + */ + public void ACFUnregisterACP() throws Fault { + + try { + commonTests._ACFUnregisterACP(logFileLocation, providerConfigFilePath, + vendorACFClass); + TestUtil.logMsg("ACFUnregisterACP : PASSED"); + } catch (Exception e) { + throw new Fault("ACFUnregisterACP : FAILED"); + } + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: ACFRemoveRegistrationWithBadId + * + * @assertion_ids: JASPIC:SPEC:345; + * + * + * @test_Strategy: This test verifies we get a return value of False when + * invoking ACF.removeRegistration(some_bad_id); + * + * 1. Use the static setFactory method to get an ACF and then + * attempt to invoke removeRegistration() with an invalid (ie + * non-existant) regId. This should return False (per + * javadoc). + * + * Description + * + */ + public void ACFRemoveRegistrationWithBadId() throws Fault { + + try { + commonTests._ACFRemoveRegistrationWithBadId(); + TestUtil.logMsg("ACFRemoveRegistrationWithBadId : PASSED"); + } catch (Exception e) { + throw new Fault("ACFRemoveRegistrationWithBadId : FAILED"); + } + } + + public void cleanup() throws Fault { + TestUtil.logMsg("cleanup ok"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/build.xml new file mode 100644 index 0000000..c619fcb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/build.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/servlet_vehicle_web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/servlet_vehicle_web.xml new file mode 100644 index 0000000..74f0a76 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/servlet_vehicle_web.xml @@ -0,0 +1,34 @@ + + + + + servlet_vehicle + + Servlet_VehicleLogicalName + com.sun.ts.tests.common.vehicle.servlet.ServletVehicle + + + Servlet_VehicleLogicalName + /servlet_vehicle + + + 54 + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/spitests_baseline_servlet_vehicle_web.war.sun-web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/spitests_baseline_servlet_vehicle_web.war.sun-web.xml new file mode 100644 index 0000000..0062260 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/baseline/spitests_baseline_servlet_vehicle_web.war.sun-web.xml @@ -0,0 +1,35 @@ + + + + + + + Administrator + j2ee + + + Manager + javajoe + + + Employee + javajoe + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/build.xml new file mode 100644 index 0000000..b85e931 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonTests.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonTests.java new file mode 100644 index 0000000..c2a1a9d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonTests.java @@ -0,0 +1,1572 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.common; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Random; + +import com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactoryForStandalone; +import com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderStandalone; +import com.sun.ts.tests.jaspic.tssv.config.TSRegistrationListener; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; + +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.RegistrationListener; + +/** + * This contains generic methods/tests which are expected to be used by tests in + * each of the supported profiles (eg SERVLET, SOAP, Standalone, etc) + * + * @author Oracle + */ +public class CommonTests { + private static final String ACPClass = "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderStandalone"; + + private static final String ACPLayer = "STANDALONE_LAYER"; + + private static final String ACPAppContext = "STANDALONE_CONTEXT"; + + private static final String ACPDesc = "Some description"; + + private PrintWriter out; + + public CommonTests() { + + } + + public CommonTests(PrintWriter out) { + this.out = out; + } + + public void setOut(PrintWriter out) { + this.out = out; + } + + public PrintWriter getOut() { + return this.out; + } + + /* + * this tests the following: - get current ACF - verify that + * removeRegistration(arg) will return FALSE when invalid arg supplied. + */ + public void _ACF_testFactoryRemoveRegistration() throws Exception { + try { + // get current AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + if (acf == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + printIt("FAILURE - Could not get current AuthConfigFactory."); + throw new Exception("_ACF_testFactoryRemoveRegistration : FAILED"); + } + + // based on javadoc, calling removeRegistration with invalid registration + // must return false. It must NOT return true nor throw exception. + boolean rval = acf + .removeRegistration("SomePhakeRegistrationThatWontExist"); + + if (rval == true) { + printIt( + "FAILED: calling removeRegistration() on invalid registration returned true."); + throw new Exception("_ACF_testFactoryRemoveRegistration : FAILED"); + } + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + printIt( + "FAILED: calling removeRegistration() with invalid registration threw exception."); + throw ex; + } + + printIt("_ACF_testFactoryRemoveRegistration : passed"); + } + + /* + * this tests the following: - get current ACF - verify that + * getRegistrationIDs(acp) NEVER returns null hint: must return empty array + * even if unrecognized acp. + */ + public void _ACF_testFactoryGetRegistrationIDs() throws Exception { + try { + // get current AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + if (acf == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + printIt("FAILURE - Could not get current AuthConfigFactory."); + throw new Exception("_ACF_testFactoryGetRegistrationIDs : FAILED"); + } + + String[] ids = acf.getRegistrationIDs(null); + + if (ids == null) { + printIt("FAILED: calling getRegistrationIDs(null) returned null."); + throw new Exception("_ACF_testFactoryGetRegistrationIDs : FAILED"); + } + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + printIt("FAILED: calling getRegistrationIDs(null) threw exception."); + throw ex; + } + + printIt("_ACF_testFactoryGetRegistrationIDs : passed"); + } + + /* + * this tests the following: - get current ACF - verify + * getRegistrationContext(string) returns NULL for unrecognized string. + */ + public void _ACF_testFactoryGetRegistrationContext() throws Exception { + try { + // get current AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + if (acf == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + printIt("FAILURE - Could not get current AuthConfigFactory."); + throw new Exception("_ACF_testFactoryGetRegistrationContext : FAILED"); + } + + AuthConfigFactory.RegistrationContext rcontext = acf + .getRegistrationContext("SomePhakeRegistrationThatWontExist"); + + if (rcontext != null) { + printIt( + "FAILED: calling getRegistrationContext() on invalid context returned non-null."); + throw new Exception("_ACF_testFactoryGetRegistrationContext : FAILED"); + } + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + printIt( + "FAILED: calling getRegistrationContext() with invalid registration threw exception."); + throw ex; + } + + printIt("_ACF_testFactoryGetRegistrationContext : passed"); + } + + /* + * this tests the following: - get vendors ACF - verify detachListener() + * returns non-NULL for listener that is not found tied to ACP with the passed + * in layer & appContext. unrecognized string. + */ + public void _ACF_testFactoryDetachListener(String vendorsClassName) + throws Exception { + + try { + // change ACF to use vendors ACF instead of CTS ACF + printIt("getting Auth Config Factory for: " + vendorsClassName); + AuthConfigFactory vendorsAcf = CommonUtils + .getAuthConfigFactory(vendorsClassName); + AuthConfigFactory.setFactory(vendorsAcf); + String vendorACFClass = vendorsAcf.getClass().getName(); + printIt("vendorACFClass = " + vendorACFClass); + + MyRegistrationListener listener = new MyRegistrationListener("phakeLayer", + "phakeAppContext"); + String[] listeners = vendorsAcf.detachListener(listener, "phakeLayer", + "phakeAppContext"); + + if (listener == null) { + printIt("FAILED: coult not instantiate valid MyRegistrationListener."); + throw new Exception("_ACF_testFactoryDetachListener : FAILED"); + } + + if (listeners == null) { + // should NOT get here since we expect non-null returned...it may be + // empty + // but should never be null + printIt( + "FAILED: calling detachListener() on unfound listener returned null."); + throw new Exception("_ACF_testFactoryDetachListener : FAILED"); + } + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + msg += " Also, ensure caller has permission to detach the listener from the factory"; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + printIt( + "FAILED: calling detachListener() with unfound listener threw exception."); + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("_ACF_testFactoryDetachListener : passed"); + } + + /* + * this tests the following: - get current (CTS default) ACF - switch ACF to + * use differetn (CTS) ACF - verify newly set ACF is correctly recognized (via + * getFactory() calls) - rest ACF back to (CTS default)default + */ + public void _ACF_getFactory() throws Exception { + + try { + // get current AuthConfigFactory + AuthConfigFactory currentAcf = AuthConfigFactory.getFactory(); + if (currentAcf == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + printIt("FAILURE - Could not get current AuthConfigFactory."); + throw new Exception("ACF_getFactory : FAILED"); + } + String currentACFClass = currentAcf.getClass().getName(); + printIt("ACF_getFactory.currentACFClass = " + currentACFClass); + + // set our ACF to a new/different AuthConfigFactory + TSAuthConfigFactoryForStandalone newAcf = new TSAuthConfigFactoryForStandalone(); + AuthConfigFactory.setFactory(newAcf); + String newACFClass = newAcf.getClass().getName(); + printIt("ACF_getFactory.newACFClass = " + newACFClass); + + // verify our calls to getFactory() are getting the newly set factory + // instance and not the original ACF instance + AuthConfigFactory testAcf = AuthConfigFactory.getFactory(); + if (testAcf == null) { + printIt("FAILURE - Could not get newly set AuthConfigFactory."); + throw new Exception("ACF_getFactory : FAILED"); + } + String newlySetACFClass = testAcf.getClass().getName(); + printIt("ACF_getFactory.newlySetACFClass = " + newlySetACFClass); + + // Verify ACF's were set correctly + if (!newlySetACFClass.equals(newACFClass)) { + printIt("FAILURE - our current ACF does not match our newly set ACF"); + throw new Exception("ACF_getFactory : FAILED"); + } else { + String msg = "success - newlySetACFClass == newACFClass == " + + newACFClass; + printIt(msg); + } + + // restore original factory class + AuthConfigFactory.setFactory(currentAcf); + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("ACF_getFactory : passed"); + } + + /* + * This is more comprehensive than ACF_getFactory as this tests the following: + * - get current (CTS default) ACF - verify we are starting with correct + * default - switch ACF to use different (CTS) ACF - verify newly set ACF is + * correctly recognized by checking a few different things (ACF factory + * classname, etc... - rest ACF back to (CTS default)default + */ + public void _ACFSwitchFactorys(String vendorsClassName) throws Exception { + + try { + // get current (CTS) AuthConfigFactory + AuthConfigFactory ctsACF = AuthConfigFactory.getFactory(); + if (ctsACF == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + printIt("FAILURE - Could not get current AuthConfigFactory."); + throw new Exception("ACFSwitchFactorys : FAILED"); + } + + // verify we are starting with CTS ACF as the default ACF + String startingACFClass = ctsACF.getClass().getName(); + printIt("startingACFClass = " + startingACFClass); + if (!JASPICData.TSSV_ACF.equals(startingACFClass)) { + printIt( + "ERROR: we are not starting with expected default ACF class of: " + + JASPICData.TSSV_ACF); + throw new Exception("ACFSwitchFactorys : FAILED"); + } + + // change ACF to use vendors ACF instead of CTS ACF + printIt("getting Auth Config for: " + vendorsClassName); + AuthConfigFactory vendorsAcf = CommonUtils + .getAuthConfigFactory(vendorsClassName); + AuthConfigFactory.setFactory(vendorsAcf); + String vendorACFClass = vendorsAcf.getClass().getName(); + printIt("vendorACFClass = " + vendorACFClass); + + // first verify we were able to change our ACF to use vendors + if (vendorACFClass.equals(JASPICData.TSSV_ACF)) { + // ohoh - nothing was changed we still have CTS default ACF + String str = "FAILURE - Could not set vendors AuthConfigFactory."; + printIt(str); + throw new Exception("ACFSwitchFactorys : FAILED"); + } + + // next - verify our calls to getFactory() are getting a non-null factory + AuthConfigFactory testAcf = AuthConfigFactory.getFactory(); + if (testAcf == null) { + String str = "FAILURE - Could not get vendors AuthConfigFactory."; + printIt(str); + throw new Exception("ACFSwitchFactorys : FAILED"); + } else { + String str = "Successfully set vendors ACF."; + printIt(str); + } + + String newlySetACFClass = testAcf.getClass().getName(); // should be + // confirming + // Impls ACF + printIt("newlySetACFClass = " + newlySetACFClass); + + // next - verify getFactory() returns the expected/correct vendor class + // name + if (!newlySetACFClass.equals(vendorACFClass)) { + String str = "FAILURE - calling getFactory(). "; + str += "did not return expected/vendor ACF classname of: " + + vendorACFClass; + printIt(str); + throw new Exception("ACFSwitchFactorys : FAILED"); + } else { + String msg = "newlySetACFClass == vendorACFClass == " + vendorACFClass; + printIt(msg); + } + + printIt("ACFSwitchFactorys : PASSED"); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: ensure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + // unknown exception + String msg = "got unknown exception: " + ex.getMessage(); + printIt(msg); + ex.printStackTrace(); + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("ACFSwitchFactorys : passed"); + } + + /* + * this tests that the ACF we currently expect is set to our CTS default ACF. + * The only way this should be, is if the runtime correctly read the ACF from + * the security files property of: authconfigprovider.factory + */ + public void _testACFComesFromSecFile() throws Exception { + + // verify our call to getFactory() gets the default ACF instance + AuthConfigFactory testAcf = AuthConfigFactory.getFactory(); + if (testAcf == null) { + printIt("FAILURE - Could not get AuthConfigFactory."); + throw new Exception("testACFComesFromSecFile : FAILED"); + } + String defaultACFClass = testAcf.getClass().getName(); + printIt("testACFComesFromSecFile.defaultACFClass = " + defaultACFClass); + + // Verify ACF matches the ACF that *should* exist in security prop file + if (!defaultACFClass.equals(JASPICData.TSSV_ACF)) { + printIt("FAILURE - our default ACF does not match our default ACF"); + throw new Exception("testACFComesFromSecFile : FAILED"); + } + + printIt("testACFComesFromSecFile passed"); + } + + /* + * This is verifying that the invocation of removeRegistration() with an + * invalid and non-existant regId will return false. This assists with testing + * assertion JASPIC:SPEC:345 + */ + public void _ACFRemoveRegistrationWithBadId() { + + try { + Random rand = new Random(); + + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + // create a unique registration Id + String uniqueRegId = "someMadeUpandNonExistantRegId"; + uniqueRegId += String.valueOf(new Integer(rand.nextInt()).toString()); + boolean bval = acf.removeRegistration(uniqueRegId); + if (bval == true) { + printIt("FAILURE - acf.removeRegistration(invalidId) returned true"); + } + } catch (Exception ex) { + String str = "FAILURE - acf.removeRegistration(invalidId) exception msg: "; + str += ex.getMessage(); + printIt(str); + ex.printStackTrace(); + } + + printIt("ACFRemoveRegistrationWithBadId passed"); + } + + /* + * private convenience method to check the description of the ACF's + * registrationContext. + */ + private boolean verifyDescriptionSetOK(AuthConfigFactory acf, String regID, + String desc) { + boolean bval = false; + try { + AuthConfigFactory.RegistrationContext acfReg; + acfReg = acf.getRegistrationContext(regID); + if ((acfReg != null) && (desc.equals(acfReg.getDescription()))) { + bval = true; + } + } catch (Exception ex) { + } + return bval; + } + + /* + * This is one of our more comprehensive tests and it touches on several + * aspects of registration. + * + * This is used to test that we can register a provider using the two + * different ACF registerProvider() calls. (one call does persistent + * registration such that the registration will persist between jvm recycles + * but the other is an in-memory registration that will not persist between + * jvm recycles. The passed in arg: usePersistRegistration determines which + * registration method we are testing. + * + * This test does the following: - get current (CTS default) ACF - + * persistently register the CTS ACP's within *vendors* ACF - register a CTS + * provider (based on passed in arg of usePersistRegistration) in vendors ACF + * - JASPIC:SPEC:341 or JASPIC:SPEC:342 - verify our ACP registered okay - + * re-register the same ACP - verify re-registering ACP did NOT add another + * regId AND that the newly register ACP re-used same regID AND that the + * description also got replaced - per assertions of: JASPIC:SPEC:340 and + * JASPIC:SPEC:343 - unregister our CTS provider - restore CTS default ACF + * + */ + public void _ACFRegisterOnlyOneACP(String logFileLocation, + String providerConfigFilePath, String vendorACFClass, + boolean usePersistRegistration) throws Exception { + + // (persistently) register providers in vendor factory + printIt("CommonTests._ACFRegisterOnlyOneACP(): logFileLocation = " + + logFileLocation); + printIt("CommonTests._ACFRegisterOnlyOneACP(): providerConfigFilePath = " + + providerConfigFilePath); + printIt("CommonTests._ACFRegisterOnlyOneACP(): vendorACFClass = " + + vendorACFClass); + + AuthConfigFactory vendorACF = CommonUtils.register(logFileLocation, + providerConfigFilePath, vendorACFClass); + try { + if (vendorACF == null) { + throw new Exception("Failed trying to register ACPs with vendors ACF"); + } + + // this is to ensure we do NOT have a previously registered standalone + // provider + // which could be due to a previously incomplete or faulty run. Also due + // to RI bug + // we have to add the provider, then remove it to ensure its not there. + // String clearId = CommonUtils.getRegisteredProviderID(ACPLayer, + // ACPAppContext, null); + String clearId = vendorACF.registerConfigProvider(ACPClass, null, + ACPLayer, ACPAppContext, ACPDesc); + vendorACF.removeRegistration(clearId); + + // get the list of vendor registered provider ID's + String[] origRegIDs = vendorACF.getRegistrationIDs(null); + int defaultLength = origRegIDs.length; + + // dump registered provider info - befor we try to add another ACP + printIt( + "Dumping providers which should only contain those in ProviderConfiguration.xml"); + CommonUtils.dumpProviders(vendorACF, origRegIDs); + + // try to register a standalone provider for the 1st time + String regID1 = null; + if (usePersistRegistration) { + // use persistent reigstration - JASPIC:SPEC:341 + regID1 = vendorACF.registerConfigProvider(ACPClass, null, ACPLayer, + ACPAppContext, ACPDesc); + } else { + // use in-memory (ie non-persistent) registration - JASPIC:SPEC:342 + regID1 = vendorACF.registerConfigProvider(null, ACPLayer, ACPAppContext, + ACPDesc); + } + + String[] firstRegIDs = vendorACF.getRegistrationIDs(null); + // now dump registered provider info - after adding 1 more ACP + printIt( + "Dumping providers which should show a newly added standalone provider."); + CommonUtils.dumpProviders(vendorACF, firstRegIDs); + + // verify that our 1st attempt at adding the an ACP did register ok + if ((regID1 == null) || (firstRegIDs.length <= defaultLength)) { + printIt("regID1 = " + regID1); + printIt("firstRegIDs.length = " + firstRegIDs.length + + " defaultLength = " + defaultLength); + String err = "Could not register provider in vendors ACF class."; + err += " Problematic provider = " + ACPClass; + throw new Exception(err); + } else { + printIt("a new entry was registered"); + } + + // try to re-register the same standalone provider + // note: we have different description - which is okay + // this tests JASPIC:SPEC:340 / JASPIC:SPEC:343 + String changedDesc = "some other description"; + String regID2 = null; + if (usePersistRegistration) { + // use persistent registration + regID2 = vendorACF.registerConfigProvider(ACPClass, null, ACPLayer, + ACPAppContext, changedDesc); + } else { + // use in-memory (ie non-persistent) registration + regID2 = vendorACF.registerConfigProvider(null, ACPLayer, ACPAppContext, + changedDesc); + } + + String[] secondRegIDs = vendorACF.getRegistrationIDs(null); + // now dump registered provider info - after re-adding the same ACP + String msg = "Dumping providers which should show the standalone "; + msg += "provider with slighly different description."; + printIt(msg); + CommonUtils.dumpProviders(vendorACF, secondRegIDs); + + // verify that our 2nd attempt at adding the same ACP correctly replaced + // the + // same provider (based on appcontext and msg layer) and did NOT add + // another entry + if ((regID2 == null) || (firstRegIDs.length != secondRegIDs.length)) { + String err = "Failure during re-registering of ACP."; + err += " Attempts to re-register should replace the provider not add more copies of it."; + err += " Problematic provider = " + ACPClass; + throw new Exception(err); + } else { + printIt("the re-registered provider was replaced."); + } + + // per assertion JASPIC:SPEC:340/JASPIC:SPEC:343 - regID1 and regID2 MUST + // be the same after a re-registering + // of same ACP based on javadoc reference for registerConfigProvider + if (!regID1.equals(regID2)) { + printIt("regID1 = " + regID1 + " regID2 = " + regID2); + String err = "Failure during re-registering of ACP - regID was invalid."; + err += " During a re-registration, the registration ID must be the same"; + throw new Exception(err); + } + + // verify our re-registered provider did replace the ACP and the + // Description + // (per assertion JASPIC:SPEC:340 / JASPIC:SPEC:343) + if (!verifyDescriptionSetOK(vendorACF, regID2, changedDesc)) { + String err = "Failure during verification of ACP re-registration related "; + err += "to description overwrite"; + throw new Exception(err); + } + + // unregister our standalone provider - + vendorACF.removeRegistration(regID2); + + String[] finalRegIDs = vendorACF.getRegistrationIDs(null); + // now dump registered provider info - after re-adding the same ACP + printIt( + "Dumping providers which should show only providers from ProviderConfiguration.xml."); + CommonUtils.dumpProviders(vendorACF, finalRegIDs); + + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("AuthConfigFactory ACFRegisterOnlyOneACP passed"); + } + + /* + * this tests the ability to unregister a provider. First, it must register a + * provider, then once registered, the ability to unregister is then tested. + */ + public void _ACFUnregisterACP(String logFileLocation, + String providerConfigFilePath, String vendorACFClass) throws Exception { + try { + // register providers in vendor factory + AuthConfigFactory vendorACF = CommonUtils.register(logFileLocation, + providerConfigFilePath, vendorACFClass); + if (vendorACF == null) { + throw new Exception("Failed trying to register ACPs with vendors ACF"); + } + + // get list of vendors registered provider ID's + String[] origRegIDs = vendorACF.getRegistrationIDs(null); + + // dump registered provider info - befor we try to register a provider + printIt("Dumping providers from ProviderConfiguration.xml."); + CommonUtils.dumpProviders(vendorACF, origRegIDs); + + // try to register a standalone provider for the 1st time + String regID1 = vendorACF.registerConfigProvider(null, ACPLayer, + ACPAppContext, ACPDesc); + + String[] firstRegIDs = vendorACF.getRegistrationIDs(null); + // now dump registered provider info - after registering a provider + printIt("Dumping providers to show that a provider was added."); + CommonUtils.dumpProviders(vendorACF, firstRegIDs); + + // verify that our 1st attempt at adding the an ACP did register ok + if ((regID1 == null) || (firstRegIDs.length <= origRegIDs.length)) { + printIt("regID1 = " + regID1); + printIt("firstRegIDs.length = " + firstRegIDs.length + + " origRegIDs.length = " + origRegIDs.length); + String err = "Error registering provider in vendors ACF class."; + err += " Problematic provider = " + ACPClass; + throw new Exception(err); + } else { + printIt("a new entry was registered"); + } + + // now unregister our standalone provider + boolean wasFound = vendorACF.removeRegistration(regID1); + + String[] finalRegIDs = vendorACF.getRegistrationIDs(null); + // now dump provider info - after unregistering provider + printIt( + "Dumping providers to only show providers in ProviderConfiguration.xml."); + CommonUtils.dumpProviders(vendorACF, finalRegIDs); + + // verify removeRegistration returned proper boolean + if (!wasFound) { + String err = "ERROR: removeRegistration could not find the regID to remove."; + throw new Exception(err); + } else { + printIt("removeRegistration found the regID to remove"); + } + + // verify registry has proper number of items in it + if (finalRegIDs.length >= firstRegIDs.length) { + String err = "ERROR: removeRegistration had issue removing registry entry."; + throw new Exception(err); + } + + // verify we can't access our regId anymore since it should be + // unregistered + if (true == vendorACF.removeRegistration(regID1)) { + String err = "ERROR: removeRegistration still thinks regID is valid but it should not be"; + throw new Exception(err); + } + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("AuthConfigFactory ACFRegisterOnlyOneACP passed"); + } + + /* + * basic registration test to verify we can register the CTS providers within + * the vendors ACF. (registration is persistent rgistration) + */ + public void _AuthConfigFactoryRegistration(String logFileLocation, + String providerConfigFilePath, String vendorACFClass) throws Exception { + + try { + // get default ACF being used + AuthConfigFactory defaultACF = AuthConfigFactory.getFactory(); + String defaultACFClass = defaultACF.getClass().getName(); + printIt("ACFUnregisterACP.defaultACFClass = " + defaultACFClass); + + // register providers in vendor factory + AuthConfigFactory vendorACF = CommonUtils.register(logFileLocation, + providerConfigFilePath, vendorACFClass); + + if (vendorACF == null) { + throw new Exception("Failed trying to register ACPs with vendors ACF"); + } + + printIt("vendorACFClass = " + vendorACFClass); + + // first verify we were able to change our ACF to use vendors + if (vendorACFClass.equals(JASPICData.TSSV_ACF)) { + // ohoh - nothing was changed we still have CTS default ACF + String str = "FAILURE - Could not set vendors AuthConfigFactory."; + printIt(str); + throw new Exception("AuthConfigFactoryRegistration : FAILED"); + } + + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + + printIt("AuthConfigFactoryRegistration passed"); + } + + /* + * This will test the ability to get the config provider when there are combos + * of null layers or app contexts. This should return the provider for the + * specified app context and null layer. This will also verify the ability to + * register provider a provider that has non-null appcontext and null layer + * with a listener. Then a verification that the notification works okay is + * done. + * + * Precedence rules are as follows: 1 - The provider specifically registered + * for the values passed as the layer and appContext arguments shall be + * selected. 2 - If no provider is selected according to the preceding rule, + * the provider specifically registered for the value passed as the appContext + * argument and for all (that is, null) layers shall be selected. 3 - If no + * provider is selected according to the preceding rules, the provider + * specifically registered for the value passed as the layer argument and for + * all (that is, null) appContexts shall be selected. 4 - If no provider is + * selected according to the preceding rules, the provider registered for all + * (that is, null) layers and for all (that is, null) appContexts shall be + * selected. 5 - If no provider is selected according to the preceding rules, + * the factory shall terminate its search for a registered provider. + * + */ + public void _ACFTestPrecedenceRules(String vendorACFClass, + boolean isPersistent) throws Exception { + + String layer[] = { null, "phakeMsgLayer1" }; + String context[] = { null, "ctxt1" }; + AuthConfigFactory acf = null; + String regId = null; + String[] regIds = new String[layer.length * context.length]; + + try { + if (vendorACFClass != null) { + acf = CommonUtils.getAuthConfigFactory(vendorACFClass); + } else { + // error - we need valid vendor acf + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + /* + * loop thru and create/register a new acp for each of the + * msglayer/appcontext combinations. Verify that the call to + * getConfigProvider() returns appropriate vals - even for case of null + * msg layer or null appcontext. + */ + int count = 0; + for (int ii = 0; ii < layer.length; ii++) { + for (int jj = 0; jj < context.length; jj++) { + String desc = null; + if (isPersistent) { + // do persistent registration + desc = "acp1"; + regId = acf.registerConfigProvider(ACPClass, null, layer[ii], + context[jj], "acp1"); + } else { + // do in-memory registration + desc = "acp1"; + TSAuthConfigProviderStandalone acp1; + acp1 = new TSAuthConfigProviderStandalone((Map) null, null, null, + "acp1"); + regId = acf.registerConfigProvider(acp1, layer[ii], context[jj], + "acp1"); + } + String outStr = "regId=" + regId + " for layer=" + layer[ii] + " " + + " ctxt=" + context[jj]; + printIt(outStr); + + // test precedence rule 1 + boolean okay = testPrecedenceRule1(acf, regId, layer[ii], context[jj], + desc); + if (!okay) { + printIt("Failed getConfiProvider() precedence rule 1."); + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + regIds[count] = regId; + count++; + } + } + + // test precedence rule 2 + // This is when only specifying appContext and null layer + // which should return all matching appContexts + boolean okay = testPrecedenceRule2(acf, isPersistent); + if (!okay) { + printIt("Failed getConfiProvider() precedence rule 2."); + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + // test precedence rule 3 + // This is when only specifying msgLayer and null appContext + // which should return the provider registered with that msgLayer + okay = testPrecedenceRule3(acf, isPersistent); + if (!okay) { + printIt("Failed getConfiProvider() precedence rule 3."); + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + // test precedence rule 4 + // This is when we are trying to retrieve a registered acp + // that does not have matching context or layer - in which case + // acp registered with null layer and null context should be + // returned - if there was an acp registered with null/null) + okay = testPrecedenceRule4(acf, isPersistent); + if (!okay) { + printIt("Failed getConfiProvider() precedence rule 4."); + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + // cleanup ACPs that we registered in this method + okay = removeRegisteredACPs(acf, regIds); + if (!okay) { + // we expect to get warning about unregistering ACPs here + printIt( + "Okay to ignore previous WARNING from call to removeRegisteredACPs"); + } + + // test precedence rule 5 + // This is when we are trying to call getCOnfigProvider() + // with non-registered layer/context values. + // This verifies that no providers could be found and + // so factory must terminate its search for registerd acp. + okay = testPrecedenceRule5(acf, isPersistent); + if (!okay) { + printIt("Failed getConfiProvider() precedence rule 5."); + throw new Exception("ACFTestPrecedenceRules : FAILED"); + } + + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + printIt("ACFTestPrecedenceRules passed"); + } + + /* + * test is verifying we can get the correct provider back with the specifying + * of a non-existing msg layuer and context + */ + private boolean testPrecedenceRule5(AuthConfigFactory acf, + boolean isPersistent) throws Exception { + boolean rval = true; + String MSG_LAYER = "phakeMsgLayer5"; // non-existant msg layer + String APP_CTXT = "phakeContext5"; // non-existant context + + AuthConfigProvider gottenAcp = acf.getConfigProvider(MSG_LAYER, APP_CTXT, + null); + if (gottenAcp != null) { + printIt("Error - precedence rule 5 failure"); + String str = ((TSAuthConfigProviderStandalone) gottenAcp) + .getDescription(); + printIt("ERROR - precedence rule 5 returned acp desc = " + str); + rval = false; + } + + return rval; + } + + /* + * This will register two ACP's using same class but differ layer and + * contexts. One acp with have null/null and the other acp will have non-null + * layer/context. This then verifies it gets the correct ACP back (based on + * description). + */ + private boolean testPrecedenceRule4(AuthConfigFactory acf, + boolean isPersistent) throws Exception { + boolean rval = true; + TSAuthConfigProviderStandalone acp4, acp4b; + acp4 = new TSAuthConfigProviderStandalone((Map) null, null, null, "acp4"); + acp4b = new TSAuthConfigProviderStandalone((Map) null, null, null, "acp4b"); + String layer = null; + String context = null; + String layer2 = "layer4"; + String context2 = "context 4"; + String rId1 = null, rId2 = null; + Map props; + String strDesc1 = "acp4"; + String strDesc2 = "acp4b"; + + if (isPersistent) { + // do persistent registration + props = setDescriptionProp(strDesc1); + rId1 = acf.registerConfigProvider(ACPClass, props, layer, context, + strDesc1); + props = setDescriptionProp(strDesc2); + rId2 = acf.registerConfigProvider(ACPClass, props, layer2, context2, + strDesc2); + } else { + // do in-memory registration + rId1 = acf.registerConfigProvider(acp4, layer, context, strDesc1); + rId2 = acf.registerConfigProvider(acp4b, layer2, context2, strDesc2); + } + + AuthConfigProvider gottenAcp = acf.getConfigProvider(layer, context, null); + if (gottenAcp == null) { + printIt("Error - precedence rule 4 failure"); + return false; + } + + // make sure we get back provider registerd with null/null + AuthConfigFactory.RegistrationContext rc = acf.getRegistrationContext(rId1); + String str = rc.getDescription(); + String str2 = ((TSAuthConfigProviderStandalone) gottenAcp).getDescription(); + boolean bMatch = (str != null) && (str.equals(strDesc1)) && (str2 != null) + && (str2.equals(strDesc1)); + if (!bMatch) { + String err = "ERROR - precedence rule 4 returned wrong acp"; + err += " rc.getDescription() = " + str + "gottenAcp.desc=" + str2; + printIt(err); + rval = false; + } + + // also - test calling with invalid layer/context gets the provider + // that was registered with null layer and null context + // This should return provider registered with null/null + AuthConfigProvider gottenAcp2 = acf.getConfigProvider("nonExistantLayer", + "nonExistantContext", null); + if (gottenAcp2 == null) { + printIt("Error - precedence rule 4b failure"); + rval = false; + } + + // since gottenAcp2 should have returned the provider that was + // registered with null/null which should have desc = strDesc1 + if (gottenAcp2 != null) { + str = ((TSAuthConfigProviderStandalone) gottenAcp2).getDescription(); + } else { + String err = "ERROR - unexpected null ACP encountered. (gottenAcp2 == null)"; + printIt(err); + rval = false; + } + + // call to getRegContext should return desc that corresponds + // to the acp we registered with rId2 + rc = acf.getRegistrationContext(rId2); + str2 = rc.getDescription(); // should match strDesc2 + + bMatch = (str2 != null) && (str2.equals(strDesc2)) && (str != null) + && (str.equals(strDesc1)); + if (!bMatch) { + String err = "ERROR - precedence rule 4 (2nd check) returned wrong acp"; + err += " rc.getDescription() = " + str2 + "gottenAcp2.description=" + + str; + printIt(err); + rval = false; + } + + // do some cleanup + acf.removeRegistration(rId1); + acf.removeRegistration(rId2); + + return rval; + } + + /* + * test is verifying we can get the correct provider back with the specifying + * of the unique msg layer and null/no appContext. + */ + private boolean testPrecedenceRule3(AuthConfigFactory acf, + boolean isPersistent) throws Exception { + boolean rval = true; + TSAuthConfigProviderStandalone acp3, acp3a; + String MSG_LAYER = "phakeMsgLayer1"; // unique msg layer + String APP_CTXT = "context3"; + String rId = null; + String rId2 = null; + Map props; + String strDesc1 = "acp3"; + String strDesc2 = "acp3a"; + + acp3 = new TSAuthConfigProviderStandalone((Map) null, null, null, strDesc1); + acp3a = new TSAuthConfigProviderStandalone((Map) null, null, null, + strDesc2); + + if (isPersistent) { + // do persistent registration + props = setDescriptionProp(strDesc1); + rId = acf.registerConfigProvider(ACPClass, props, MSG_LAYER, null, + strDesc1); + props = setDescriptionProp(strDesc2); + rId2 = acf.registerConfigProvider(ACPClass, props, MSG_LAYER, APP_CTXT, + strDesc2); + } else { + // do in-memory registration + rId = acf.registerConfigProvider(acp3, MSG_LAYER, null, strDesc1); + rId2 = acf.registerConfigProvider(acp3a, MSG_LAYER, APP_CTXT, strDesc2); + } + + // we should get back acp registered with matching layer and null appcontext + AuthConfigProvider gottenAcp = acf.getConfigProvider(MSG_LAYER, null, null); + if (gottenAcp == null) { + printIt("Error - precedence rule 3 failure"); + return false; + } + + // make sure we didnt accidentally get back wrong provider + // we should get back acp with description = strDesc1 + AuthConfigFactory.RegistrationContext rc = acf.getRegistrationContext(rId); + String str = rc.getDescription(); + String str2 = ((TSAuthConfigProviderStandalone) gottenAcp).getDescription(); + boolean bMatch = (str != null) && (str.equals(strDesc1)) && (str2 != null) + && (str2.equals(strDesc1)); + if (!bMatch) { + printIt("ERROR - precedence rule 3 returned wrong acp"); + rval = false; + } + + // do some cleanup + acf.removeRegistration(rId); + acf.removeRegistration(rId2); + + return rval; + } + + /* + * This verifies we can get the correct provider back with the specifying of + * the unique appContext and null/no msglayer. + */ + private boolean testPrecedenceRule2(AuthConfigFactory acf, + boolean isPersistent) throws Exception { + boolean rval = true; + TSAuthConfigProviderStandalone acp2, acp2a; + String rId = null; + String rId2 = null; + Map props; + String strDesc1 = "acp2"; + String strDesc2 = "acp2a"; + + acp2 = new TSAuthConfigProviderStandalone((Map) null, null, null, strDesc1); + acp2a = new TSAuthConfigProviderStandalone((Map) null, null, null, + strDesc2); + + if (isPersistent) { + // do persistent registration + props = setDescriptionProp(strDesc1); + rId = acf.registerConfigProvider(ACPClass, props, null, "ctxt2", + strDesc1); + props = setDescriptionProp(strDesc2); + rId2 = acf.registerConfigProvider(ACPClass, props, "nonexistLayer", + "ctxt2", strDesc2); + } else { + // do in-memory registration + rId = acf.registerConfigProvider(acp2, null, "ctxt2", strDesc1); + rId2 = acf.registerConfigProvider(acp2a, "nonexistLayer", "ctxt2", + strDesc2); + } + + AuthConfigProvider gottenAcp = acf.getConfigProvider(null, "ctxt2", null); + if (gottenAcp == null) { + printIt("Error - precedence rule 2 failure"); + return false; + } + + // make sure we didnt accidentally get back wrong provider (where strDesc1 + // is description for correct acp and anything else is wrong acp + AuthConfigFactory.RegistrationContext rc = acf.getRegistrationContext(rId); + String str = rc.getDescription(); + String str2 = ((TSAuthConfigProviderStandalone) gottenAcp).getDescription(); + boolean bMatch = (str != null) && (str.equals(strDesc1)) && (str2 != null) + && (str2.equals(strDesc1)); + if (!bMatch) { + String err = "ERROR - precedence rule 2 returned wrong acp "; + err += " rc.getDescription()= " + str; + err += " gottenAcp.getDescription()=" + str2; + printIt(err); + rval = false; + } + + // do some cleanup + acf.removeRegistration(rId); + acf.removeRegistration(rId2); + + return rval; + } + + private boolean testPrecedenceRule1(AuthConfigFactory acf, String regId, + String layer, String context, String desc) throws Exception { + boolean rval = true; + + AuthConfigProvider gottenAcp; + gottenAcp = acf.getConfigProvider(layer, context, null); + if (gottenAcp == null) { + printIt("Error - no ACP found in call to getConfigProvider() with layer=" + + layer + "and context=" + context); + rval = false; + } else { + AuthConfigFactory.RegistrationContext rc; + rc = acf.getRegistrationContext(regId); + String str = rc.getDescription(); + boolean bMatch = (str != null) && (str.equals(desc)); + if (!bMatch) { + printIt("ERROR getConfigProvider() returned wrong acp=" + str); + rval = false; + } + + // next, confirm the getConfigProvider() above returned a valid + // regId that matches current layer & context info + boolean ok = verifyGetConfigProvider(acf, gottenAcp, regId, layer, + context); + if (!ok) { + printIt("ERROR no registration found for regIds=" + regId); + rval = false; + } + } + + return rval; + } + + /* + * This is a convenience method that sets a property which can be used by the + * TSAuthConfigProviderStandalone class which looks for this property during + * instantiation by a persistent registration. Said differently, we use this + * property to set the description when we are creating a new/persistent ACP + * registration. + */ + private Map setDescriptionProp(String val) { + HashMap props = new HashMap<>(); + props.put(TSAuthConfigProviderStandalone.DESC_KEY, val); + return props; + } + + /* + * This is used to verify the RegistrationContext value for isPersistent() + * matches what we expect to be set. + * + */ + public boolean verifyRegContextPersitentVal(AuthConfigFactory acf, + String regId, boolean expectedPersistent) throws Exception { + boolean rval = false; + + AuthConfigFactory.RegistrationContext rc; + rc = acf.getRegistrationContext(regId); + + if (rc == null) { + // error - cant find context for regId but should be able to + printIt( + "ERROR could not get RegistrationContext in verifyRegContextPersitentVal"); + return false; + } + + if (rc.isPersistent() == expectedPersistent) { + rval = true; + } + + return rval; + } + + /* + * This is used to verify that the passed in regId contains the expected msg + * layer and appcontext values. It also verifies that the passed in regId + * corresponds with the passed in acp. + */ + public boolean verifyGetConfigProvider(AuthConfigFactory acf, + AuthConfigProvider acp, String regId, String expectedLayer, + String expectedContext) throws Exception { + boolean rval = true; + boolean bLayer = false; + boolean bContext = false; + + AuthConfigFactory.RegistrationContext rc; + rc = acf.getRegistrationContext(regId); + + if (rc == null) { + // error - cant find context for regId but should be able to + printIt( + "ERROR could not get RegistrationContext in verifyGetConfigProvider"); + return false; + } + + if (((expectedLayer != null) && expectedLayer.equals(rc.getMessageLayer())) + || ((expectedLayer == null) && (rc.getMessageLayer() == null))) { + bLayer = true; + } + + if (((expectedContext != null) + && expectedContext.equals(rc.getAppContext())) + || ((expectedContext == null) && (rc.getAppContext() == null))) { + bContext = true; + } + + // make sure our regId is registered for our acp + String[] regIds = acf.getRegistrationIDs(acp); + boolean regIdMatch = false; + for (int ii = 0; ii < regIds.length; ii++) { + if ((regId != null) && (regId.equals(regIds[ii]))) { + regIdMatch = true; + } + } + + if (bLayer && bContext && regIdMatch) { + rval = true; + } + + return rval; + } + + /* + * This will test the ability to notify listeners for acps that are registered + * with a combo of profile layers and app contexts. This assists with testing: + * JASPIC:SPEC:336, JASPIC:SPEC:338, JASPIC:SPEC:339, JASPIC:SPEC:344, + * JASPIC:SPEC:337 + */ + public void _ACFTestNotifyOnUnReg(String vendorACFClass, boolean isPersistent) + throws Exception { + + String profileLayer[] = { null, "HttpServlet", "phakeProfile" }; + String context[] = { null, "ctxt2", "ctxt3" }; + AuthConfigFactory acf = null; + + try { + if (vendorACFClass != null) { + acf = CommonUtils.getAuthConfigFactory(vendorACFClass); + } else { + // error - we need valid vendor acf + throw new Exception("ACFTestNotifyOnUnReg : FAILED"); + } + + // create/register new providers for each layer-context combination + String[] regIds = createAndRegisterACPs(acf, isPersistent, profileLayer, + context); + + // add listeners for each layer-context combo to ACPs - JASPIC:SPEC:337 + TSRegistrationListener tlistener[] = addListenersToACP(acf, profileLayer, + context); + + // at this point, our listeners likely have not have been called, + // but to be sure - lets reset our listeners 'notified' flag + for (int ii = 0; ii < tlistener.length; ii++) { + tlistener[ii].resetNotifyFlag(); + } + + // assert JASPIC:SPEC:344 + // remove registered ACPs using the passed in list of regIds. This + // must generate notifications to listeners associated with those ACPs + boolean ok = removeRegisteredACPs(acf, regIds); + if (!ok) { + // one of registered ids could not be found and/or unregistered + throw new Exception("ACFTestNotifyOnUnReg : FAILED"); + } + + // verify notifications occurred during unregistration JASPIC:SPEC:338 + ok = verifyNotifications(acf, tlistener, profileLayer, context); + if (!ok) { + throw new Exception("ACFTestNotifyOnUnReg : FAILED"); + } + + // do some cleanup and verify if it went okay + ok = detachAllListeners(acf, tlistener, profileLayer, context); + if (!ok) { + // got error during detach + throw new Exception("ACFTestNotifyOnUnReg : FAILED"); + } + + } catch (Exception ex) { + throw ex; + } finally { + // restore original (CTS) factory class + CommonUtils.resetDefaultACF(); + } + printIt("ACFTestNotifyOnUnReg passed"); + } + + /* + * This verifies notifications for the combinations of passed in layer and + * contexts. returns false if an error is encountered. + */ + public boolean verifyNotifications(AuthConfigFactory acf, + TSRegistrationListener[] tlistener, String[] layer, String[] context) + throws Exception { + boolean bval = true; + + // verify notifications occurred during unregistration + for (int kk = 0; kk < tlistener.length; kk++) { + for (int ii = 0; ii < layer.length; ii++) { + for (int jj = 0; jj < context.length; jj++) { + boolean bPassed = false; + bPassed = tlistener[kk].check(layer[ii], context[jj]); + String str = "layer=" + layer[ii] + " and context=" + context[jj]; + if (!bPassed) { + printIt(" Failed listener for: " + str); + bval = false; + } + } + } + } + + return bval; + } + + /* + * This detaches all listeners and also checks that the call to detachListenre + * never returns null. used in testing assert JASPIC:SPEC:339 returns false if + * an error is encountered. + */ + public boolean detachAllListeners(AuthConfigFactory acf, + TSRegistrationListener[] tlistener, String[] layer, String[] context) + throws Exception { + boolean bval = true; + + for (int kk = 0; kk < tlistener.length; kk++) { + for (int ii = 0; ii < layer.length; ii++) { + for (int jj = 0; jj < context.length; jj++) { + // now, detach listeners + String rval[] = acf.detachListener(tlistener[kk], layer[ii], + context[jj]); + if (rval == null) { + // should NEVER be null (per api doc) + String str = "layer=" + layer[ii] + " and context=" + context[jj]; + printIt("Failed detachListener for: " + str); + bval = false; + } + } + } + } + + return bval; + } + + /* + * This takes the passed in list or ACP regIds and unregisteres those ACp's + * from the passed in ACF. This returns false if a registration is deemed + * invalid and cant be removed. + */ + public boolean removeRegisteredACPs(AuthConfigFactory acf, String[] regIds) + throws Exception { + + boolean bval = true; + + // remove registrations with listeners - should call notify on listeners + for (int ii = 0; ii < regIds.length; ii++) { + printIt(" REMOVING PROVIDERS TO INVOKE NOTIFY() for regId=" + regIds[ii]); + boolean result = false; + + result = acf.removeRegistration(regIds[ii]); + if (!result) { + printIt("WARNING: no registration found for regIds=" + regIds[ii]); + bval = false; + } + } + + return bval; + } + + /* + * This method will create new listeners for the passed in layer/context + * combinations. After creating each listener, it is added to the ACP that + * matches the context/layer for that new listener. This returns an array or + * newly created listeners that were added to ACP's. + */ + public TSRegistrationListener[] addListenersToACP(AuthConfigFactory acf, + String[] layer, String[] context) throws Exception { + + int theSize = layer.length * context.length; // num listeners + TSRegistrationListener[] tlistener = new TSRegistrationListener[theSize]; + AuthConfigProvider tmpAcp[] = new AuthConfigProvider[theSize]; + + // Create listeners, then add them to ACPs + int count = 0; + for (int ii = 0; ii < layer.length; ii++) { + for (int jj = 0; jj < context.length; jj++) { + tlistener[count] = new TSRegistrationListener(layer[ii], context[jj]); + tmpAcp[ii] = acf.getConfigProvider(layer[ii], context[jj], + tlistener[count]); + if (tmpAcp[ii] == null) { + printIt(" no ACP found in call to getConfigProvider() with layer=" + + layer[ii] + "and context=" + context[jj]); + } + count++; + } + } + + return tlistener; + } + + /* + * This method creates and register a new ACP for each combination of the + * passed in layer and contexts. So if there are 3 layers and 3 contexts + * passed into this method, there will be 3 * 3 = 9 different ACPs registered + * in the passed in ACF. use the passed in "isPersistent" flag to specify if + * we want our registeration to be persistent or in-memory only type of + * registration. + */ + public String[] createAndRegisterACPs(AuthConfigFactory acf, + boolean isPersistent, String[] layer, String[] context) throws Exception { + + TSAuthConfigProviderStandalone acp; + String[] regIds = new String[layer.length * context.length]; + + try { + // register new acp's + int count = 0; + for (int ii = 0; ii < layer.length; ii++) { + for (int jj = 0; jj < context.length; jj++) { + String desc = ACPDesc + " layer=" + ii + " " + " ctxt=" + jj; + if (isPersistent) { + // do persistent registration + regIds[count] = acf.registerConfigProvider(ACPClass, null, + layer[ii], context[jj], desc); + } else { + // do in-memory registration + acp = new TSAuthConfigProviderStandalone((Map) null, null); + regIds[count] = acf.registerConfigProvider(acp, layer[ii], + context[jj], desc); + } + + // JASPIC:SPEC:336 + boolean bb = verifyRegContextPersitentVal(acf, regIds[count], + isPersistent); + if (!bb) { + // failure - our reg context did not have setting that matches the + // type of registration we used + String ss = new String( + "ERROR - RegistrationContext.isPersistent() mismatch"); + printIt(ss); + throw new Exception(ss); + } + + String str = "regId=" + regIds[count] + " for layer=" + ii + " " + + " ctxt=" + jj; + printIt(str); + count++; + } + } + + } catch (Exception ex) { + printIt("Got Exception in createAndRegisterACPs()"); + throw ex; + } + + return regIds; + } + + public void printIt(String str) { + if (out == null) { + System.out.println(str); + } else { + // lets print them both so we get info in server.log and client side log + out.println(str); + System.out.println(str); + } + } + + // -------------------------------------------------------------------- + // Nested Class: MyRegistrationListener + // + public class MyRegistrationListener implements RegistrationListener { + String theProfileLayer = null; + + String appContext = null; + + boolean notified = false; + + public MyRegistrationListener() { + } + + public MyRegistrationListener(String theProfileLayer, String appContext) { + this.theProfileLayer = theProfileLayer; + this.appContext = appContext; + } + + public String getProfileLayer() { + return this.theProfileLayer; + } + + public void setProfileLayer(String val) { + this.theProfileLayer = val; + } + + public String getAppContext() { + return this.appContext; + } + + public void setAppContext(String val) { + this.appContext = val; + } + + public void resetNotifyFlag() { + notified = false; + } + + public boolean notified() { + return notified; + } + + public boolean check(String layer, String context) { + return true; + } + + @Override + public void notify(String layer, String context) { + boolean bLayersMatch = (theProfileLayer == layer) + || theProfileLayer.equals(layer); + boolean bContextsMatch = (appContext == context) + || appContext.equals(context); + + if (bLayersMatch && bContextsMatch) { + // successful notification + } else { + // error - notify had problem + } + } + } // end Nested Class MyRegistrationListener + +} // end Outer Class CommonTests diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonUtils.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonUtils.java new file mode 100644 index 0000000..7305bb0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/CommonUtils.java @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.common; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationEntry; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationXMLFileProcessor; + +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.RegistrationListener; + +/** + * + * @author Oracle + */ +public class CommonUtils implements Serializable { + + public CommonUtils() { + + } + + public static AuthConfigFactory register(String logFileLocation, + String providerConfigurationFileLocation, + String vendorAuthConfigFactoryClass) { + + AuthConfigFactory acf = null; + try { + + printVerticalIndent(); + + // Get an instance of Vendor's AuthConfigFactory + AuthConfigFactory vFactory = getAuthConfigFactory( + vendorAuthConfigFactoryClass); + + // Set vendor's AuthConfigFactory + AuthConfigFactory.setFactory(vFactory); + + // Get system default AuthConfigFactory + acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + printIt("Default AuthConfigFactory class name = " + + acf.getClass().getName()); + } else { + printError("Default AuthConfigFactory is null" + + " can't register TestSuite Providers with null"); + return null; + } + + /** + * Read the ProviderConfiguration XML file This file contains the list of + * providers that needs to be loaded by the vendor's default + * AuthConfigFactory + */ + Collection providerConfigurationEntriesCollection = readProviderConfigurationXMLFile( + providerConfigurationFileLocation); + + ProviderConfigurationEntry pce = null; + + printVerticalIndent(); + Iterator iterator = providerConfigurationEntriesCollection + .iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with vendor's default AuthConfigFactory + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + printIt("pce.getProviderClassName() = " + pce.getProviderClassName()); + printIt("pce.getMessageLayer() = " + pce.getMessageLayer()); + printIt("pce.getApplicationContextId() = " + + pce.getApplicationContextId()); + printIt("pce.getRegistrationDescription() = " + + pce.getRegistrationDescription()); + if (pce.getProperties() != null) { + printIt("pce.getProperties.toString() = " + + pce.getProperties().toString()); + } else { + printIt("pce.getProperties() = null"); + } + + printIt( + "Registering Provider " + pce.getProviderClassName() + " ..."); + Map newProps = getCleanACPProps(pce.getProperties()); + acf.registerConfigProvider(pce.getProviderClassName(), newProps, + pce.getMessageLayer(), pce.getApplicationContextId(), + pce.getRegistrationDescription()); + printIt("Registration Successful"); + } else { + printIt("WARNING: pce was null and probably should not have been."); + } + } + printVerticalIndent(); + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + printIt(msg); + ex.printStackTrace(); + + } catch (Exception e) { + printIt("Error Registering TestSuite AuthConfig Providers"); + e.printStackTrace(); + } + + return acf; + } + + private static Map getCleanACPProps(Map origProps) { + + if (origProps == null) { + return null; + } + + HashMap props = new HashMap<>(); + + // loop thru passed in props and remove anything that is + // not of type String since only Strings are allowed in our + // calls to registerConfigProvider() + for(String key : origProps.keySet()) { + if (key != null) { + Object val = origProps.get(key); + if ((val != null) && ((val instanceof java.lang.String))) { + // we found entry that is not String so remove it + props.put(key, (String) val); + printIt("added key=" + key + " with value = " + val); + } else { + printIt("found non-string value for key=" + key); + } + } + } + + return props; + } + + /** + * This method instantiates and ruturns a AuthConfigFactory based on the + * specified className + */ + public static AuthConfigFactory getAuthConfigFactory(String className) { + + AuthConfigFactory vFactory = null; + + if (className != null) { + try { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + Class clazz = Class.forName(className, true, loader); + vFactory = (AuthConfigFactory) clazz.newInstance(); + printIt("Instantiated Vendor's AuthConfigFactory"); + } catch (Exception e) { + printIt("Error instantiating vendor's " + "AuthConfigFactory class :" + + className); + e.printStackTrace(); + } + } + + return vFactory; + } + + /** + * This method resets the default ACF. + * + */ + public static void resetDefaultACF() throws Exception { + try { + printIt("resetting ACF back to CTS default: " + JASPICData.TSSV_ACF); + AuthConfigFactory origAcf = getAuthConfigFactory(JASPICData.TSSV_ACF); + AuthConfigFactory.setFactory(origAcf); + } catch (Exception ex) { + printIt( + "Exception while trying to restore original factory class in ACFSwitchFactorys"); + throw ex; + } + } + + /* + * Read the provider configuration XML file and registers each provider with + * Vendor's default AuthConfigFactory + */ + public static Collection readProviderConfigurationXMLFile( + String acpCfgFile) { + Collection providerConfigurationEntriesCollection = null; + + printIt("Reading TestSuite Providers from :" + acpCfgFile); + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + ProviderConfigurationXMLFileProcessor configFileProcessor = new ProviderConfigurationXMLFileProcessor( + acpCfgFile); + + // Retrieve the ProviderConfigurationEntries collection + providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + printIt("TestSuite Providers read successfully " + + "from ProviderConfiguration.xml file"); + + return providerConfigurationEntriesCollection; + + } catch (Exception e) { + printIt("Error loading Providers"); + e.printStackTrace(); + } + return null; + + } + + public static void printVerticalIndent() { + printIt("**********************************************************"); + printIt("\n"); + } + + public static void dumpProviders(AuthConfigFactory acf, String[] regIDs) { + + printIt("****************************************************************"); + printIt("******* Dumping AuthConfigFactory registered providers *******"); + for (int ii = 0; ii < regIDs.length; ii++) { + if (regIDs[ii] != null) { + printIt("registrationID[" + ii + "] = " + regIDs[ii]); + AuthConfigFactory.RegistrationContext rc = acf + .getRegistrationContext(regIDs[ii]); + printIt("AppContext = " + rc.getAppContext()); + printIt("Message layer = " + rc.getMessageLayer()); + printIt("Description = " + rc.getDescription()); + printIt("isPersistent = " + rc.isPersistent()); + } + } + printIt("****************************************************************"); + printIt(" "); + } + + public static String getRegisteredProviderID(String msgLayer, + String appContext, RegistrationListener rl) { + String regID = null; + + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + AuthConfigProvider acp = acf.getConfigProvider(msgLayer, appContext, rl); + + String[] allIDs = acf.getRegistrationIDs(acp); + for (int ii = 0; ii < allIDs.length; ii++) { + AuthConfigFactory.RegistrationContext rc = acf + .getRegistrationContext(allIDs[ii]); + if (rc != null) { + String mlayer = rc.getMessageLayer(); + String appctxt = rc.getAppContext(); + if (msgLayer.equals(mlayer) && appContext.equals(appctxt)) { + regID = allIDs[ii]; + break; + } + } else { + printIt("no registrationContext for regID = " + allIDs[ii]); + } + } + + return regID; + } + + public static void printIt(String str) { + System.out.println(str); + } + + public static void printError(String str) { + System.err.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/build.xml new file mode 100644 index 0000000..225d0b3 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/common/build.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ACFTestServlet.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ACFTestServlet.java new file mode 100644 index 0000000..c105019 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ACFTestServlet.java @@ -0,0 +1,689 @@ +/* + * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; + +import com.sun.ts.tests.jaspic.spi.common.CommonTests; +import com.sun.ts.tests.jaspic.spi.common.CommonUtils; +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpConstraint; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(value = @HttpConstraint(rolesAllowed = { + "Administrator" }), httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "Administrator"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "Administrator") }) +@WebServlet(name = "ACFTestServlet", urlPatterns = { "/ACFTestServlet" }) +public class ACFTestServlet extends HttpServlet { + /** + * + */ + private static final long serialVersionUID = 1L; + + private String logFileLocation; + + private String servletAppContext = null; + + private String providerConfigFileLocation; + + private String vendorACFClass; + + private String testMethod = null; + + private transient CommonTests commonTests; + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doPost(request, response); + } + + @SuppressWarnings("unused") + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doTests(request, response); + } + + public void doTests(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (Exception ex) { + debug("got exception in ACFTestServlet"); + ex.printStackTrace(); + } + commonTests = new CommonTests(out); + + // get some common props + getPropsAndParams(request, response); + + if (testMethod == null) { + getRegistrationContextId(request, response); + AuthConfigFactoryVerifyPersistence(request, response); + + } else if (testMethod.equals("ACFRemoveRegistration")) { + ACFRemoveRegistration(request, response); + + } else if (testMethod.equals("ACFGetRegistrationIDs")) { + ACFGetRegistrationIDs(request, response); + + } else if (testMethod.equals("ACFGetRegistrationContext")) { + ACFGetRegistrationContext(request, response); + + } else if (testMethod.equals("ACFDetachListener")) { + ACFDetachListener(request, response); + + } else if (testMethod.equals("ACFGetFactory")) { + ACFGetFactory(request, response); + + } else if (testMethod.equals("ACFSwitchFactorys")) { + ACFSwitchFactorys(request, response); + + } else if (testMethod.equals("testACFComesFromSecFile")) { + testACFComesFromSecFile(request, response); + + } else if (testMethod.equals("ACFPersistentRegisterOnlyOneACP")) { + ACFPersistentRegisterOnlyOneACP(request, response); + + } else if (testMethod.equals("ACFInMemoryRegisterOnlyOneACP")) { + ACFInMemoryRegisterOnlyOneACP(request, response); + + } else if (testMethod.equals("ACFUnregisterACP")) { + ACFUnregisterACP(request, response); + + } else if (testMethod.equals("AuthConfigFactoryRegistration")) { + AuthConfigFactoryRegistration(request, response); + + } else if (testMethod.equals("ACFInMemoryNotifyOnUnReg")) { + ACFInMemoryNotifyOnUnReg(request, response); + + } else if (testMethod.equals("ACFPersistentNotifyOnUnReg")) { + ACFPersistentNotifyOnUnReg(request, response); + + } else if (testMethod.equals("ACFInMemoryPrecedenceRules")) { + ACFInMemoryPrecedenceRules(request, response); + + } else if (testMethod.equals("ACFPersistentPrecedenceRules")) { + ACFPersistentPrecedenceRules(request, response); + + } else if (testMethod.equals("ACFRemoveRegistrationWithBadId")) { + ACFRemoveRegistrationWithBadId(request, response); + } + + // restore original (CTS) factory class + // note: this should be done in many of the calls but its a safety measure + // to ensure we are resetting things back to expected defaults + try { + CommonUtils.resetDefaultACF(); + } catch (Exception ex) { + debug("ACFTestServlet: error calling CommonUtils.resetDefaultACF(): " + + ex.getMessage()); + ex.printStackTrace(); + } + } + + private void getPropsAndParams(HttpServletRequest req, + HttpServletResponse response) { + + // set logfile location + logFileLocation = req.getParameter("log.file.location"); + if ((logFileLocation != null) + && (-1 < logFileLocation.indexOf(JASPICData.DEFAULT_LOG_FILE))) { + // if here, we have logfile location value which contains + // JASPICData.DEFAULT_LOG_FILE + debug("logFileLocation already set"); + } else { + debug("logFileLocation NOT set completely"); + System.setProperty("log.file.location", logFileLocation); + } + debug("logFileLocation = " + logFileLocation); + + // set provider config file + providerConfigFileLocation = req + .getParameter("provider.configuration.file"); + debug("TS Provider ConfigFile = " + providerConfigFileLocation); + if (providerConfigFileLocation == null) { + debug("ERROR: getPropsAndParams(): providerConfigFileLocation = null"); + } else { + debug("getPropsAndParams(): providerConfigFileLocation = " + + providerConfigFileLocation); + } + + // set testMethod + testMethod = req.getParameter("method.under.test"); + + // set vendor class + vendorACFClass = req.getParameter("vendor.authconfig.factory"); + if (vendorACFClass == null) { + debug("ERROR: getPropsAndParams(): vendorACFClass = null"); + } else { + debug("getPropsAndParams(): vendorACFClass = " + vendorACFClass); + } + + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + return; + } + + /* + * This is testing that acf.removeRegistration(arg) will return FALSE when + * invalid arg supplied. (this requirement described in javadoc for api) + */ + public void ACFRemoveRegistration(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + System.out.println("in ACFTestServlet.ACFRemoveRegistration"); + commonTests._ACF_testFactoryRemoveRegistration(); + System.out.println( + "in ACFTestServlet ... just called commonTests._ACF_testFactoryRemoveRegistration"); + out = response.getWriter(); + if (out != null) { + System.out.println("in ACFTestServlet ... out != null so passed"); + out.println("ACFTestServlet->ACFRemoveRegistration() passed"); + out.flush(); + } else { + System.out.println("in ACFTestServlet ... out == null so failed"); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFRemoveRegistration() failed"); + ex.printStackTrace(); + } + } + + /* + * This is testing that acf.getRegistrationIDs(acp) NEVER returns null hint: + * this must return empty array even if unrecognized acp. (this requirement + * described in javadoc for api) + */ + public void ACFGetRegistrationIDs(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + commonTests._ACF_testFactoryGetRegistrationIDs(); + out = response.getWriter(); + if (out != null) { + out.println("ACFTestServlet->ACFGetRegistrationIDs() passed"); + out.flush(); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFGetRegistrationIDs() failed"); + ex.printStackTrace(); + } + } + + /* + * This is testing that acf.getRegistrationContext(string) returns NULL for an + * unrecognized string (this requirement described in javadoc for api) + */ + public void ACFGetRegistrationContext(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + commonTests._ACF_testFactoryGetRegistrationContext(); + out = response.getWriter(); + if (out != null) { + out.println("ACFTestServlet->ACFGetRegistrationContext() passed"); + out.flush(); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFGetRegistrationContext() failed"); + ex.printStackTrace(); + } + } + + /* + * This is testing that acf.detachListener(...) returns non-NULL for an + * unfound listner (this requirement described in javadoc for api) + */ + public void ACFDetachListener(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + commonTests._ACF_testFactoryDetachListener(vendorACFClass); + out = response.getWriter(); + if (out != null) { + out.println("ACFTestServlet->ACFDetachListener() passed"); + out.flush(); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFDetachListener() failed"); + ex.printStackTrace(); + } + } + + public void ACFGetFactory(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + commonTests._ACF_getFactory(); + out = response.getWriter(); + if (out != null) { + out.println("ACFTestServlet->ACFGetFactory() passed"); + out.flush(); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACF_getFactory() failed"); + ex.printStackTrace(); + } + } + + public void ACFSwitchFactorys(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._ACFSwitchFactorys(vendorACFClass); + if (out != null) { + out.println("ACFTestServlet->ACFSwitchFactorys() passed"); + out.flush(); + } + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFSwitchFactorys() failed"); + ex.printStackTrace(); + } + } + + public void testACFComesFromSecFile(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._testACFComesFromSecFile(); + out.println("ACFTestServlet->testACFComesFromSecFile() passed"); + out.flush(); + } catch (Exception ex) { + System.out.println("ACFTestServlet->testACFComesFromSecFile() failed"); + ex.printStackTrace(); + } + } + + public void ACFPersistentRegisterOnlyOneACP(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFileLocation, vendorACFClass, true); + out.println("ACFTestServlet->ACFPersistentRegisterOnlyOneACP() passed"); + out.flush(); + } catch (Exception ex) { + System.out + .println("ACFTestServlet->ACFPersistentRegisterOnlyOneACP() failed"); + ex.printStackTrace(); + } + } + + public void ACFInMemoryRegisterOnlyOneACP(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFileLocation, vendorACFClass, false); + out.println("ACFTestServlet->ACFInMemoryRegisterOnlyOneACP() passed"); + out.flush(); + } catch (Exception ex) { + System.out + .println("ACFTestServlet->ACFInMemoryRegisterOnlyOneACP() failed"); + ex.printStackTrace(); + } + } + + public void ACFUnregisterACP(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._ACFUnregisterACP(logFileLocation, providerConfigFileLocation, + vendorACFClass); + out.println("ACFTestServlet->ACFUnregisterACP() passed"); + out.flush(); + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFUnregisterACP() failed"); + ex.printStackTrace(); + } + } + + /* + * This is verifying that the invocation of removeRegistration() with an + * invalid and non-existant regId will return false. + */ + public void ACFRemoveRegistrationWithBadId(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + commonTests._ACFRemoveRegistrationWithBadId(); + out.println("ACFTestServlet->ACFRemoveRegistrationWithBadId() passed"); + out.flush(); + } catch (Exception ex) { + System.out + .println("ACFTestServlet->ACFRemoveRegistrationWithBadId() failed"); + ex.printStackTrace(); + } + } + + /** + * 1. Get System properties log.file.location, provider.configuration.file and + * vendor.authconfig.factory + * + * 2. Use the system properties to read the TestSuite providers defined in + * ProviderConfigruation.xml file and register them with vendor's authconfig + * factory. + */ + public void AuthConfigFactoryRegistration(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + AuthConfigFactory registerACF = CommonUtils.register(logFileLocation, + providerConfigFileLocation, vendorACFClass); + + if (registerACF != null) { + out.println("ACFTestServlet->AuthConfigFactoryRegistration() passed"); + } else { + out.println("ACFTestServlet->AuthConfigFactoryRegistration() failed"); + } + out.flush(); + } catch (Exception ex) { + System.out + .println("ACFTestServlet->AuthConfigFactoryRegistration() failed"); + ex.printStackTrace(); + } + } + + /** + * + */ + public void ACFInMemoryNotifyOnUnReg(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + + // test using in-memory registration + commonTests._ACFTestNotifyOnUnReg(vendorACFClass, false); + + out.println("ACFTestServlet->ACFInMemoryNotifyOnUnReg() passed"); + out.flush(); + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFInMemoryNotifyOnUnReg() failed"); + ex.printStackTrace(); + } + } + + /** + * + */ + public void ACFPersistentNotifyOnUnReg(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + + // now test using persistent registration + commonTests._ACFTestNotifyOnUnReg(vendorACFClass, true); + + out.println("ACFTestServlet->ACFPersistentNotifyOnUnReg() passed"); + out.flush(); + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFPersistentNotifyOnUnReg() failed"); + ex.printStackTrace(); + } + } + + /** + * + */ + public void ACFInMemoryPrecedenceRules(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + + // test using in-memory registration + commonTests._ACFTestPrecedenceRules(vendorACFClass, false); + + out.println("ACFTestServlet->ACFInMemoryPrecedenceRules() passed"); + out.flush(); + } catch (Exception ex) { + System.out.println("ACFTestServlet->ACFInMemoryPrecedenceRules() failed"); + ex.printStackTrace(); + } + } + + /** + * + */ + public void ACFPersistentPrecedenceRules(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + + // now test using persistent registration + commonTests._ACFTestPrecedenceRules(vendorACFClass, true); + + out.println("ACFTestServlet->ACFPersistentPrecedenceRules() passed"); + out.flush(); + } catch (Exception ex) { + System.out + .println("ACFTestServlet->ACFPersistentPrecedenceRules() failed"); + ex.printStackTrace(); + } + } + + /** + * + * 1. Get System properties log.file.location, provider.configuration.file and + * vendor.authconfig.factory + * + * 2. Use the system properties to read the TestSuite providers defined in + * ProviderConfigruation.xml file and register them with vendor's authconfig + * factory. + * + * + * Description This will use an appContext value that was used to register a + * provider, and it will see if it can use the + * AuthConfigFactory.RegistrationContext API to try and access the same + * appContext value that was used during the registration process. + * + */ + public void getRegistrationContextId(HttpServletRequest request, + HttpServletResponse response) { + String appContext = "localhost /Hello_web/Hello"; + + PrintWriter out = null; + try { + out = response.getWriter(); + + // register providers in vendor factory + AuthConfigFactory registeredACF = CommonUtils.register(logFileLocation, + providerConfigFileLocation, vendorACFClass); + if (registeredACF == null) { + out.println("getRegistrationContextId failed"); + } + + // verify we can access a given provider (any provider) appcontext id + boolean bVerified = false; + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + String[] regIDs = acf.getRegistrationIDs(null); + for (int ii = 0; ii < regIDs.length; ii++) { + // loop through the ACF's registration ids + + if (regIDs[ii] != null) { + AuthConfigFactory.RegistrationContext acfReg; + acfReg = acf.getRegistrationContext(regIDs[ii]); + if (acfReg != null) { + debug("appContext = " + appContext); + debug("acfReg.getAppContext() = " + acfReg.getAppContext()); + debug("layer = " + acfReg.getMessageLayer()); + String str = acfReg.getAppContext(); + if ((str != null) && (str.equals(appContext))) { + // we found our provider info + debug("Found it : RegistrationID for our ACP=" + regIDs[ii]); + bVerified = true; + break; + } + } + } + } + + if (!bVerified) { + String msg = "Could not find appContext=" + appContext; + msg += " in the ACF's list of registration id info"; + debug(msg); + out.println( + "getRegistrationContextId() TSProviders registration failed"); + } + + out.println("getRegistrationContextId() TSProviders registration passed"); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory() or "; + msg = msg + + "ACF.setFactory(). You may need to explicitly set your server side security policies."; + if (out == null) { + System.out.println(msg); + } else { + out.println(msg); + } + ex.printStackTrace(); + } catch (Exception ex) { + System.out.println( + "getRegistrationContextId() TSProviders registration failed"); + ex.printStackTrace(); + } + } + + /** + * + * 1. Get System properties log.file.location, provider.configuration.file and + * vendor.authconfig.factory + * + * 2. Load vendor's AuthConfigFactory and make sure the registered providers + * return properly for the right message layer and appContextId + * + * Note: We test the persistance behaviour for vendor's AuthConfigFactory by + * registering providers from a persisted file, then we verify the + * registrations went correctly. + * + */ + public void AuthConfigFactoryVerifyPersistence(HttpServletRequest request, + HttpServletResponse response) { + boolean verified = false; + + PrintWriter out = null; + try { + out = response.getWriter(); + + // register providers in vendor factory + AuthConfigFactory registerACF = CommonUtils.register(logFileLocation, + providerConfigFileLocation, vendorACFClass); + if (registerACF != null) { + out.println("AuthConfigFactoryVerifyPersistence failed"); + } + + // Get system default AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + debug("Default ACF class name = " + acf.getClass().getName()); + verified = verifyRegistrations(acf); + } else { + out.println("AuthConfigFactoryVerifyPersistence() failed"); + debug("Default ACF is null" + + " can't verify registrations for TestSuite Providers"); + } + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory."; + msg = msg + + " You may need to explicitly set your server side security policies."; + debug(msg); + ex.printStackTrace(); + + } catch (Exception e) { + System.out.println("AuthConfigFactoryVerifyPersistence() failed"); + e.printStackTrace(); + } + + if ((verified) && (out != null)) { + out.println("AuthConfigFactoryVerifyPersistence() passed"); + } + } + + private boolean verifyRegistrations(AuthConfigFactory acf) { + debug("Verifying Provider Registrations ..."); + + try { + // Get AuthConfigProviderServlet + AuthConfigProvider servletACP = acf + .getConfigProvider(JASPICData.LAYER_SERVLET, servletAppContext, null); + + if (servletACP != null) { + if (servletACP.getClass().getName().equals( + "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet")) { + debug("TSAuthConfigProviderServlet registered for" + + " message layer=HttpServlet" + " and appContextId=" + + servletAppContext); + } else { + debug("Wrong provider registerd for " + " message layer=HttpServlet" + + " and appContextId=" + servletAppContext); + return false; + } + + } else { + debug("Error : No AuthConfigprovider registerd for" + + " message layer=HttpServlet" + " and appContextId=" + + servletAppContext); + return false; + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return true; + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AnotherMandatoryAuthen.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AnotherMandatoryAuthen.java new file mode 100644 index 0000000..31b0bb4 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AnotherMandatoryAuthen.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpConstraint; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(value = @HttpConstraint(rolesAllowed = { + "Manager" }), httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "Manager"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "Manager") }) +@WebServlet(name = "AnotherMandatoryAuthen", urlPatterns = { + "/AnotherMandatoryAuthen" }) +public class AnotherMandatoryAuthen extends HttpServlet { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doPost(request, response); + printOut("Enterred AnotherMandatoryAuthen->doGet()", response); + } + + @SuppressWarnings("unused") + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + System.out.println("In AnotherMandatoryAuthen->doPost()"); + + printOut("Enterred AnotherMandatoryAuthen->doPost()", response); + printOut("request.getServletPath() = " + request.getServletPath(), + response); + printOut("request.getPathInfo() = " + request.getPathInfo(), response); + printOut("request.getMethod() = " + request.getMethod(), response); + + } + + @SuppressWarnings("unused") + public void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + System.out.println("In AnotherMandatoryAuthen->service()"); + printOut("Enterred AnotherMandatoryAuthen->service()", response); + } + + private void printOut(String str, HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (Exception ex) { + ex.printStackTrace(); + out = null; + } + if (out != null) { + out.println(str); + } else { + System.out.println(str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AuthStatusMandatorySuccess.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AuthStatusMandatorySuccess.java new file mode 100644 index 0000000..a2ec578 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/AuthStatusMandatorySuccess.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; + +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpConstraint; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(value = @HttpConstraint(rolesAllowed = { + "Administrator" }), httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "Administrator"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "Administrator") }) +@WebServlet(name = "AuthStatusMandatorySuccess", urlPatterns = { + "/AuthStatusMandatorySuccess" }) +public class AuthStatusMandatorySuccess extends HttpServlet { + + private static final long serialVersionUID = 1L; + + private String logFileLocation; + + private String servletAppContext = null; + + private String providerConfigFileLocation; + + private String vendorACFClass; + + private String testMethod = null; + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter out = response.getWriter(); + doPost(request, response); + out.println("Enterred AuthStatusMandatorySuccess->doGet()"); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + System.out.println("In AuthStatusMandatorySuccess->doPost()"); + doTests(request, response); + } + + public void doTests(HttpServletRequest request, + HttpServletResponse response) { + + System.out.println("In AuthStatusMandatorySuccess->doTests()"); + + PrintWriter out = null; + try { + out = response.getWriter(); + + // get some common props + getPropsAndParams(request, response); + + if (testMethod == null) { + + out.println("request.getServletPath() = " + request.getServletPath()); + out.println("request.getPathInfo() = " + request.getPathInfo()); + out.println("request.getMethod() = " + request.getMethod()); + + } else if (testMethod.equals("testSecRespCalledAfterSvcInvoc")) { + _testSecRespCalledAfterSvcInvoc(request, response); + } + } catch (Exception ex) { + System.out.println("WrapperServlet->testRequestWrapper() failed"); + ex.printStackTrace(); + } + } + + /* + * This should be satisfying assertion JASPIC:SPEC:108. + */ + public void _testSecRespCalledAfterSvcInvoc(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + + out.println( + "Enterred AuthStatusMandatorySuccess->_testSecRespCalledAfterSvcInvoc()"); + System.out.println( + "In AuthStatusMandatorySuccess->_testSecRespCalledAfterSvcInvoc()"); + + // see if a cts proprietary requestAttribute was set in the secureResponse + // call and if so, we have a problem. The secure response should be called + // AFTER this servlet invocation thus we should not see this attribute set + // yet. If set, it means our secureResponse was called BEFOR the service + // invocation and thats violation of jaspic 1.1. spec (section 3.8.3.2) + // also + // see https://java.net/jira/browse/JASPIC_SPEC-9 + String wasSecureResponseInvokedYet = (String) request + .getAttribute("secureRespCalled"); + if ((wasSecureResponseInvokedYet != null) + && (wasSecureResponseInvokedYet.equalsIgnoreCase("true"))) { + // error - the "secureRespCalled" attribute was set and that should + // only occur in secureResponse which indicates a problem since the + // secureResponse should not get called before service invocation. + System.out + .println("ERROR - secureResponse called before service invocation"); + out.println("testSecRespCalledAfterSvcInvoc() failed"); + return; + } else if (wasSecureResponseInvokedYet == null) { + // This is good and validates assertion: JASPIC:SPEC:108 + // The attribue was NOT set in secureResponse, so it must not + // have been called before the service invocation of this servlet + System.out.println( + "_testSecRespCalledAfterSvcInvoc() secureResponse NOT called before service invocation - which is correct!"); + out.println("testSecRespCalledAfterSvcInvoc() passed"); + } + + String wasValidateRequestInvokedYet = (String) request + .getAttribute("validateReqCalled"); + if ((wasValidateRequestInvokedYet == null) + || (!wasValidateRequestInvokedYet.equalsIgnoreCase("true"))) { + // ERROR - the only reason we should be here is if there was a Multi-msg + // dialog + // (per spec 3.8.3) but that should NOT be the case thus we should NOT + // get in here as caller identity should've been established in + // validateRequest already. + System.out.println( + "ERROR - validateRequest NOT called before service invocation"); + out.println("testSecRespCalledAfterSvcInvoc() failed"); + return; + } else { + // good - caller identity was established in validateRequest already, + // which + // is why we correctly see "validateReqCalled" request attribute was + // set. + System.out.println( + "_testSecRespCalledAfterSvcInvoc() validateRequest was correctly called BEFORE service invocation"); + out.println("testSecRespCalledAfterSvcInvoc() passed"); + } + + out.flush(); + } catch (Exception ex) { + System.out.println( + "AuthStatusMandatorySuccess->_testSecRespCalledAfterSvcInvoc() failed"); + ex.printStackTrace(); + } + + return; + } // _testSecRespCalledAfterSvcInvoc() + + private void getPropsAndParams(HttpServletRequest req, + HttpServletResponse response) { + + // set logfile location + logFileLocation = req.getParameter("log.file.location"); + if ((logFileLocation != null) + && (-1 < logFileLocation.indexOf(JASPICData.DEFAULT_LOG_FILE))) { + // if here, we have logfile location value which contains + // JASPICData.DEFAULT_LOG_FILE + debug("logFileLocation already set"); + } else { + debug("logFileLocation NOT set completely"); + System.setProperty("log.file.location", logFileLocation); + } + debug("logFileLocation = " + logFileLocation); + + // set provider config file + providerConfigFileLocation = req + .getParameter("provider.configuration.file"); + debug("TS Provider ConfigFile = " + providerConfigFileLocation); + if (providerConfigFileLocation == null) { + debug("ERROR: getPropsAndParams(): providerConfigFileLocation = null"); + } else { + debug("getPropsAndParams(): providerConfigFileLocation = " + + providerConfigFileLocation); + } + + // set testMethod + testMethod = req.getParameter("method.under.test"); + + // set vendor class + vendorACFClass = req.getParameter("vendor.authconfig.factory"); + if (vendorACFClass == null) { + debug("ERROR: getPropsAndParams(): vendorACFClass = null"); + } else { + debug("getPropsAndParams(): vendorACFClass = " + vendorACFClass); + } + + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + return; + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/Client.java new file mode 100644 index 0000000..7df7bd0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/Client.java @@ -0,0 +1,3734 @@ +/* + * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; +import java.util.Properties; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.BASE64Encoder; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactoryForStandalone; +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationEntry; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationXMLFileProcessor; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; + +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; + +/** + * This class will be used to perform simple servlet invocations. The servlet + * invocations should be used to test some different security constraints so we + * can validate that proper AuthModule invocations are occurring. (The servlet + * security constraints we set will affect which AuthModules will be tested.) + * + * This Client class should NOT be testing any of the JSR-196 API's within here. + * Instead, the actual beef of our testing should be done within the actual + * factory or provider code which will be called/used from within the MPR. + * Calling things like the AuthConfigFactory.getDefault() from within this + * client code is not a valid thing to do. We want a MPR to make this + * invocations. So for out testing, we will have the bulk of our tests live in + * the ACF's or ACP's. When those tests are autorun (maybe by having the + * respective constructors automatically kick them off), then they will perform + * any server side logging. + * + * We will check for success or failure from within this file. So the actual + * testcases in this class will simply consist of checking the server side log + * file for key strings which will indicate success or failure. + * + * Important: Exercise caution when modifying the search strings that are passed + * to the logProcessor.verifyLogContains() method calls. These strings should be + * written to the log file by some of the code in the server side + * tssv/config/*.java files. + * + */ +public class Client extends EETest { + private Properties props = null; + + private String hostname = null; + + private int portnum = 0; + + // this must be the decoded context path corresponding to the web module + private String contextPath = "/" + JASPICData.SCP_CONTEXT_PATH; + + private String acfServletPath = contextPath + "/ACFTestServlet"; + + private String wrapperServletPath = contextPath + "/WrapperServlet"; + + private String servletPath = contextPath + "/ModTestServlet"; + + private String openToAllServletPath = "/OpenToAllServlet"; + + private String allAccessServletPath = contextPath + openToAllServletPath; + + private String staticPagePath = contextPath + "/client.html"; + + private String noConstraintPath = contextPath + "/OptionalAuthen"; + + private String username = ""; + + private String password = ""; + + private String appContextHostname; + + // appContext must be in the form of "hostname context-path" + private String appContext; + + private LogFileProcessor logProcessor = null; + + private boolean initialized = false; + + private boolean bIs115Compatible = false; + + private String logFileLocation; + + private String vendorACF; + + private String providerConfigFileLoc; + + // some private static strings we need to verify ahead of time + private String ACF_MSG_1 = null; + + private ProviderConfigurationXMLFileProcessor configFileProcessor = null; + + private Collection providerConfigurationEntriesCollection = null; + + private String servletAppContext = null; + + private String providerConfigurationFileLocation; + + private String vendorAuthConfigFactoryClass; + + public static void main(String args[]) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /** + * @class.setup_props: log.file.location; provider.configuration.file; + * vendor.authconfig.factory; logical.hostname.servlet; + * webServerHost; webServerPort; authuser; authpassword; + * user; password; securedWebServicePort; + * servlet.is.jsr115.compatible; + * + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + + try { + hostname = p.getProperty("webServerHost"); + portnum = Integer.parseInt(p.getProperty("webServerPort")); + username = p.getProperty("user"); + password = p.getProperty("password"); + + logFileLocation = p.getProperty("log.file.location"); + vendorACF = p.getProperty("vendor.authconfig.factory"); + providerConfigFileLoc = p.getProperty("provider.configuration.file"); + appContextHostname = p.getProperty("logical.hostname.servlet"); + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + String str115Compat = p.getProperty("servlet.is.jsr115.compatible"); + if (str115Compat != null) { + bIs115Compatible = Boolean.valueOf(str115Compat).booleanValue(); + } else { + bIs115Compatible = false; + } + + appContext = servletAppContext; + ACF_MSG_1 = "TSAuthConfigFactory.getConfigProvider "; + ACF_MSG_1 += "returned non-null provider for Layer : HttpServlet"; + ACF_MSG_1 += " and AppContext :" + appContext; + + TestUtil.logMsg("setup(): logFileLocation = " + logFileLocation); + TestUtil + .logMsg("setup(): providerConfigFileLoc = " + providerConfigFileLoc); + TestUtil.logMsg("setup(): appContextHostname = " + appContextHostname); + TestUtil.logMsg("setup(): contextPath = " + contextPath); + TestUtil.logMsg("setup(): appContext = " + appContext); + TestUtil.logMsg("setup(): servletAppContext = " + servletAppContext); + + // we know what the logFileLocation is, but we can't always be sure it + // as initialized as a system property so explicitly set it here. + System.setProperty("log.file.location", logFileLocation); + System.setProperty("provider.configuration.file", providerConfigFileLoc); + System.setProperty("logical.hostname.servlet", appContextHostname); + + providerConfigurationFileLocation = props.getProperty("provider.configuration.file"); + TestUtil.logMsg("TestSuite Provider ConfigFile = " + providerConfigurationFileLocation); + + vendorAuthConfigFactoryClass = props.getProperty("vendor.authconfig.factory"); + TestUtil.logMsg("Vendor AuthConfigFactory class = " + vendorAuthConfigFactoryClass); + + if (!initialized) { + // create LogFileProcessor + logProcessor = new LogFileProcessor(props); + + // LogProcessor can take only the path without the file name - it will ad to it the default log file + // the init logger in Servlet or provider does the same so let's check more carefuly + String strFilePathAndName = ""; + if (logFileLocation.indexOf(com.sun.ts.tests.jaspic.tssv.util.JASPICData.DEFAULT_LOG_FILE) <= 0) { + strFilePathAndName = logFileLocation + "/" + com.sun.ts.tests.jaspic.tssv.util.JASPICData.DEFAULT_LOG_FILE; + } + + // if no TSSVLog.txt file exists, then we want to do something that + // cause one to be generated. + File logfile = new File(strFilePathAndName); + if (!logfile.exists()) { + TestUtil.logMsg("setup(): no TSSVLog.txt so access url to indirectly create one"); + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_MAND_SUCCESS; + int statusCode = invokeServlet(theContext, "POST"); + TestUtil.logMsg("setup(): invokeServlet() returned statusCode =" + statusCode); + } + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + initialized = true; + } + + } catch (Exception e) { + logErr("Error: got exception: ", e); + } + } + + public void cleanup() throws Fault { + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckSecureRespForOptionalAuth + * + * @assertion_ids: JASPIC:SPEC:59; JASPIC:SPEC:304; JASPIC:JAVADOC:27; + * JASPIC:JAVADOC:10; JASPIC:JAVADOC:11; JASPIC:JAVADOC:28; + * JASPIC:JAVADOC:13; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify secureResponse was called. + * + * Description This method will make a URL post that has + * optional security Authen which means that we should NOT + * need to set any principals in the validateRequest methods + * nor the callbacks. The Runtime should allow this to proceed + * to call the secureResponse even though there is no + * principal values explicitly being set. Note: we need to + * specifically hardwire the particular context used in this + * test to NOT have any principals set on the server side. + * + */ + public void CheckSecureRespForOptionalAuth() throws Fault { + String strHDR = "HttpServlet profile with servletName=/"; + String strMsg1 = strHDR + + "OptionalAuthen returning AuthStatus=AuthStatus.SUCCESS"; + String strMsg2 = "secureResponse called for layer=HttpServlet for requestURI=" + + contextPath + "/OptionalAuthen"; + String tempArg1[] = { strMsg1 }; + String tempArg2[] = { strMsg2 }; + + boolean verified = false; + String ctxt1 = contextPath + "/OptionalAuthen"; + + // access a servlet which has no security constraint set (which means + // authentication is optional) + checkAuthStatus(ctxt1, "SUCCESS", "POST", false); + + // verify we accessed and returned from validateReq call okay + verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("CheckSecureRespForOptionalAuth : FAILED"); + } + + // verify the call to secureResponse occurred + verified = logProcessor.verifyLogContains(tempArg2); + if (!verified) { + throw new Fault("CheckSecureRespForOptionalAuth : FAILED"); + } + + TestUtil.logMsg("CheckSecureRespForOptionalAuth : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckSecureRespForMandatoryAuth + * + * @assertion_ids: JASPIC:SPEC:98; JASPIC:SPEC:304; JASPIC:JAVADOC:26; + * JASPIC:JAVADOC:31; JASPIC:JAVADOC:10; JASPIC:JAVADOC:9; + * JASPIC:SPEC:103; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify secureResponse and CallerPrincipalCallback are + * called. + * + * Description This method will make a URL post that has + * Mandatory security Authen which means that we need to set a + * principal objects in the validateRequest method + * clientSubject object (or in a callback). Either way, once + * we set a principal object in the clientSubject - The + * Runtime should proceed to call the secureResponse and + * should invoke the CallbackHandler passed to it by the + * runtime to handle a CallerPrincipalCallback using the + * clientSubject as argument to it. For this case, we want to + * ensure the following occur: - AuthStatus returns SUCCESS + * (we know this is occuriing otherwise we would not make it + * into secureResponse) - isMandatory() == true - + * secureResponse is called - CallerPrincipalCallback handler + * gets invoked. + * + * NOTE: We need our server side to check and ensure there are + * principal values being set for this particular context + * posting. + * + */ + public void CheckSecureRespForMandatoryAuth() throws Fault { + boolean verified = false; + String strHDR = "HttpServlet profile with servletName=/"; + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_MAND_SUCCESS; + String strMsg1 = strHDR + JASPICData.AUTHSTAT_MAND_SUCCESS + + " returning AuthStatus=AuthStatus.SUCCESS"; + String strMsg2 = "secureResponse called for layer=HttpServlet for requestURI=" + + theContext; + String strMsg3 = "In HttpServlet : ServerRuntime CallerPrincipalCallback"; + strMsg3 += " called for profile=HttpServlet for servletPath=" + theContext; + String tempArg1[] = { strMsg1, strMsg2, strMsg3 }; + + checkAuthStatus(theContext, "SUCCESS", "POST", false); + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("CheckSecureRespForMandatoryAuth : FAILED"); + } + + TestUtil.logMsg("CheckSecureRespForMandatoryAuth : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: testSecRespCalledAfterSvcInvoc + * + * @assertion_ids: JASPIC:SPEC:108; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify secureResponse and CallerPrincipalCallback are + * called. + * + * Description This method will make a URL post that has + * Mandatory security Authen and it will verify that the + * secureResponse() method has NOT been called before the + * servlet/service invocation by checking for the existance of + * a cts proprietary request property that would only get set + * from in secureResponse. So if the property is found, we + * know a call to secureResponse was incorrectly made BEFORE + * the servlet/service invocation but if the request property + * is NOT found, then we can assume that secureResponse was + * NOT called before the servlet/service invocation. + * + */ + public void testSecRespCalledAfterSvcInvoc() throws Fault { + String strMsg1 = "testSecRespCalledAfterSvcInvoc() passed"; + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_MAND_SUCCESS; + + String str = invokeServletAndGetResponse(theContext, "POST", + "testSecRespCalledAfterSvcInvoc"); + + TestUtil.logMsg("testSecRespCalledAfterSvcInvoc : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("testSecRespCalledAfterSvcInvoc : FAILED"); + } + + TestUtil.logMsg("testSecRespCalledAfterSvcInvoc : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckNoAuthReturnsValidStatusCode + * + * @assertion_ids: JASPIC:SPEC:93 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Make servlet invocations and check the return status to + * verify proper server side handling. + * + * Description This method will make a request that is not + * authorized and then verify that the status code returned is + * not indicating the request was OK==200. If we get back a + * statuscode = 200 then there was a problem since we were + * trying to access a page that had mandatory authentication + * set AND we were trying to use an invalid user/pwd to + * perform that access - thus we should NOT get an okay status + * code returned since our bad username/pwd will not have + * perms. + * + */ + public void CheckNoAuthReturnsValidStatusCode() throws Fault { + String noAuthContext = contextPath + "/AnotherMandatoryAuthen"; + + // invokeServlet will attempt to access the resource that does + // not have the proper role creds assigned to it + // thus we expect a return status code != 200 + int statusCode = invokeServlet(noAuthContext, "POST"); + + // if status of 200 was returned then there is a problem since + // we should have been forbidden from completing our request + // as our username/pwd change means we should not be authenticated + if (statusCode == 200) { + throw new Fault("CheckNoAuthReturnsValidStatusCode : FAILED"); + } + + TestUtil.logMsg("CheckNoAuthReturnsValidStatusCode : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: VerifyRequestDispatchedProperly + * + * @assertion_ids: JASPIC:SPEC:317; JASPIC:JAVADOC:27; JASPIC:JAVADOC:28; + * + * + * @test_Strategy: 1. issue request that has mandatory auth and verify it gets + * authorized. 2. issue a request that is mandatory but NOT + * authorized (eg submit request with invalid user/pwd) and + * verify that secureResponse is still called by MPR. + * + * Description The request must be dispatched to the resource + * if the request was determined to be authorized; otherwise + * it must NOT be dispatched and the runtime must proceed to + * point (3) in the message processing model. + * + */ + public void VerifyRequestDispatchedProperly() throws Fault { + boolean verified = false; + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_MAND_SUCCESS; + String noAuthContext = contextPath + "/AnotherMandatoryAuthen"; + + // we should see that our request is properly dispatched + // we will assume that a proper response code indicates success + // as we are using correct creds + int statusCode = invokeServlet(theContext, "POST", + "VerifyRequestDispatchedProperly"); + if (statusCode != 200) { + throw new Fault("VerifyRequestDispatchedProperly : FAILED"); + } + + // invokeServlet will attempt to access the resource that + // does not have proper role creds assigned + // thus we expect a return status code != 200 + statusCode = invokeServlet(noAuthContext, "POST"); + + if (statusCode == 200) { + // failure since 200 means we were able to properly dispatch the request + throw new Fault("VerifyRequestDispatchedProperly : FAILED"); + } + + // now verify that the MPR went into the secureResponse + String strMsg1 = "secureResponse called for layer=HttpServlet for requestURI=" + + theContext; + String tempArg1[] = { strMsg1 }; + verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("VerifyRequestDispatchedProperly : FAILED"); + } + + TestUtil.logMsg("VerifyRequestDispatchedProperly : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckValidateReqAuthException + * + * @assertion_ids: JASPIC:SPEC:58; JASPIC:SPEC:320; JASPIC:SPEC:94; + * JASPIC:JAVADOC:1; JASPIC:JAVADOC:28; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify secureResponse was not called for the given context + * and that an AuthException was called. + * + * Description This method will make a URL post using a + * context that should cause an AuthException to get thrown + * from the validateRequest. This should cause the + * secureResponse to NOT get called. + * + */ + public void CheckValidateReqAuthException() throws Fault { + boolean verified = false; + String strHDR = "HttpServlet profile with servletName=/"; + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_THROW_EX_ND; + String strMsg1 = strHDR + JASPICData.AUTHSTAT_THROW_EX_ND + + " returning AuthStatus=AuthException"; + String tempArg1[] = { strMsg1 }; + + String strMsg2 = "secureResponse called for layer=HttpServlet for requestURI=" + + contextPath + "/" + JASPICData.AUTHSTAT_THROW_EX_ND; + String tempArg2[] = { strMsg2 }; + + checkAuthStatus(theContext, "AuthException", "POST", false); + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("CheckValidateReqAuthException : FAILED"); + } + + // also verify that no call to secureResponse was made + verified = logProcessor.verifyLogContains(tempArg2); + if (verified) { + throw new Fault("CheckValidateReqAuthException : FAILED"); + } + + TestUtil.logMsg("CheckValidateReqAuthException : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckValidateReqAlwaysCalled + * + * @assertion_ids: JASPIC:SPEC:58; JASPIC:SPEC:320; JASPIC:SPEC:89; + * JASPIC:SPEC:94; JASPIC:JAVADOC:1; JASPIC:JAVADOC:28; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify secureResponse was not called for the given context + * and that an AuthException was called. + * + * Description This method will make mulitple posts using + * contexts w/ authN that is both required and non-required. + * We want to confirm that validateRequest is called + * independent of whether authN is required (i.e. including + * when isMandatory() would be false). Among other things, + * This is validating JASPIC spec section 3.8 which states + * "validateRequest must be called for all requests". + * + */ + public void CheckValidateReqAlwaysCalled() throws Fault { + boolean verified = false; + String strHDR = "validateRequest() called for "; + String context1 = servletPath; // authN is required + String context2 = noConstraintPath; // no authN required + String strMsg1 = strHDR + context1 + ", isMandatory() = true"; + String strMsg2 = strHDR + context2 + ", isMandatory() = false"; + String tempArg1[] = { strMsg1 }; + String tempArg2[] = { strMsg2 }; + + invokeServlet(context1, "POST", "CheckValidateReqAlwaysCalled"); + invokeServlet(context2, "POST", "CheckValidateReqAlwaysCalled"); + + TestUtil.logMsg("searaching for string1: " + strMsg1); + TestUtil.logMsg("searaching for string2: " + strMsg2); + + // verify whether the log contains 1st required messages. + verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("CheckValidateReqAlwaysCalled : FAILED"); + } + + // also verify the log contains 2nd required messages. + verified = logProcessor.verifyLogContains(tempArg2); + if (!verified) { + throw new Fault("CheckValidateReqAlwaysCalled : FAILED"); + } + + TestUtil.logMsg("CheckValidateReqAlwaysCalled : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: AuthConfigFactoryGetFactory + * + * @assertion_ids: JASPIC:SPEC:7; JASPIC:SPEC:10; JASPIC:JAVADOC:84; + * JASPIC:JAVADOC:94; JASPIC:JAVADOC:79; JASPIC:JAVADOC:97; + * JASPIC:JAVADOC:77; JASPIC:JAVADOC:80; JASPIC:JAVADOC:84; + * JASPIC:JAVADOC:85; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether AuthConfigFactory.getFactory is called and + * instantiated in the server. + * + * Description The AuthConfigFactory.getFactory method must be + * used during the container bootstrap processs. + * + */ + public void AuthConfigFactoryGetFactory() throws Fault { + boolean verified = false; + String args[] = { "TSAuthConfigFactory.getFactory called Indirectly" }; + + invokeServlet(servletPath, "POST", "AuthConfigFactoryGetFactory"); + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("AuthConfigFactoryGetFactory : FAILED"); + } + + TestUtil.logMsg("AuthConfigFactoryGetFactory : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: GetConfigProvider + * + * @assertion_ids: JASPIC:SPEC:8; JASPIC:SPEC:14; JASPIC:JAVADOC:79; + * JASPIC:JAVADOC:84; JASPIC:JAVADOC:85; JASPIC:JAVADOC:91 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether AuthConfigFactory.getConfigProvider is + * called in the server. + * + * Description The runtime must invoke + * AuthConfigFactory.getConfigProvider to obtain the + * AuthConfigProvider. + * + */ + public void GetConfigProvider() throws Fault { + boolean verified = false; + String args[] = { "TSAuthConfigFactory.getConfigProvider called" }; + + invokeServlet(servletPath, "POST", "GetConfigProvider"); + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("GetConfigProvider : FAILED"); + } + + TestUtil.logMsg("GetConfigProvider : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckAuthContextId + * + * @assertion_ids: JASPIC:SPEC:80 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify that the authentication context identifier used in + * the call to getAuthContext is equivalent to the value that + * is acquired in the call to getAuthContextID with the + * MessageInfo that is be used in the call to validateRequest. + * + * Description The authentication context identifier used in + * the call to getAuthContext must be equivalent to the value + * that would be acquired by calling getAuthContextID with the + * MessageInfo that will be used in the call to + * validateRequest. + * + */ + public void CheckAuthContextId() throws Fault { + String strMsg1 = "getAuthContextID() called for layer=HttpServlet shows"; + strMsg1 = strMsg1 + " AuthContextId=/ModTestServlet POST"; + String strMsg2 = "TSServerAuthConfig.getAuthContext: layer=HttpServlet"; + strMsg2 = strMsg2 + " : appContext=" + appContext + + " operationId=/ModTestServlet POST"; + String tempArgs[] = { strMsg1, strMsg2 }; + + invokeServlet(servletPath, "POST", "CheckAuthContextId"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("CheckAuthContextId : FAILED"); + } + + TestUtil.logMsg("CheckAuthContextId : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckAuthContextIdUsingGet + * + * @assertion_ids: JASPIC:SPEC:80 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify that the authentication context identifier used in + * the call to getAuthContext is equivalent to the value that + * is acquired in the call to getAuthContextID with the + * MessageInfo that is be used in the call to validateRequest. + * + * Description The authentication context identifier used in + * the call to getAuthContext must be equivalent to the value + * that would be acquired by calling getAuthContextID with the + * MessageInfo that will be used in the call to + * validateRequest. + * + * NOTE: this is basically the same as CheckAuthContextId + * except that this is using "GET" instead of "POST". While + * seemingly trivial, it has been suggested that GET and POST + * can often take different branches in impl code so it's + * worth checking both. + * + */ + public void CheckAuthContextIdUsingGet() throws Fault { + String strMsg1 = "getAuthContextID() called for layer=HttpServlet shows"; + strMsg1 = strMsg1 + " AuthContextId=/ModTestServlet GET"; + String strMsg2 = "TSServerAuthConfig.getAuthContext: layer=HttpServlet"; + strMsg2 = strMsg2 + " : appContext=" + appContext + + " operationId=/ModTestServlet GET"; + String tempArgs[] = { strMsg1, strMsg2 }; + + invokeServlet(servletPath, "GET", "CheckAuthContextIdUsingGet"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("CheckAuthContextIdUsingGet : FAILED"); + } + + TestUtil.logMsg("CheckAuthContextIdUsingGet : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: AuthConfigFactoryRegistration + * + * @assertion_ids: JASPIC:SPEC:80; + * + * @test_Strategy: this was originally in register directory but was moved + * here and the code pulled out and centralized into + * ACFTestServlet. + * + */ + public void AuthConfigFactoryRegistration() throws Fault { + String strMsg1 = "ACFTestServlet->AuthConfigFactoryRegistration() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "AuthConfigFactoryRegistration"); + TestUtil.logMsg("AuthConfigFactoryRegistration : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("AuthConfigFactoryRegistration : FAILED"); + } + + TestUtil.logMsg("AuthConfigFactoryRegistration : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFInMemoryNotifyOnUnReg + * + * @assertion_ids: JASPIC:SPEC:336; JASPIC:SPEC:337; JASPIC:SPEC:338; + * JASPIC:SPEC:339; JASPIC:SPEC:342; JASPIC:SPEC:344; + * + * @test_Strategy: this was originally in register directory but was moved + * here and the code pulled out and centralized into + * ACFTestServlet. + * + */ + public void ACFInMemoryNotifyOnUnReg() throws Fault { + String strMsg1 = "ACFTestServlet->ACFInMemoryNotifyOnUnReg() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFInMemoryNotifyOnUnReg"); + TestUtil.logMsg("ACFInMemoryNotifyOnUnReg : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFInMemoryNotifyOnUnReg : FAILED"); + } + + TestUtil.logMsg("ACFInMemoryNotifyOnUnReg : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFPersistentNotifyOnUnReg + * + * @assertion_ids: JASPIC:SPEC:336; JASPIC:SPEC:337; JASPIC:SPEC:338; + * JASPIC:SPEC:339; JASPIC:SPEC:341; JASPIC:SPEC:344; + * + * @test_Strategy: this was originally in register directory but was moved + * here and the code pulled out and centralized into + * ACFTestServlet. + * + */ + public void ACFPersistentNotifyOnUnReg() throws Fault { + String strMsg1 = "ACFTestServlet->ACFPersistentNotifyOnUnReg() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFPersistentNotifyOnUnReg"); + TestUtil.logMsg("ACFPersistentNotifyOnUnReg : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFPersistentNotifyOnUnReg : FAILED"); + } + + TestUtil.logMsg("ACFPersistentNotifyOnUnReg : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFInMemoryPrecedenceRules + * + * @assertion_ids: JASPIC:SPEC:328; JASPIC:SPEC:337; JASPIC:SPEC:338; + * JASPIC:SPEC:338; JASPIC:SPEC:339; JASPIC:SPEC:344; + * + * @test_Strategy: this was originally in register directory but was moved + * here and the code pulled out and centralized into + * ACFTestServlet. + * + */ + public void ACFInMemoryPrecedenceRules() throws Fault { + String strMsg1 = "ACFTestServlet->ACFInMemoryPrecedenceRules() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFInMemoryPrecedenceRules"); + TestUtil.logMsg("ACFInMemoryPrecedenceRules : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFInMemoryPrecedenceRules : FAILED"); + } + + TestUtil.logMsg("ACFInMemoryPrecedenceRules : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFPersistentPrecedenceRules + * + * @assertion_ids: JASPIC:SPEC:328; JASPIC:SPEC:337; JASPIC:SPEC:338; + * JASPIC:SPEC:338; JASPIC:SPEC:339; JASPIC:SPEC:344; + * + * @test_Strategy: this was originally in register directory but was moved + * here and the code pulled out and centralized into + * ACFTestServlet. + * + */ + public void ACFPersistentPrecedenceRules() throws Fault { + String strMsg1 = "ACFTestServlet->ACFPersistentPrecedenceRules() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFPersistentPrecedenceRules"); + TestUtil.logMsg("ACFPersistentPrecedenceRules : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFPersistentPrecedenceRules : FAILED"); + } + + TestUtil.logMsg("ACFPersistentPrecedenceRules : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFGetRegistrationContext + * + * @assertion_ids: JASPIC:JAVADOC:81; + * + * @test_Strategy: This is testing that acf.getRegistrationContext(string) + * returns NULL for an unrecognized string. (this requirement + * described in javadoc for api) + */ + public void ACFGetRegistrationContext() throws Fault { + String strMsg1 = "ACFTestServlet->ACFGetRegistrationContext() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFGetRegistrationContext"); + TestUtil.logMsg("ACFGetRegistrationContext : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFGetRegistrationContext : FAILED"); + } + + TestUtil.logMsg("ACFGetRegistrationContext : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFGetRegistrationIDs + * + * @assertion_ids: JASPIC:JAVADOC:82; + * + * @test_Strategy: This is testing that acf.getRegistrationIDs(acp) NEVER + * returns null hint: this must return empty array even if + * unrecognized acp. (this requirement described in javadoc + * for api) + * + */ + public void ACFGetRegistrationIDs() throws Fault { + String strMsg1 = "ACFTestServlet->ACFGetRegistrationIDs() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFGetRegistrationIDs"); + TestUtil.logMsg("ACFGetRegistrationIDs : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFGetRegistrationIDs : FAILED"); + } + + TestUtil.logMsg("ACFGetRegistrationIDs : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFRemoveRegistration + * + * @assertion_ids: JASPIC:JAVADOC:86; + * + * @test_Strategy: This is testing that acf.removeRegistration(arg) will + * return FALSE when invalid arg supplied. (this requirement + * described in javadoc for api) + * + */ + public void ACFRemoveRegistration() throws Fault { + String strMsg1 = "ACFTestServlet->ACFRemoveRegistration() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFRemoveRegistration"); + TestUtil.logMsg("ACFRemoveRegistration : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFRemoveRegistration : FAILED"); + } + + TestUtil.logMsg("ACFRemoveRegistration : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFDetachListener + * + * @assertion_ids: JASPIC:JAVADOC:78; + * + * @test_Strategy: This is testing that acf.detachListener(...) will return + * non-null when unregistered listener supplied. (this + * requirement described in javadoc for api) + * + */ + public void ACFDetachListener() throws Fault { + String strMsg1 = "ACFTestServlet->ACFDetachListener() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFDetachListener"); + TestUtil.logMsg("ACFDetachListener : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFDetachListener : FAILED"); + } + + TestUtil.logMsg("ACFDetachListener : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFGetFactory + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:335; JASPIC:SPEC:7; + * + * @test_Strategy: This s mainly concerned with testing the runtimes handling + * of ACF as follows: - get current (CTS) ACF - switch to use + * different (CTS) ACF - verify calls to ACF use the + * newer/expected ACF - restore original ACF + */ + public void ACFGetFactory() throws Fault { + String strMsg1 = "ACFTestServlet->ACFGetFactory() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFGetFactory"); + TestUtil.logMsg("ACFGetFactory : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFGetFactory : FAILED"); + } + + TestUtil.logMsg("ACFGetFactory : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testACFComesFromSecFile + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:330; + * + * @test_Strategy: This is calling a method on the server(actually servlet) + * side that will invoke getFactory() to verify a non-null + * facotry instance is returned. It will also verify that the + * authconfigprovider.factory security property is properly + * set/used. + * + */ + public void testACFComesFromSecFile() throws Fault { + String strMsg1 = "ACFTestServlet->testACFComesFromSecFile() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "testACFComesFromSecFile"); + TestUtil.logMsg("testACFComesFromSecFile : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("testACFComesFromSecFile : FAILED"); + } + + TestUtil.logMsg("testACFComesFromSecFile : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFPersistentRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:331; JASPIC:SPEC:332; + * JASPIC:SPEC:340; JASPIC:SPEC:341; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register another + * persistent ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - try to + * re-register (persistently) standalone provider - verify 2nd + * attempt at added standalone provider REPLACED the first but + * it should NOT have added another nor failed. - also confirm + * that regID for standalone ACP stayed the same after 1st and + * 2nd attempt to register standalone ACP - verify that the + * 2nd re-registering of ACP replaced the ACP AND the + * description. - unregister standalone ACP and setFactory + * back to CTS default + * + */ + public void ACFPersistentRegisterOnlyOneACP() throws Fault { + String strMsg1 = "ACFTestServlet->ACFPersistentRegisterOnlyOneACP() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFPersistentRegisterOnlyOneACP"); + TestUtil.logMsg("ACFPersistentRegisterOnlyOneACP : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFPersistentRegisterOnlyOneACP : FAILED"); + } + + TestUtil.logMsg("ACFPersistentRegisterOnlyOneACP : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFInMemoryRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:334; JASPIC:SPEC:342; JASPIC:SPEC:343; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register + * (in-memory) ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - try to + * re-register (in-memory) standalone provider - verify 2nd + * attempt at added standalone provider REPLACED the first but + * it should NOT have added another nor failed. - also confirm + * that regID for standalone ACP stayed the same after 1st and + * 2nd attempt to register standalone ACP - verify that the + * 2nd re-registering of ACP replaced the ACP AND the + * description. - unregister standalone ACP and setFactory + * back to CTS default + * + */ + public void ACFInMemoryRegisterOnlyOneACP() throws Fault { + String strMsg1 = "ACFTestServlet->ACFInMemoryRegisterOnlyOneACP() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFInMemoryRegisterOnlyOneACP"); + TestUtil.logMsg("ACFInMemoryRegisterOnlyOneACP : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFInMemoryRegisterOnlyOneACP : FAILED"); + } + + TestUtil.logMsg("ACFInMemoryRegisterOnlyOneACP : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testRequestWrapper + * + * @assertion_ids: JASPIC:SPEC:108; JASPIC:SPEC:311; + * + * @test_Strategy: + * + * From JASPIC Spec section 3.8.3.5: When a ServerAuthModule + * returns a wrapped message in MessageInfo, or unwraps a + * message in MessageInfo, the message processing runtime must + * ensure that the HttpServletRequest and HttpServletResponse + * objects established by the ServerAuthModule are used in + * downstream processing. + * + * This test uses a Server Authentication Module(SAM) that + * wraps and unwraps the HttpRequest as specified by the + * JASPIC spec and expects the runtime to handle the Wrapped + * HttpRequest. + * + */ + public void testRequestWrapper() throws Fault { + String strMsg1 = "isRequestWrapped = true"; + String strMsg2 = "Incorrect request type"; + + String str = invokeServletAndGetResponse(wrapperServletPath, "POST", + "testRequestWrapper"); + TestUtil.logMsg("testRequestWrapper response msg = " + str); + + int ii = str.indexOf(strMsg1); + if (ii < 0) { + TestUtil.logMsg("testRequestWrapper Error - could not find: " + strMsg1); + throw new Fault("testRequestWrapper : FAILED"); + } + + ii = str.indexOf(strMsg2); + if (ii >= 0) { + // this may indicate secureResponse was incorrectly called before service + // invocation + TestUtil + .logMsg("testRequestWrapper Error - found occurance of: " + strMsg2); + throw new Fault("testRequestWrapper : FAILED"); + } + + TestUtil.logMsg("testRequestWrapper : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testResponseWrapper + * + * @assertion_ids: JASPIC:SPEC:108; JASPIC:SPEC:311; + * + * @test_Strategy: From JASPIC Spec section 3.8.3.5: When a ServerAuthModule + * returns a wrapped message in MessageInfo, or unwraps a + * message in MessageInfo, the message processing runtime must + * ensure that the HttpServletRequest and HttpServletResponse + * objects established by the ServerAuthModule are used in + * downstream processing. + * + * This test uses a Server Authentication Module(SAM) that + * wraps and unwraps the HttpResponse as specified by the + * JASPIC spec and expects the runtime to handle the Wrapped + * HttpResponse. + */ + public void testResponseWrapper() throws Fault { + String strMsg1 = "isResponseWrapped = true"; + String strMsg2 = "Incorrect response type"; + + String str = invokeServletAndGetResponse(wrapperServletPath, "POST", + "testResponseWrapper"); + TestUtil.logMsg("testResponseWrapper response msg = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + TestUtil.logMsg("testResponseWrapper Error - could not find: " + strMsg1); + throw new Fault("testResponseWrapper : FAILED"); + } + + ii = str.indexOf(strMsg2); + if (ii >= 0) { + // this may indicate secureResponse was incorrectly called before service + // invocation + TestUtil + .logMsg("testResponseWrapper Error - found occurance of: " + strMsg2); + throw new Fault("testResponseWrapper : FAILED"); + } + + TestUtil.logMsg("testResponseWrapper : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: ACFUnregisterACP + * + * @assertion_ids: JASPIC:SPEC:344; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register + * (in-memory) ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - unregister the + * in-memory ACP we just registered - verify + * removeRegistration() method call returned proper boolean - + * verify expected # of registry eentries - verify 2nd call to + * removeRegistration() with regId that was previously removed + * and should expect return val of false + * + */ + public void ACFUnregisterACP() throws Fault { + String strMsg1 = "ACFTestServlet->ACFUnregisterACP() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFUnregisterACP"); + TestUtil.logMsg("ACFUnregisterACP : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFUnregisterACP : FAILED"); + } + + TestUtil.logMsg("ACFUnregisterACP : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckACFVerifyPersistence + * + * @assertion_ids: JASPIC:SPEC:75; JASPIC:SPEC:335; + * + * @test_Strategy: This tests the (persistent) registration of CTS ACP's + * within the the vendors ACF. + * + */ + public void CheckACFVerifyPersistence() throws Fault { + String strMsg1 = "AuthConfigFactoryVerifyPersistence() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST"); + TestUtil.logMsg("CheckACFVerifyPersistence : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("CheckACFVerifyPersistence : FAILED"); + } + + TestUtil.logMsg("CheckACFVerifyPersistence : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckRegistrationContextId + * + * @assertion_ids: JASPIC:SPEC:77; + * + * @test_Strategy: This registers CTS ACP's within vendors ACF and then + * verifies the RegistrationContext info can be obtained from + * the vendors ACF. + * + */ + public void CheckRegistrationContextId() throws Fault { + String strMsg1 = "getRegistrationContextId() TSProviders registration passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST"); + TestUtil.logMsg("CheckRegistrationContextId : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("CheckRegistrationContextId : FAILED"); + } + + TestUtil.logMsg("CheckRegistrationContextId : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckCallbackSupport + * + * @assertion_ids: JASPIC:SPEC:72; JASPIC:SPEC:103; JASPIC:JAVADOC:27; + * JASPIC:JAVADOC:40; JASPIC:JAVADOC:46; JASPIC:JAVADOC:31; + * JASPIC:JAVADOC:32; JASPIC:JAVADOC:33; JASPIC:JAVADOC:34; + * JASPIC:JAVADOC:38; JASPIC:JAVADOC:39; JASPIC:JAVADOC:41; + * JASPIC:JAVADOC:42; JASPIC:JAVADOC:43; JASPIC:JAVADOC:44; + * JASPIC:JAVADOC:35; JASPIC:JAVADOC:36; JASPIC:JAVADOC:51; + * JASPIC:JAVADOC:49; JASPIC:JAVADOC:54; JASPIC:JAVADOC:65; + * JASPIC:JAVADOC:63; JASPIC:JAVADOC:68; JASPIC:JAVADOC:69; + * JASPIC:JAVADOC:71; JASPIC:JAVADOC:28; JASPIC:JAVADOC:107; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the following callbackHandlers are + * supported: CallerPrincipalCallback, GroupPrincipalCallback, + * and PasswordValidationCallback. + * + * Description The CallbackHandler passed to + * ServerAuthModule.initialize must support the following + * callbacks: CallerPrincipalCallback, GroupPrincipalCallback, + * and PasswordValidationCallback. + * + */ + public void CheckCallbackSupport() throws Fault { + String strMsg1 = "In HttpServlet : ServerRuntime CallbackHandler supports CallerPrincipalCallback"; + String strMsg2 = "In HttpServlet : ServerRuntime CallbackHandler supports GroupPrincipalCallback"; + String strMsg3 = "In HttpServlet : ServerRuntime CallbackHandler supports PasswordValidationCallback"; + String tempArgs[] = { strMsg1, strMsg2, strMsg3 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see which CBH's are supported. + invokeServlet(servletPath, "POST", "CheckCallbackSupport"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("CheckCallbackSupport : FAILED"); + } + + TestUtil.logMsg("CheckCallbackSupport : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testGPCWithNoRequiredAuth + * + * @assertion_ids: JASPIC:SPEC:90; + * @test_Strategy: This is checking that the group callbacks work for case of + * being called with CPC when no auth is required. + * + * Description This ultmately calls + * ServerCallbackSupport.GroupPrincipalCallbackSupport() with + * no required creds. + */ + public void testGPCWithNoRequiredAuth() throws Fault { + + String strMsg1 = "In HttpServlet : ServerRuntime GroupPrincipalCallbackSupport():"; + strMsg1 += " successfully called callbackHandler.handle(callbacks)"; + strMsg1 += " for servlet: " + openToAllServletPath; + strMsg1 += " with isServletAuthMandatory = " + false; + + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see which CBH's are supported. + String str = invokeServletAndGetResponse(allAccessServletPath, "POST", + "testGPCWithNoRequiredAuth"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("testGPCWithNoRequiredAuth : FAILED"); + } + + TestUtil.logMsg("testGPCWithNoRequiredAuth : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testGPCIsUserInRole + * + * @assertion_ids: JASPIC:SPEC:90; + * @test_Strategy: The ModTestServlet is called which forces our SAM to invoke + * callbacks - including the GPC. This test expects and checks + * that the GPC was invoked with non-null principal and that + * auth was mandatory and that upon return from + * validateRequest, there are values set in + * HttpServletRequest.isUserInRole() + * + * Description This is checking that the group callbacks work + * for case of being called with CPC when auth is required and + * the check that the validateRequest ensures there was a + * return value set for calls to + * HttpServletRequest.getRemoteUser() + * + */ + public void testGPCIsUserInRole() throws Fault { + + String strChkServlet = "ModTestServlet->testGPCIsUserInRole() passed"; + + String strMsg1 = "In HttpServlet : ServerRuntime GroupPrincipalCallbackSupport():"; + strMsg1 += " successfully called callbackHandler.handle(callbacks)"; + strMsg1 += " for servlet: /ModTestServlet"; + strMsg1 += " with isServletAuthMandatory = " + true; + + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see that GPC is supported and + // that the IsUserInRole() is properly populated. + String str = invokeServletAndGetResponse(servletPath, "POST", + "testGPCIsUserInRole"); + + // First, lets make sure CBH's were actually called + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("testGPCIsUserInRole : FAILED"); + } + + // next, lets make sure CBH's set principal values as expected + if (!str.contains(strChkServlet)) { + String msg = "testGPCIsUserInRole did not have proper credential values returned in "; + msg += servletPath + + ". this could be due to CBH's not properly doing authentication."; + TestUtil.logMsg(msg); + throw new Fault("testGPCIsUserInRole : FAILED"); + } + + TestUtil.logMsg("testGPCIsUserInRole : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testGPCGetRemoteUser + * + * @assertion_ids: JASPIC:SPEC:90; + * @test_Strategy: The ModTestServlet is called which forces our SAM to invoke + * callbacks - including the GPC. This test expects and checks + * that the GPC was invoked with non-null principal and that + * auth was mandatory and that upon return from + * validateRequest, there are values set in + * HttpServletRequest.getRemoteUser() + * + * Description This is checking that the group callbacks work + * for case of being called with CPC when auth is required and + * the check that the validateRequest ensures there was a + * return value set for calls to + * HttpServletRequest.getRemoteUser() + * + */ + public void testGPCGetRemoteUser() throws Fault { + + String strChkServlet = "ModTestServlet->testGPCGetRemoteUser() passed"; + + String strMsg1 = "In HttpServlet : ServerRuntime GroupPrincipalCallbackSupport():"; + strMsg1 += " successfully called callbackHandler.handle(callbacks)"; + strMsg1 += " for servlet: /ModTestServlet"; + strMsg1 += " with isServletAuthMandatory = " + true; + + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see that GPC is supported and + // that the GetRemoteUser() is properly populated. + String str = invokeServletAndGetResponse(servletPath, "POST", + "testGPCGetRemoteUser"); + + // First, lets make sure CBH's were actually called + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("testGPCGetRemoteUser : FAILED"); + } + + // next, lets make sure CBH's set principal values as expected + if (!str.contains(strChkServlet)) { + String msg = "testGPCGetRemoteUser did not have proper credential values returned in "; + msg += servletPath + + ". this could be due to CBH's not properly doing authentication."; + TestUtil.logMsg(msg); + throw new Fault("testGPCGetRemoteUser : FAILED"); + } + + TestUtil.logMsg("testGPCGetRemoteUser : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testGPCGetUserPrincipal + * + * @assertion_ids: JASPIC:SPEC:90; + * @test_Strategy: The ModTestServlet is called which forces our SAM to invoke + * callbacks - including the GPC. This test expects and checks + * that the GPC was invoked with non-null principal and that + * auth was mandatory and that upon return from + * validateRequest, there are values set in + * HttpServletRequest.getUserPrincipal() + * + * Description This is checking that the group callbacks work + * for case of being called with CPC when auth is required and + * the check that the validateRequest ensures there was a + * return value set for calls to + * HttpServletRequest.getUserPrincipal() + * + */ + public void testGPCGetUserPrincipal() throws Fault { + + String strChkServlet = "ModTestServlet->testGPCGetUserPrincipal() passed"; + + String strMsg1 = "In HttpServlet : ServerRuntime GroupPrincipalCallbackSupport():"; + strMsg1 += " successfully called callbackHandler.handle(callbacks)"; + strMsg1 += " for servlet: /ModTestServlet"; + strMsg1 += " with isServletAuthMandatory = " + true; + + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see that GPC is supported and + // that the GetUserPrincipal() is properly populated. + String str = invokeServletAndGetResponse(servletPath, "POST", + "testGPCGetUserPrincipal"); + + // First, lets make sure CBH's were actually called + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("testGPCGetUserPrincipal : FAILED"); + } + + // next, lets make sure CBH's set principal values as expected + if (!str.contains(strChkServlet)) { + String msg = "testGPCGetUserPrincipal did not have proper credential values returned in "; + msg += servletPath + + ". this could be due to CBH's not properly doing authentication."; + TestUtil.logMsg(msg); + throw new Fault("testGPCGetUserPrincipal : FAILED"); + } + + TestUtil.logMsg("testGPCGetUserPrincipal : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testGPCGetAuthType + * + * @assertion_ids: JASPIC:SPEC:90; + * @test_Strategy: The ModTestServlet is called which forces our SAM to invoke + * callbacks - including the GPC. This test expects and checks + * that the GPC was invoked with non-null principal and that + * auth was mandatory and that upon return from + * validateRequest, there are values set in + * HttpServletRequest.getAuthType() + * + * Description This is checking that the group callbacks work + * for case of being called with CPC when auth is required and + * the check that the validateRequest ensures there was a + * return value set for calls to + * HttpServletRequest.getAuthType() + * + */ + public void testGPCGetAuthType() throws Fault { + + String strChkServlet = "ModTestServlet->testGPCGetAuthType() passed"; + + String strMsg1 = "In HttpServlet : ServerRuntime GroupPrincipalCallbackSupport():"; + strMsg1 += " successfully called callbackHandler.handle(callbacks)"; + strMsg1 += " for servlet: /ModTestServlet"; + strMsg1 += " with isServletAuthMandatory = " + true; + + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see that GPC is supported and + // that the GetAuthType() is properly populated. + String str = invokeServletAndGetResponse(servletPath, "POST", + "testGPCGetAuthType"); + + // First, lets make sure CBH's were actually called + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("testGPCGetAuthType : FAILED"); + } + + // next, lets make sure CBH's set principal values as expected + TestUtil.logMsg("searching string: " + strChkServlet); + TestUtil.logMsg("searching in: " + str); + + if (!str.contains(strChkServlet)) { + String msg = "testGPCGetAuthType did not have proper credential values returned in "; + msg += servletPath + + ". this could be due to CBH's not properly doing authentication."; + TestUtil.logMsg(msg); + throw new Fault("testGPCGetAuthType : FAILED"); + } + + TestUtil.logMsg("testGPCGetAuthType : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckAuthenInValidateRequest + * + * @assertion_ids: JASPIC:SPEC:90; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify if the validateRequest() was called under the + * scenario of already being logged in. If we are already + * logged in, then there are (3) HttpServletRequest methods + * that must return non-null values:` - getAuthType() - + * getRemoteUser() - getUserPrincipal() + * + * Description The TSSVLog.txt file looking for string that + * indicates we found a scenario with only some of the + * forementioned methods returned non-null. If a user is + * authenticated, they should return non-null values. If the + * user is NON authenticated, these methods should return + * null. + * + */ + public void CheckAuthenInValidateRequest() throws Fault { + String strMsg1 = "validateRequest(): ERROR - invalid authen scenario."; + String tempArgs[] = { strMsg1 }; + + // by invoking this servlet, we are causing code to access our + // servlet profile TSServerAuthModule.validateRequest() method + // which will perform checks to see which CBH's are supported. + invokeServlet(servletPath, "POST", "CheckAuthenInValidateRequest"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (verified) { + // we found an error statement + throw new Fault("CheckAuthenInValidateRequest : FAILED"); + } + + TestUtil.logMsg("CheckAuthenInValidateRequest : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testAuthenResultsOnHttpServlet + * + * @assertion_ids: JASPIC:SPEC:90; JASPIC:SPEC:322; + * + * @test_Strategy: When authentication is mandatory, after AuthStatus.SUCCESS + * is returned from validateRequest, we should be able to + * verify that HttpServletRequest has non-null values set for + * the following (3) method calls: request.getAuthType() + * request.getRemoteUser() request.getUserPrincipal() + * + * This is based on javadoc for HttpServletRequest as well as + * on jsr-196 v1.1 spec section 3.8.1.3 and 3.8.4. + * + */ + public void testAuthenResultsOnHttpServlet() throws Fault { + String strMsg1 = "ModTestServlet->testAuthenResultsOnHttpServlet() passed"; + + String str = invokeServletAndGetResponse(servletPath, "POST", + "testAuthenResultsOnHttpServlet"); + TestUtil.logMsg("testAuthenResultsOnHttpServlet : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("testAuthenResultsOnHttpServlet : FAILED"); + } + + TestUtil.logMsg("testAuthenResultsOnHttpServlet : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testRemoteUserCorrespondsToPrin + * + * @assertion_ids: JASPIC:SPEC:321; + * + * @test_Strategy: When authentication is mandatory, after AuthStatus.SUCCESS + * is returned from validateRequest, we should be able to + * verify that (a) HttpServletRequest has non-null values set + * for the following methods: request.getRemoteUser() and + * request.getUserPrincipal() (b) that getRemoteUser() and + * getUserPrincipal().getName() are equal. + * + * This is based on javadoc for HttpServletRequest as well as + * on jsr-196 v1.1 spec section 3.8.4. Specifically, this is + * validating that: "In both cases, the HttpServletRequest + * must be modified as necessary to ensure that the Principal + * returned by getUserPrincipal and the String returned by + * getRemoteUser correspond, ..." Using the above spec + * reference COMBINED with the following Servlet spec + * reference, we see that: + * + * (Using Servlet spec v3.1, section 13.3 - it states: "The + * getRemoteUser method returns the name of the remote user" + * AND "Calling the getName() method on the Principal returned + * by getUserPrincipal() returns the name of the remote user." + * We can use these two Servlet spec references combined with + * our JASPIC reference to validate that principal.getName() + * equals (i.e. "corresponds") to the same value returned by + * getRemoteUser(). + * + */ + public void testRemoteUserCorrespondsToPrin() throws Fault { + String strMsg1 = "ModTestServlet->testRemoteUserCorrespondsToPrin() passed"; + + String str = invokeServletAndGetResponse(servletPath, "POST", + "testRemoteUserCorrespondsToPrin"); + + TestUtil.logMsg("testRemoteUserCorrespondsToPrin : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("testRemoteUserCorrespondsToPrin : FAILED"); + } + + TestUtil.logMsg("testRemoteUserCorrespondsToPrin : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testAuthenIsUserInRole + * + * @assertion_ids: JASPIC:SPEC:321; + * + * @test_Strategy: When authentication is mandatory, after AuthStatus.SUCCESS + * is returned from validateRequest, we should be able to + * verify that HttpServletRequest has non-null values set for + * the following method call: request.isUserInRole() + * + * This is based on javadoc for HttpServletRequest as well as + * on jsr-196 v1.1 spec section 3.8.1.3 and 3.8.4. There is no + * direct spec reference, but it is a scenario that can be + * inferred. + */ + public void testAuthenIsUserInRole() throws Fault { + String strMsg1 = "ModTestServlet->testAuthenIsUserInRole() passed"; + + String str = invokeServletAndGetResponse(servletPath, "POST", + "testAuthenIsUserInRole"); + + TestUtil.logMsg("testAuthenIsUserInRole : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("testAuthenIsUserInRole : FAILED"); + } + + TestUtil.logMsg("testAuthenIsUserInRole : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: testAuthenAfterLogout + * + * @assertion_ids: JASPIC:SPEC:98; + * + * @test_Strategy: When authentication is mandatory, after AuthStatus.SUCCESS + * is returned from validateRequest, we should be able to + * verify that we can properly login and invoke callback + * handlers. + * + * This test ensures that we can authN when we are not already + * pre-logged in. This will call a servlet that is open to + * all, (thus no security constraints) and it will invoke the + * servlet logout() command. Then it will make a call to a + * servlet which requires mandatory authentication. The + * premise being that authentication does occur - especially + * if not pre-logged in. + * + * Note the spec does not state that you can not be pre-logged + * in but it is saying that authentication has to be able to + * succeed in a particular manner. (see spec section 3.8.3.1) + * + */ + public void testAuthenAfterLogout() throws Fault { + String strMsg1 = "ModTestServlet->testAuthenAfterLogout() passed"; + + // call a servlet that is open to all and requires NO authN to access + // validate we were not pre-authenticated and if so, force logout + String str = invokeServletAndGetResponse(allAccessServletPath, "POST", + "TestAuthenAfterLogout"); + + // now make a call to a servlet that requires mandatory authN and + // make sure we still successfully support callbacks + str = invokeServletAndGetResponse(servletPath, "POST", + "testAuthenAfterLogout"); + + TestUtil.logMsg("testAuthenAfterLogout : str = " + str); + int ii = str.indexOf(strMsg1); + if (ii < 0) { + throw new Fault("testAuthenAfterLogout : FAILED"); + } + + // next make sure we see our CPC being properly called. + String strMsg2 = "In HttpServlet : ServerRuntime CallerPrincipalCallback"; + strMsg2 += " called for profile=HttpServlet for servletPath=" + servletPath; + String strMsg3 = "Validated we are not prelogged in for OpenToAllServlet"; + String tempArg1[] = { strMsg2, strMsg3 }; + + TestUtil.logMsg("validating CPC worked and logfile contains: " + strMsg2); + TestUtil.logMsg( + "validating we were not prelogged in and that logfile contains: " + + strMsg3); + boolean verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("testAuthenAfterLogout : FAILED"); + } + + TestUtil.logMsg("testAuthenAfterLogout : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: verifyRuntimeCallOrder + * + * @assertion_ids: JASPIC:SPEC:317; JASPIC:SPEC:304; + * + * @test_Strategy: This test verifies that the runtime is invoking the proper + * calling order of: validateRequest, process request, + * secureResponse. + * + * Details After AuthStatus.SUCCESS is returned from + * validateRequest, we need to verify that the request was + * dispatched, and then that the secureResponse() was called - + * in that order. We do this by verifying that the messages + * (i.e. strMsg1, strMsg2, and strMsg3) were called in the + * specific order. The verifyLogContains() method checks these + * strings exist within the TSSVLog.txt file AND that they + * exist within the log file in order that matches the way + * they are declared via "theArgs[]". + * + */ + public void verifyRuntimeCallOrder() throws Fault { + + // strings that MUST exist within the TSSVLog.txt file + String strMsg1 = "TSServerAuthContext.validateRequest called for layer=HttpServlet for requestURI=" + + wrapperServletPath; + String strMsg2 = "WrapperServlet.doTests() content processed for requestURI"; + String strMsg3 = "secureResponse called for layer=HttpServlet for requestURI=" + + wrapperServletPath; + String theArgs[] = { strMsg1, strMsg2, strMsg3 }; + + TestUtil.logMsg("Enterred verifyRuntimesCallOrder()"); + + String str = invokeServletAndGetResponse(wrapperServletPath, "POST", + "testRequestWrapper"); + TestUtil.logMsg("TestRequestWrapper response msg = " + str); + + boolean verified = logProcessor.verifyLogContains(theArgs, true); + if (!verified) { + throw new Fault("verifyRuntimesCallOrder : FAILED"); + } + + TestUtil.logMsg("verifyRuntimesCallOrder : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifyNoInvalidEntries + * + * @assertion_ids: JASPIC:SPEC:52; JASPIC:SPEC:96; JASPIC:SPEC:53; + * JASPIC:SPEC:87; JASPIC:SPEC:313; JASPIC:SPEC:60; + * JASPIC:JAVADOC:106; JASPIC:SPEC:322; JASPIC:SPEC:323; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Invoke a series of web pages with varying servlet perms + * and access/connection scenarios. + * + * 3. Use FetchLog servlet to read the server side log to + * verify no invalid scenarios were encountered. + * + * + * Description This is a negative test case that is used to + * assist in verifying several different assertions. The + * intention of this test is to make sure accessing web + * resources under different circumstances should NOT cause + * any invalid issues to be encountered. + * + */ + public void VerifyNoInvalidEntries() throws Fault { + + // try to invoke diff servlet pages to see if this + // causes an invalid condition to occur + invokeServlet(staticPagePath, "POST", "VerifyNoInvalidEntries"); + invokeServlet(noConstraintPath, "POST", "VerifyNoInvalidEntries"); + invokeServlet(servletPath, "POST", "VerifyNoInvalidEntries"); + + // now check log file lookign for invalid entries + doCommonVerificationChecks(); + + TestUtil.logMsg("VerifyNoInvalidEntries : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifyClientSubjects + * + * @assertion_ids: JASPIC:SPEC:96; JASPIC:SPEC:52; JASPIC:JAVADOC:28; + * JASPIC:JAVADOC:106; JASPIC:SPEC:23; JASPIC:SPEC:19; + * JASPIC:SPEC:51; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether the ClientSubject passed to validateRequest + * was null or not. + * + * Description According to spec section 3.8.2: A new + * clientSubject must be instantiated and passed in the call + * to validateRequest. + * + */ + public void VerifyClientSubjects() throws Fault { + String strMsg1 = "HttpServlet profile: "; + strMsg1 += "TSServerAuthContext.validateRequest called with non-null client Subject"; + String tempArgs[] = { strMsg1 }; + + invokeServlet(servletPath, "POST", "VerifyClientSubjects"); + + // first, verify we have a non-null clientSubject + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("VerifyClientSubjects : FAILED"); + } + + // now verify we have no occurances of null clientSubjects + checkForInvalidClientSubjects(); + + TestUtil.logMsg("VerifyClientSubjects : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckMessageInfo + * + * @assertion_ids: JASPIC:SPEC:95; JASPIC:JAVADOC:28; JASPIC:JAVADOC:10; + * JASPIC:JAVADOC:11; JASPIC:SPEC:23; JASPIC:SPEC:19; + * JASPIC:SPEC:69; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the messageInfo passed to validateRequest() + * contains proper values for getRequestMessage() and + * getResponseMessage(). + * + * Description The MessageInfo argument used in any call made + * by the message processing runtime to validateRequest must + * have been initialized such that the non-null objects + * returned by the getRequestMessage and getResponseMessage + * methods of the MessageInfo are an instanceof + * HttpServletRequest and HttpServletResponse. + * + */ + public void CheckMessageInfo() throws Fault { + String strMsg1 = "validateRequest: MessageInfo.getRequestMessage() is of type "; + String strMsg2 = "validateRequest: MessageInfo.getResponseMessage() is of type "; + String tempArgs[] = { strMsg1 + "jakarta.servlet.http.HttpServletRequest", + strMsg2 + "jakarta.servlet.http.HttpServletResponse" }; + + // this should work for servlets and static pages + // invoking a static should cause the validateRequest to be called + invokeServlet(staticPagePath, "POST", "CheckMessageInfo"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("CheckMessageInfo : FAILED"); + } + + TestUtil.logMsg("CheckMessageInfo : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifyReqPolicy + * + * @assertion_ids: JASPIC:SPEC:87; JASPIC:JAVADOC:107; JASPIC:JAVADOC:17; + * JASPIC:JAVADOC:14; JASPIC:JAVADOC:21 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify we have more than 1 target policy AND that + * ProtectionPolicy.getID() returns a proper value. + * + * + * Description Calling getTargetPolicies on the request + * MessagePolicy must return an array containing at least one + * TargetPolicy whose ProtectionPolicy will be interpreted by + * the modules of the context to mean that the source of the + * corresponding targets within the message is to be + * authenticated. To that end, calling the getID method on the + * ProtectionPolicy must return one of the following values: + * ProtectionPolicy.AUTHENTICATE_SENDER, + * ProtectionPolicy.AUTHENTICATE_CONTENT + * + */ + public void VerifyReqPolicy() throws Fault { + + // first make sure we have an array with more than 1 TargetPolicy + invokeServlet(servletPath, "POST", "VerifyReqPolicy"); + checkForInvalidReqPolicy(); + + // next, make sure ProtectionPolicy.getID() returns valid value + checkForInvalidProtectionPolicyID(); + + TestUtil.logMsg("VerifyReqPolicy : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: checkSACValidateRequestWithVaryingAccess + * + * @assertion_ids: JASPIC:SPEC:89; JASPIC:JAVADOC:28 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify ServerAuthContext.validateRequest() is called for + * our servlet container even when no access will be granted. + * + * Description This will test that the message processing + * runtime must call validateRequest independent of whether or + * not access to the resource would have been permitted prior + * to the call to validateRequest. Note: This particular + * assertion actually only applies to the case of acceptable + * connections that have been negotiated and will not be + * required for cases where the WebUserDataPermission objects + * allow a container to determine when to reject a request + * befor redirection of that request would ultimately be + * rejected as a result of an excluding auth-constraint. (an + * excluding auth-constraint is an auth-constraint that has no + * roles. (see JSR-115 spec, section 3.1.3.1, footnote 1) + */ + public void checkSACValidateRequestWithVaryingAccess() throws Fault { + String HDR = "TSServerAuthContext.validateRequest called for layer=HttpServlet"; + String FTR = " AuthStatus=AuthStatus.SUCCESS"; + String strMsg1 = HDR + " for requestURI=" + noConstraintPath + FTR; + String tempArg1[] = { strMsg1 }; + String strMsg2 = HDR + " for requestURI=" + servletPath + FTR; + String tempArg2[] = { strMsg2 }; + + // invoking a servlet should cause the validateRequest to be called + // and here we are invoking a url that has no auth-constraints + invokeServlet(noConstraintPath, "POST", + "checkSACValidateRequestWithVaryingAccess"); + + boolean verified = logProcessor.verifyLogContains(tempArg1); + if (!verified) { + throw new Fault("checkSACValidateRequestWithVaryingAccess : FAILED"); + } + + // invoking a servlet should cause the validateRequest to be called + // and here we are invoking a url that has auth-constraints + invokeServlet(servletPath, "POST", + "checkSACValidateRequestWithVaryingAccess"); + verified = logProcessor.verifyLogContains(tempArg2); + if (!verified) { + throw new Fault("checkSACValidateRequestWithVaryingAccess : FAILED"); + } + + TestUtil.logMsg("checkSACValidateRequestWithVaryingAccess : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifyMessageInfoObjects + * + * @assertion_ids: JASPIC:SPEC:60; JASPIC:JAVADOC:27; JASPIC:JAVADOC:28; + * JASPIC:SPEC:305; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Invoke a servlet to cause a validateRequest invocation, + * (make sure it is a servlet that has Authen Permissions + * enabled so that we can return AuthStatus.SUCCESS from + * validateRequest() so that we can be sure to enter into + * secureResponse(). Once in secureResponse, we want to + * validate the MessageInfo object is the same as the + * MessageInfo object passed into the validateRequest() + * + * Description Verify that the MessageInfo object passed into + * the validateRequest() method is the same MessageInfo object + * that is passed into secureResponse(). + * + * + */ + public void VerifyMessageInfoObjects() throws Fault { + String strMsg1 = "MessageInfo object from secureRequest matches "; + strMsg1 += "the messageInfo object from validateRequest"; + String tempArgs[] = { strMsg1 }; + + // invoking this servlet should cause the validateRequest and + // the secureResponse to be called. + String theContext = contextPath + "/" + JASPICData.AUTHSTAT_MAND_SUCCESS; + invokeServlet(theContext, "POST", "VerifyMessageInfoObjects"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("VerifyMessageInfoObjects : FAILED"); + } + + TestUtil.logMsg("VerifyMessageInfoObjects : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifyServiceSubjects + * + * @assertion_ids: JASPIC:SPEC:53; JASPIC:SPEC:61; JASPIC:SPEC:314; + * JASPIC:SPEC:313; JASPIC:JAVADOC:27; JASPIC:JAVADOC:28; + * JASPIC:SPEC:24 + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Invoke a servlet to cause a validateRequest invocation, + * then Use FetchLog servlet to read the server side log to + * verify we have no valid service subject messages. + * + * Description Verify that If a non-null Subject was used to + * acquire the ServerAuthContext, the same Subject must be + * passed as the serviceSubject in this call (ie to Point 2 in + * MPR model). + * + */ + public void VerifyServiceSubjects() throws Fault { + + // ideally we'd like to find a platform independant way to + // also verify that we have valid (non-null) serviceSubjects + // but I don't believe this is possible so for now, we will + // be content to verify no invalid serviceSubjects were found + + // invoking a servlet should cause the validateRequest to be called + // but does not guarantee a non-null serviceSubject + invokeServlet(servletPath, "POST", "VerifyServiceSubjects"); + + // currently we verify that there were no invalid serviceSubject + checkForInvalidServiceSubjects(); + + TestUtil.logMsg("VerifyServiceSubjects : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: VerifySAContextVerifyReqIsCalled + * + * @assertion_ids: JASPIC:SPEC:88; JASPIC:SPEC:50; JASPIC:JAVADOC:28 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify ServerAuthContext.validateRequest() is called for + * our servlet container. + * + * Description The inbound processing of requests by a servlet + * container corresponds to point (2) in the message + * processing model. At point (2) in the message processing + * model, the runtime must call validateRequest on the + * ServerAuthContext. + * + */ + public void VerifySAContextVerifyReqIsCalled() throws Fault { + String strMsg1 = "TSServerAuthContext.validateRequest called for layer=HttpServlet"; + String tempArgs[] = { strMsg1 }; + + // invoking a servlet should cause the validateRequest to be called + invokeServlet(servletPath, "POST", "VerifySAContextVerifyReqIsCalled"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault("VerifySAContextVerifyReqIsCalled : FAILED"); + } + + TestUtil.logMsg("VerifySAContextVerifyReqIsCalled : PASSED"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: CheckMsgInfoKey + * + * @assertion_ids: JASPIC:SPEC:306; JASPIC:SPEC:300; JASPIC:JAVADOC:73; + * JASPIC:SPEC:92; JASPIC:SPEC:24; JASPIC:SPEC:103; + * + * + * @test_Strategy: 1. invoke servlet that requires authentication 2. verify + * that the MesageInfo object passed into getAuthContextID, + * validateRequest, and secureResponse all had valid key-value + * pairs. + * + * Description: This profile requires that the message + * processing runtime conditionally establish the following + * key-value pair within the Map of the MessageInfo object + * passed in the calls to getAuthContextID, validateRequest, + * and secureResponse. (key) + * jakarta.security.auth.message.MessagePolicy.isMandatory (val) + * Any non-null String value, s, for which + * Boolean.valueOf(s).booleanValue() == true. The MessageInfo + * map must contain this key and its associated value, if and + * only if authentication is required to perform the resource + * access corresponding to the HttpServletRequest to which the + * ServerAuthContext will be applied. + * + * If we are 115 compatible, there is an additional test we + * must make. The key=jakarta.security.jacc.PolicyContext better + * exist in the Properties arg passed into getAuthContext(). + * + */ + public void CheckMsgInfoKey() throws Fault { + String CMN_HDR = "dumpServletProfileKeys() called with attrs: layer=HttpServlet"; + CMN_HDR += " servletName=/ModTestServlet callerMethod="; + + String CMN_TAIL = " key=jakarta.security.auth.message.MessagePolicy.isMandatory"; + CMN_TAIL += " value=Valid"; + + String strAuthCtxt = CMN_HDR + "getAuthContextID" + CMN_TAIL; + String strValReq = CMN_HDR + "validateRequest" + CMN_TAIL; + + // String tempArgs[] = { strAuthCtxt, strValReq, strSecResp }; + String tempArgs[] = { strAuthCtxt, strValReq }; + + // see if we can successfully call into the servlet! + invokeServlet(servletPath, "POST", "CheckMsgInfoKey"); + boolean bVerified = logProcessor.verifyLogContains(tempArgs); + + if (!bVerified) { + throw new Fault("CheckMsgInfoKey : FAILED"); + } + + // + // ONLY if we are 115 compatible, we want to make an additional key test + // + if (bIs115Compatible) { + String HDR = "layer=HttpServlet appContext=" + appContext; + String str1 = HDR + + " Key=jakarta.security.jacc.PolicyContext does exist thus 115 compatible"; + String arg1[] = { str1 }; + + invokeServlet(servletPath, "POST", "CheckMsgInfoKey"); + + // verify whether the log contains required messages. + bVerified = logProcessor.verifyLogContains(arg1); + + if (!bVerified) { + throw new Fault("CheckMsgInfoKey : FAILED"); + } + } else { + // not 115 compat so the identity must include the caller Principal + // (established during the validateRequest processing using the + // corresponding CallerPrincipalCallback) + // note: by testing the subject=non-null, we are actually verifying that + // assertion JASPIC:SPEC:103 is met (e.g. non-null clientSubject used in + // CPC) + String strMsg1 = "In HttpServlet : ServerRuntime CallerPrincipalCallback"; + strMsg1 += " called for profile=HttpServlet for servletPath=" + + servletPath; + strMsg1 += " subject=non-null principal set = j2ee"; + String tempArg1[] = { strMsg1 }; + bVerified = logProcessor.verifyLogContains(tempArg1); + if (!bVerified) { + throw new Fault("CheckMsgInfoKey : FAILED"); + } + } + + TestUtil.logMsg("CheckMsgInfoKey : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckServletAppContext + * + * @assertion_ids: JASPIC:SPEC:67; JASPIC:SPEC:68; JASPIC:JAVADOC:84; + * JASPIC:JAVADOC:85; + * + * @test_Strategy: 1. Verify TSAuthConfigProviderServlet was registered with + * layer="HttpServlet" and that TSServerAuthConfig was invoked + * with this layer value also to satisfy assertion 67. + * + * 2. our ProviderConfiguration should have registered a + * provider for us AND doing that should have caused the MPR + * to use the same appContextId for the ACP and + * ServerAuthConfig. We will check that both were invoked with + * the same/expected appContextId to satisfy assertion 68. + * + * Description: This test will verify that the MPR uses the + * same appContextId for both the AuthConfigProvider and the + * ServerAuthConfig. + * + */ + public void CheckServletAppContext() throws Fault { + String MNAME = "CheckServletAppContext : "; + String layer = "HttpServlet"; + // String appContext = "localhost " + contextPath; + String acfMsg = "getConfigProvider called for Layer : " + layer + + " and AppContext :" + appContext; + String sacMsg = "TSServerAuthConfig called for layer=" + layer + + " : appContext=" + appContext; + + // verify TSAuthConfigProviderServlet was registered properly + String tempArgs[] = { acfMsg }; + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + TestUtil.logMsg(MNAME + + "Can't verify TSAuthConfigProviderServlet registered properly"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + acfMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + + "Verified TSAuthConfigProviderServlet was registered properly"); + } + + // verify MPR used same appContextId for the ACP and ServerAuthConfig + String tempArgs2[] = { sacMsg }; + verified = logProcessor.verifyLogContains(tempArgs2); + if (!verified) { + TestUtil.logMsg(MNAME + + "Can't verify MPR used same appContextId for the ACP and SAC"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + sacMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg( + MNAME + "Verified MPR used same appContextId for the ACP and SAC."); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckACPConfigObjAppContext + * + * @assertion_ids: JASPIC:SPEC:74; JASPIC:SPEC:75; JASPIC:SPEC:11; + * JASPIC:SPEC:13; JASPIC:JAVADOC:94 + * + * @test_Strategy: 1. Verify that a non-null provider was returned during our + * registration of TSAuthConfigProviderServlet and that by + * fact that non-null provider was returned, we need to verify + * that the MPR called getServerAuthConfig for that provider. + * All these verifications need to be done for the + * corresponding layer and appContextId values. (this satisfys + * assertion 75) + * + * 2. Verify the MPR called getConfigProvider for the layer + * and appContextId in order to satisfy assertion 74) + * + * Description: This test will verify that the ACP was + * properly registered and that the MPR was able to + * successfully use getConfigPRovider. + * + */ + public void CheckACPConfigObjAppContext() throws Fault { + String MNAME = "CheckACPConfigObjAppContext : "; + String layer = "HttpServlet"; + String sacMsg = "TSAuthConfigProviderServlet.getServerAuthConfig" + + " : layer=" + layer + " : appContext=" + appContext; + + // make sure everything we need is properly setup + invokeServlet(servletPath, "POST", "CheckACPConfigObjAppContext"); + + // Verify non-null provider returned during registration + String tempArgs[] = { ACF_MSG_1 }; + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + TestUtil.logMsg(MNAME + "Can't verify non-null provider returned"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + ACF_MSG_1); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "non-null provider returned"); + } + + // verify MPR called getConfigProvider for the layer and appContextId + String tempArgs2[] = { sacMsg }; + verified = logProcessor.verifyLogContains(tempArgs2); + if (!verified) { + TestUtil.logMsg(MNAME + "Can't verify MPR called getConfigProvider"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + sacMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "MPR called getConfigProvider"); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckACPContextObjAppContext + * + * @assertion_ids: JASPIC:SPEC:74; JASPIC:SPEC:75; JASPIC:SPEC:77 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify the following: - verify non-null ACP is returned by + * ACF - verify same info used to initialize ACP was also used + * to initialize the ServerAuthConfig (SAC) for this provider. + * - verify same info used in ACP and SAC was also used to + * init the auth context. + * + * Description: This test verifies that AuthConfigFactory + * returns a non-null ACP and that the same info is used to + * init the ACP, SAC, and the ServerAuthContext. + * + */ + public void CheckACPContextObjAppContext() throws Fault { + String MNAME = "CheckACPContextObjAppContext : "; + String layer = "HttpServlet"; + String sacMsg = "TSServerAuthConfig called for layer=" + layer + + " : appContext=" + appContext; + + String saConfigMsg = "TSServerAuthContext called for messageLayer=" + layer + + " : appContext=" + appContext; + + // make sure everything we need is properly setup + invokeServlet(servletPath, "POST", "CheckACPContextObjAppContext"); + + // verify non-null ACP is returned by ACF + String tempArgs1[] = { ACF_MSG_1 }; + boolean verified = logProcessor.verifyLogContains(tempArgs1); + if (!verified) { + TestUtil + .logMsg("Could not verify that a non-null ACP was returned by ACF"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + ACF_MSG_1); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "Verified non-null ACP returned by ACF"); + } + + // verify same info used to initialize ACP was also used to init SAC + String tempArgs2[] = { sacMsg }; + verified = logProcessor.verifyLogContains(tempArgs2); + if (!verified) { + TestUtil.logMsg( + MNAME + "Can't verify same context info was used to init SAC."); + TestUtil.logMsg(MNAME + "Could not successfully find: " + sacMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "same context info was used to init SAC."); + } + + // verify same info used in ACP and SAC was also used to init auth context + String tempArgs3[] = { saConfigMsg }; + verified = logProcessor.verifyLogContains(tempArgs3); + if (!verified) { + TestUtil.logMsg(MNAME + + "Could not verify same context info used to init auth context."); + TestUtil.logMsg(MNAME + "Could not successfully find: " + saConfigMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "Same context info used to init auth context."); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckMPRCallsGetAuthContext + * + * @assertion_ids: JASPIC:SPEC:74; JASPIC:SPEC:78; JASPIC:JAVADOC:100 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify the following: - verify non-null ACP is returned by + * ACF - verify ServerAuthConfig.getAuthContext() is called by + * MPR + * + * Description: This test is used to test that the MPR + * properly called ServerAuthConfig.getAuthContext(). This + * will also perform an additional test of verifying a + * non-null ACP is returned by ACF. + * + */ + public void CheckMPRCallsGetAuthContext() throws Fault { + String MNAME = "CheckMPRCallsGetAuthContext : "; + String layer = "HttpServlet"; + String saConfigMsg = "TSServerAuthConfig.getAuthContext: layer=" + layer + + " : appContext=" + appContext; + + // make sure everything we need is properly setup + invokeServlet(servletPath, "POST", "CheckMPRCallsGetAuthContext"); + + // verify non-null ACP is returned by ACF + String tempArgs[] = { ACF_MSG_1 }; + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + TestUtil.logMsg(MNAME + "Can't verify non-null ACP returned by ACF"); + TestUtil.logMsg(MNAME + "Could not successfully find: " + ACF_MSG_1); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "Verified non-null ACP is returned by ACF"); + } + + // verify TSServerAuthConfig.getAuthContext() is called by MPR + String tempArgs2[] = { saConfigMsg }; + verified = logProcessor.verifyLogContains(tempArgs2); + if (!verified) { + TestUtil.logMsg(MNAME + "Can't verify getAuthContext() called by MPR."); + TestUtil.logMsg(MNAME + "Could not successfully find: " + saConfigMsg); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil + .logMsg(MNAME + "TSServerAuthConfig.getAuthContext() called by MPR"); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckforNonNullAuthContext + * + * @assertion_ids: JASPIC:SPEC:79; JASPIC:JAVADOC:100 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify the following: - verify there were no null values + * returned for all calls to getAuthContext() regardless of + * what operationId is. (this satisfies assertion 79) - verify + * we ARE seeing at least one successful value returned from + * our call to getAuthContext() to satisfy oursleves that the + * test really is working correctly as expected. + * + * Description: This test verifies that there were no null + * instances of ServerAuthContext objects AND we are also + * verifying that we' are getting at least one non-null + * ServerAuthContext instanace. + * + */ + public void CheckforNonNullAuthContext() throws Fault { + String MNAME = "CheckforNonNullAuthContext : "; + String str; + str = "TSServerAuthConfig.getAuthContext: returned null ServerAuthContext"; + String tempArgs[] = { str }; + + // this string should NOT/NEVER appear in the log file as + // the spec states: + // "For all values of the operation argument, the call to + // getAuthContext must return a non-null authentication context" + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (verified) { + TestUtil.logMsg(MNAME + "got back null ServerAuthContext"); + throw new Fault("CheckforNonNullAuthContext : FAILED"); + } else { + TestUtil.logMsg(MNAME + "got back valid ServerAuthContext"); + } + + // We know we should have gotten at least one successful (non-null) + // value from our call go getAuthContext so lets check to make sure. + str = "TSServerAuthConfig.getAuthContext: returned non-null ServerAuthContext"; + String tempArgs2[] = { str }; + verified = logProcessor.verifyLogContains(tempArgs2); + if (!verified) { + TestUtil.logMsg(MNAME + "got back null ServerAuthContext"); + throw new Fault(MNAME + "FAILED"); + } else { + TestUtil.logMsg(MNAME + "got back valid ServerAuthContext"); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: CheckforNonNullCallback + * + * @assertion_ids: JASPIC:SPEC:71 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify the following: - verify there was a non-null cbh + * passed into the + * TSAuthConfigProviderServlet.getServerAuthConfig() method. + * (spec section 3.5 says the cbh must not be null) + * + * Description: This test verifies that a non-null + * CakkbackHandler instance passed into the + * AuthConfigProvider.getServerAuthConfig(). + * + */ + public void CheckforNonNullCallback() throws Fault { + String MNAME = "CheckforNonNullCallback : "; + String strMsg1 = "layer=HttpServlet appContext=" + appContext; + strMsg1 += " getServerAuthConfig() received CallbackHandler=non-null"; + String tempArgs[] = { strMsg1 }; + + // make sure everything we need is properly setup + invokeServlet(servletPath, "POST", "CheckforNonNullCallback"); + + boolean verified = logProcessor.verifyLogContains(tempArgs); + if (!verified) { + throw new Fault(MNAME + "FAILED"); + } + + TestUtil.logMsg(MNAME + "PASSED"); + } + + /* + * This is convenience method that can be called anywhere and is intended to + * be used to make sure no unwanted log messages appear which would indicate a + * failure. To clarify, this means that a particular test case ~may~ cause + * some unexpected error to occur which would result in a log message getting + * dumped to the log file - even though we may not be testing that particular + * assertion at that given moment. This method can be used as a final pass at + * the end of each test to ensure that no accidental/unexpected errors were + * encountered. + * + */ + public void doCommonVerificationChecks() throws Fault { + + try { + // checks that should ALWAYS pass + checkForInvalidReqPolicy(); + checkForInvalidProtectionPolicyID(); + checkForInvalidServiceSubjects(); + checkForInvalidClientSubjects(); + checkForInvalidMessageInfoObjs(); + checkForNullCallback(); + checkForNullAuthConfigObj(); + checkForAuthenMisMatch(); + checkForinvalidMsgInfoMapKey(); + } catch (Fault ff) { + throw ff; + } + } + + /* + * This is used to verify assertion JASPIC:SPEC:323 which states in spec + * section 3.8.4 (para 2) + * + */ + public void checkForinvalidMsgInfoMapKey() throws Fault { + String strMsg1 = "ERROR - invalid setting for jakarta.servlet.http.authType = null"; + String strMsg2 = "ERROR - mismatch value set for jakarta.servlet.http.authType and getAuthType()"; + String tempArgs1[] = { strMsg1, strMsg2 }; + + // verify that we had NO mismatches between getAuthType() and + // getRemoteUser() + boolean verified = logProcessor.verifyLogContainsOneOf(tempArgs1); + if (verified) { + throw new Fault("checkForinvalidMsgInfoMapKey : FAILED"); + } + } + + /* + * This is used to verify assertion JASPIC:SPEC:322 which states in spec + * section 3.8.4 (para 1) "Both cases, must also ensure that the value + * returned by calling getAuthType on the HttpServletRequest is consistent in + * terms of being null or non-null with the value returned by + * getUserPrincipal." + * + */ + public void checkForAuthenMisMatch() throws Fault { + String strMsg1 = "ERROR - HttpServletRequest authentication result mis-match with getAuthType() and getRemoteUser()"; + String tempArgs1[] = { strMsg1 }; + + // verify that we had NO mismatches between getAuthType() and + // getRemoteUser() + boolean verified = logProcessor.verifyLogContains(tempArgs1); + if (verified) { + throw new Fault("checkForAuthenMisMatch : FAILED"); + } + } + + /* + * This is used to verify assertion JASPIC:SPEC:16 which states that the + * AuthConfigProvider must NOT return a null auth config object (in the + * getServerAuthConfig() call) + */ + public void checkForNullAuthConfigObj() throws Fault { + String strMsg1 = "WARNING: getServerAuthConfig() returned null"; + String tempArgs1[] = { strMsg1 }; + + // verify that we had NO bad callbacks passed in + boolean verified = logProcessor.verifyLogContains(tempArgs1); + if (verified) { + throw new Fault("checkForNullAuthConfigObj : FAILED"); + } + } + + /* + * This is used to verify assertion JASPIC:SPEC:71 which states that the cbh + * passed into AuthConfigProvider.getServerAuthConfig() must NOT be null. (see + * spec section 3.5) + */ + public void checkForNullCallback() throws Fault { + String strMsg1 = "FAILURE: layer=HttpServlet appContext=" + appContext; + strMsg1 += " getServerAuthConfig() received CallbackHandler=null"; + String tempArgs1[] = { strMsg1 }; + + // verify that we had NO bad callbacks passed in + boolean verified = logProcessor.verifyLogContains(tempArgs1); + if (verified) { + throw new Fault("checkForNullCallback : FAILED"); + } + } + + /* + * This is used to verify assertion JASPIC:SPEC:60 which states that the + * runtime must pass the same MessageInfo instance (that was passed to + * validateRequest) into secureRequest. (see spec section 2.1.5.2) + */ + public void checkForInvalidMessageInfoObjs() throws Fault { + String strMsg1 = "FAILURE: MessageInfo object in secureRequest does not"; + strMsg1 += " match the messageInfo object from validateRequest"; + String tempArgs1[] = { strMsg1 }; + + boolean verified = logProcessor.verifyLogContains(tempArgs1); + if (verified) { + throw new Fault("checkForInvalidMessageInfoObjs : FAILED"); + } + + } + + /* + * This is used to verify assertion JASPIC:SPEC:52 and JASPIC:SPEC:96 which + * states that A new clientSubject must be instantiated and passed in the call + * to validateRequest. (see spec section 3.8.2) We look for occurances of + * strings that indicate we have a null clientSubject passed into our + * validateRequest and we issue a failure if a match is found. + */ + public void checkForInvalidClientSubjects() throws Fault { + String strMsg2 = "FAILURE detected - ClientSubjects should not be read-only."; + String strMsg3 = "FAILURE detected - ClientSubjects should not be null."; + String strMsg1 = "HttpServlet profile: "; + strMsg1 += "TSServerAuthContext.validateRequest called with null client Subject"; + String tempArgs1[] = { strMsg1, strMsg2, strMsg3 }; + + boolean verified = logProcessor.verifyLogContainsOneOf(tempArgs1); + if (verified) { + throw new Fault("checkForInvalidClientSubjects : FAILED"); + } + + } + + /* + * This is convenience method that helps verify assertions related to the + * validateRequest and secureResponse methods. This tests assertion + * JASPIC:SPEC:53 which states that for the Servlet profile, If a non-null + * Subject was used to acquire the ServerAuthContext, the same Subject must be + * passed as the serviceSubject in this call. + * + * This also tests assertion JASPIC:SPEC:313 which states that along with the + * above requirments if a non-null serviceSubject is used in this call, it + * must not be read-only. (see spec section 2.1.5.2). + * + * Also tested are assertions JASPIC:SPEC:61, JASPIC:SPEC:314 and + * JASPIC:SPEC:313. + * + * We look for occurances of strings that indicate we have a serviceSubject + * mismatch in our runtime - which we should not have. + */ + public void checkForInvalidServiceSubjects() throws Fault { + String strMsg1 = "FAILURE detected - ServiceSubjects should be the same and are not."; + String strMsg2 = "ServiceSubjects correctly matched."; + String strMsg3 = "found a non-null serviceSubject in getAuthContext()"; + String strMsg4 = "FAILURE detected - ServiceSubjects should not be read-only."; + String strMsg5 = "FAILURE detected - SecureResponse ServiceSubjects should be the same and are not."; + String strMsg6 = "FAILURE detected - SecureResponse ServiceSubjects should not be read-only."; + String tempArgs1[] = { strMsg1 }; + String tempArgs2[] = { strMsg2 }; + String tempArgs3[] = { strMsg3 }; + String tempArgs4[] = { strMsg4 }; + String tempArgs5[] = { strMsg5 }; // assertion: JASPIC:SPEC:61 and + // JASPIC:SPEC:314 + String tempArgs6[] = { strMsg6 }; // assertion: JASPIC:SPEC:313 + + boolean verified = logProcessor.verifyLogContainsOneOf(tempArgs1); + if (verified) { + TestUtil.logMsg(strMsg1); + throw new Fault("checkForInvalidServiceSubjects : FAILED"); + } + + verified = logProcessor.verifyLogContainsOneOf(tempArgs5); + if (verified) { + TestUtil.logMsg(strMsg5); + throw new Fault("checkForInvalidServiceSubjects : FAILED"); + } + + verified = logProcessor.verifyLogContainsOneOf(tempArgs6); + if (verified) { + TestUtil.logMsg(strMsg6); + throw new Fault("checkForInvalidServiceSubjects : FAILED"); + } + + verified = logProcessor.verifyLogContains(tempArgs3); + if (verified) { + // we know that there was a non-null subject passed into getAuthContext() + // so + // we better find strMsg2 in our log file too! + boolean bfound = logProcessor.verifyLogContains(tempArgs2); + if (!bfound) { + throw new Fault("checkForInvalidServiceSubjects : FAILED"); + } + + // if we made it to here, then we have matching serviceSubjects + // and we should NOT have a read-only service subject + verified = logProcessor.verifyLogContains(tempArgs4); + if (verified) { + throw new Fault("checkForInvalidServiceSubjects : FAILED"); + } + } + } + + /* + * This is convenience method that helps verify assertion JASPIC:SPEC:87 which + * states that for the Servlet profile, Calling the getID() method on the + * ProtectionPolicy must return a valid ID type (as defined in spec section + * 3.7.4). We look for a message that will be printed out if any calls to + * getID() returned an invalid ProtectionPolicy ID. + * + */ + public void checkForInvalidProtectionPolicyID() throws Fault { + String strMsg1 = "Layer=HttpServlet Invalid ProtectionPolicy.getID()"; + String tempArgs[] = { strMsg1 }; + + boolean verified = logProcessor.verifyLogContainsOneOf(tempArgs); + if (verified) { + throw new Fault("checkForInvalidProtectionPolicyID : FAILED"); + } + } + + /* + * This is convenience method that helps verify assertion JASPIC:SPEC:87 which + * states that for the Servlet profile, Calling getTargetPolicies on the + * request MessagePolicy must return an array containing at least one + * TargetPolicy. We look for a message that will be printed out if any calls + * to getTargetPolicies return an array with less than one TargetPolicy. + * + */ + public void checkForInvalidReqPolicy() throws Fault { + String strMsg1 = "Layer=HttpServlet requestPolicy=invalid"; + strMsg1 += " in TSServerAuthModule.initialize()"; + String tempArgs[] = { strMsg1 }; + + boolean verified = logProcessor.verifyLogContainsOneOf(tempArgs); + if (verified) { + throw new Fault("checkForInvalidReqPolicy : FAILED"); + } + } + + /* + * helper method to help us verify the various AuthStatus return vals. + * + */ + private void checkAuthStatus(String sContext, String statusType, + String requestMethod, boolean isDispatchingToSvc) { + + // add some servlet params onto our context + sContext = sContext + "?" + "log.file.location=" + logFileLocation; + sContext = sContext + "&" + "provider.configuration.file=" + + providerConfigFileLoc; + sContext = sContext + "&" + "vendor.authconfig.factory=" + vendorACF; + + TestUtil.logMsg("sContext = " + sContext); + TestUtil + .logMsg("passing to servlet: log.file.location = " + logFileLocation); + TestUtil.logMsg("passing to servlet: provider.configuration.file = " + + providerConfigFileLoc); + TestUtil.logMsg( + "passing to servlet: vendor.authconfig.factory = " + vendorACF); + + TSURL ctsurl = new TSURL(); + String url = ctsurl.getURLString("http", hostname, portnum, sContext); + String msg; + + try { + URL newURL = new URL(url); + + String authData = username + ":" + password; + TestUtil.logMsg("authData : " + authData); + + BASE64Encoder encoder = new BASE64Encoder(); + String encodedAuthData = encoder.encode(authData.getBytes()); + TestUtil.logMsg("encoded authData : " + encodedAuthData); + + // open URLConnection, set request props and actually connect + HttpURLConnection conn = (HttpURLConnection) newURL.openConnection(); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestProperty("Authorization", + "Basic " + encodedAuthData.trim()); + conn.setRequestMethod(requestMethod); // POST or GET etc + conn.connect(); + + TestUtil.logMsg("called HttpURLConnection.connect() for url: " + url); + int code = conn.getResponseCode(); + TestUtil.logMsg("Got response code of: " + code); + String responseMsg = conn.getResponseMessage(); + TestUtil.logMsg("Got response string of: " + responseMsg); + + if (responseMsg != null) { + if (statusType.equals("SEND_FAILURE")) { + // Spec section 3.8.3.2 + // for SEND_FAILURE, *if* there is a response sent back by the + // runtime, then the http status code must = 500 + if (code != 500) { + msg = "SEND_FAILURE returned Response with invalid HTTP status code"; + msg += " returned status code was " + code; + throw new Fault(msg + " : FAILED"); + } else { + TestUtil.logMsg("Got correct return status for SEND_FAILURE"); + } + } else if (statusType.equals("AuthException")) { + if ((code != 403) && (code != 404) && (code != 500)) { + msg = "AuthException returned Response with invalid HTTP status code"; + msg += " returned status code was " + code; + throw new Fault(msg + " : FAILED"); + } else { + TestUtil.logMsg("Got correct return status for AuthException"); + } + } + } + + // this section does checks for spec section 3.8.3.1 + if (isDispatchingToSvc) { + // this section does checks for spec section 3.8.3.1 + if ((statusType.equals("SEND_CONTINUE")) && (responseMsg != null)) { + // spec section 3.8.3.1 + // NOTE: our test must return SEND_CONTINUE befor calling the + // service invocation in order to expect these status codes + // If response, http status code must be: 401, 303, or 307 + if ((code != 401) || (code != 303) || (code != 307)) { + msg = "SEND_CONTINUE returned Response with invalid HTTP status code"; + msg += " returned status code was " + code; + throw new Fault(msg + " : FAILED"); + } else { + TestUtil.logMsg("Got correct return status for SEND_CONTINUE"); + } + } + } + + InputStream content = (InputStream) conn.getInputStream(); + BufferedReader in = new BufferedReader(new InputStreamReader(content)); + + try { + String line; + while ((line = in.readLine()) != null) { + TestUtil.logMsg(line); + } + } finally { + in.close(); + } + + } catch (Exception e) { + TestUtil.logMsg( + "Abnormal return status encountered while invoking " + sContext); + TestUtil.logMsg("Exception Message was: " + e.getMessage()); + // e.printStackTrace(); + } + + // lets force an update of our log file + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + TestUtil.logMsg("Leaving checkAuthStatus()"); + } + + /* + * Convenience method that will establish a url connections and perform a + * get/post request. A username and password will be passed in the request + * header and they will be encoded using the BASE64Encoder class. + */ + private int invokeServlet(String sContext, String requestMethod) { + + return invokeServlet(sContext, requestMethod, null); + } + + private int invokeServlet(String sContext, String requestMethod, String testMethod) { + int code = 200; + + TSURL ctsurl = new TSURL(); + if (!sContext.startsWith("/")) { + sContext = "/" + sContext; + } + + // lets set some other request params to be passed into servlet calls + sContext = sContext + "?" + "log.file.location=" + logFileLocation; + sContext = sContext + "&" + "provider.configuration.file=" + providerConfigFileLoc; + sContext = sContext + "&" + "vendor.authconfig.factory=" + vendorACF; + + TestUtil.logMsg("passing to servlet: log.file.location = " + logFileLocation); + TestUtil.logMsg("passing to servlet: provider.configuration.file = " + providerConfigFileLoc); + TestUtil.logMsg("passing to servlet: vendor.authconfig.factory = " + vendorACF); + + if (testMethod != null) { + sContext = sContext + "&" + "method.under.test=" + testMethod; + TestUtil.logMsg("passing to servlet: testMethod = " + testMethod); + } + + TestUtil.logMsg("sContext = " + sContext); + + String url = ctsurl.getURLString("http", hostname, portnum, sContext); + try { + URL newURL = new URL(url); + + // Encode authData + // hint: make sure username and password are valid for your + // (J2EE) security realm otherwise you recieve http 401 error. + String authData = username + ":" + password; + TestUtil.logMsg("authData : " + authData); + + BASE64Encoder encoder = new BASE64Encoder(); + + String encodedAuthData = encoder.encode(authData.getBytes()); + TestUtil.logMsg("encoded authData : " + encodedAuthData); + + // open URLConnection + HttpURLConnection conn = (HttpURLConnection) newURL.openConnection(); + + // set request property + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestProperty("Authorization", + "Basic " + encodedAuthData.trim()); + conn.setRequestMethod(requestMethod); // POST or GET etc + conn.connect(); + + TestUtil.logMsg("called HttpURLConnection.connect() for url: " + url); + code = conn.getResponseCode(); + TestUtil.logMsg("Got response code of: " + code); + String str = conn.getResponseMessage(); + TestUtil.logMsg("Got response string of: " + str); + + InputStream content = (InputStream) conn.getInputStream(); + BufferedReader in = new BufferedReader(new InputStreamReader(content)); + + try { + String line; + while ((line = in.readLine()) != null) { + TestUtil.logMsg(line); + } + } finally { + in.close(); + } + + } catch (Exception e) { + TestUtil.logMsg( + "Abnormal return status encountered while invoking " + sContext); + TestUtil.logMsg("Exception Message was: " + e.getMessage()); + // e.printStackTrace(); + } + + // lets force an update of our log file + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + return code; + } // invokeServlet() + + /* + * This is a convenience method used to post a url to a servlet so that our + * servlet can do some tests and send back status about success or failure. + * This passes some params onto the request/context so that the servlet will + * have info it needs in order to properly perform its serverside ACF and ACP + * tests. + * + */ + private String invokeServletAndGetResponse(String sContext, + String requestMethod) { + return invokeServletAndGetResponse(sContext, requestMethod, null); + } + + private String invokeServletAndGetResponse(String sContext, + String requestMethod, String testMethod) { + + TSURL ctsurl = new TSURL(); + if (!sContext.startsWith("/")) { + sContext = "/" + sContext; + } + + // add some servlet params onto our context + sContext = sContext + "?" + "log.file.location=" + logFileLocation; + sContext = sContext + "&" + "provider.configuration.file=" + + providerConfigFileLoc; + sContext = sContext + "&" + "vendor.authconfig.factory=" + vendorACF; + if (testMethod != null) { + sContext = sContext + "&" + "method.under.test=" + testMethod; + } + + TestUtil.logMsg("sContext = " + sContext); + TestUtil + .logMsg("passing to servlet: log.file.location = " + logFileLocation); + TestUtil.logMsg("passing to servlet: provider.configuration.file = " + + providerConfigFileLoc); + TestUtil.logMsg( + "passing to servlet: vendor.authconfig.factory = " + vendorACF); + TestUtil.logMsg("passing to servlet: testMethod = " + testMethod); + + String url = ctsurl.getURLString("http", hostname, portnum, sContext); + String retVal = null; + + try { + URL newURL = new URL(url); + + // Encode authData + // hint: make sure username and password are valid for your + // (J2EE) security realm otherwise you recieve http 401 error. + String authData = username + ":" + password; + TestUtil.logMsg("authData : " + authData); + + BASE64Encoder encoder = new BASE64Encoder(); + + String encodedAuthData = encoder.encode(authData.getBytes()); + TestUtil.logMsg("encoded authData : " + encodedAuthData); + + // open URLConnection + HttpURLConnection conn = (HttpURLConnection) newURL.openConnection(); + + // set request property + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestProperty("Authorization", + "Basic " + encodedAuthData.trim()); + conn.setRequestMethod(requestMethod); // POST or GET etc + conn.connect(); + + TestUtil.logMsg("called HttpURLConnection.connect() for url: " + url); + retVal = conn.getResponseMessage(); + TestUtil.logMsg("Got response string of: " + retVal); + + InputStream content = (InputStream) conn.getInputStream(); + BufferedReader in = new BufferedReader(new InputStreamReader(content)); + try { + String line; + while ((line = in.readLine()) != null) { + retVal = retVal + line; + TestUtil.logMsg(line); + } + } finally { + in.close(); + } + } catch (Exception e) { + TestUtil.logMsg( + "Abnormal return status encountered while invoking " + sContext); + TestUtil.logMsg("Exception Message was: " + e.getMessage()); + } + + // lets force an update of our log file + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + return retVal; + } // invokeServletAndGetResponse() + + /** + * @keywords: jaspic_servlet + * + * @testName: getRegistrationContextId + * + * @assertion_ids: JASPIC:JAVADOC:77 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. Use the system properties to read the TestSuite + * providers defined in ProviderConfigruation.xml file and + * register them with vendor's authconfig factory. + * + * + * Description This will use an appContext value that was used + * to register a provider, and it will see if it can use the + * AuthConfigFactory.RegistrationContext API to try and access + * the same appContext value that was used during the + * registration process. + * + */ + public void getRegistrationContextId() throws Fault { + boolean verified = false; + String appContext = appContextHostname + " /spitests_servlet_web"; + + // register providers in vendor factory + verified = register(logFileLocation, providerConfigurationFileLocation, + vendorAuthConfigFactoryClass); + if (!verified) { + throw new Fault("getRegistrationContextId failed : "); + } + + // verify we can access a given provider (any provider) appcontext id + boolean bVerified = false; + + AuthConfigFactory acf = null; + + try { + acf = AuthConfigFactory.getFactory(); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory."; + msg = msg + " Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + } + + if (acf == null) { + String msg = "getRegistrationContextId(): Error - call to getFactory() returned null ACF."; + TestUtil.logMsg(msg); + throw new Fault("getRegistrationContextId failed : "); + } + + String[] regIDs = acf.getRegistrationIDs(null); + for (int ii = 0; ii < regIDs.length; ii++) { + // loop through the ACF's registration ids + + if (regIDs[ii] != null) { + AuthConfigFactory.RegistrationContext acfReg; + acfReg = acf.getRegistrationContext(regIDs[ii]); + if (acfReg != null) { + TestUtil.logMsg("appContext = " + appContext); + TestUtil.logMsg("acfReg.getAppContext() = " + acfReg.getAppContext()); + TestUtil.logMsg("layer = " + acfReg.getMessageLayer()); + String str = acfReg.getAppContext(); + if ((str != null) && (str.equals(appContext))) { + // we found our provider info + TestUtil + .logMsg("Found it : RegistrationID for our ACP=" + regIDs[ii]); + bVerified = true; + break; + } + } + } + } + + if (!bVerified) { + String msg = "Could not find appContext=" + appContext; + msg += " in the ACF's list of registration id info"; + TestUtil.logMsg(msg); + throw new Fault("getRegistrationContextId failed : "); + } + + TestUtil.logMsg("TestSuite Providers registration successful"); + } + + /** + * @keywords: jaspic_servlet + * + * @testName: AuthConfigFactoryVerifyPersistence + * + * @assertion_ids: JASPIC:JAVADOC:75 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. Load vendor's AuthConfigFactory and make sure the + * registered providers return properly for the right message + * layer and appContextId + * + * Note: We test the persistance behaviour for vendor's + * AuthConfigFactory by registering providers from a persisted + * file, then we verify the registrations went correctly. + * + * Description + * + * + */ + public void AuthConfigFactoryVerifyPersistence() throws Fault { + + boolean verified = false; + + try { + + // register providers in vendor factory + verified = register(logFileLocation, providerConfigurationFileLocation, + vendorAuthConfigFactoryClass); + if (!verified) { + throw new Fault("getRegistrationContextId failed : "); + } + + // Get system default AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + TestUtil.logMsg("Default AuthConfigFactory class name = " + + acf.getClass().getName()); + + verified = verifyRegistrations(acf); + + } else { + TestUtil.logErr("Default AuthConfigFactory is null" + + " can't verify registrations for TestSuite Providers"); + } + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory."; + msg = msg + " Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + + } catch (Exception e) { + e.printStackTrace(); + } + + if (!verified) { + throw new Fault("AuthConfigFactoryPersistence failed : "); + } else + TestUtil.logMsg("AuthConfigFactory Persistence works"); + } + + public boolean register(String logFileLocation, + String providerConfigurationFileLocation, + String vendorAuthConfigFactoryClass) { + + try { + + printVerticalIndent(); + + // Get an instance of Vendor's AuthConfigFactory + AuthConfigFactory vFactory = getAuthConfigFactory( + vendorAuthConfigFactoryClass); + + // Set vendor's AuthConfigFactory + AuthConfigFactory.setFactory(vFactory); + + // Get system default AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + TestUtil.logMsg("Default AuthConfigFactory class name = " + + acf.getClass().getName()); + + } else { + TestUtil.logErr("Default AuthConfigFactory is null" + + " can't register TestSuite Providers with null"); + // System.exit(1); + return false; + } + + /** + * Read the ProviderConfiguration XML file This file contains the list of + * providers that needs to be loaded by the vendor's default + * AuthConfigFactory + */ + providerConfigurationEntriesCollection = readProviderConfigurationXMLFile(); + + ProviderConfigurationEntry pce = null; + + printVerticalIndent(); + Iterator iterator = providerConfigurationEntriesCollection.iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with vendor's default AuthConfigFactory + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + TestUtil.logMsg( + "Registering Provider " + pce.getProviderClassName() + " ..."); + acf.registerConfigProvider(pce.getProviderClassName(), + pce.getProperties(), pce.getMessageLayer(), + pce.getApplicationContextId(), pce.getRegistrationDescription()); + TestUtil.logMsg("Registration Successful"); + } + } + printVerticalIndent(); + + // Check whether the providers are registered for the right message layer + // and appContext + // verifyRegistrations(acf); + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + + } catch (Exception e) { + TestUtil.logMsg("Error Registering TestSuite AuthConfig Providers"); + e.printStackTrace(); + } + + return true; + + } + + /** + * This method instantiates and ruturns a AuthConfigFactory based on the + * specified className + */ + private AuthConfigFactory getAuthConfigFactory(String className) { + + AuthConfigFactory vFactory = null; + + if (className != null) { + try { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + Class clazz = Class.forName(className, true, loader); + + vFactory = (AuthConfigFactory) clazz.newInstance(); + TestUtil.logMsg("Instantiated AuthConfigFactory for: " + className); + + } catch (Exception e) { + TestUtil.logMsg("Error instantiating vendor's " + + "AuthConfigFactory class :" + className); + e.printStackTrace(); + + } + } + + return vFactory; + } + + private void printVerticalIndent() { + TestUtil + .logMsg("**********************************************************"); + TestUtil.logMsg("\n"); + + } + + private boolean verifyRegistrations(AuthConfigFactory acf) { + TestUtil.logMsg("Verifying Provider Registrations ..."); + + try { + // Get AuthConfigProviderServlet + AuthConfigProvider servletACP = acf + .getConfigProvider(JASPICData.LAYER_SERVLET, servletAppContext, null); + + if (servletACP != null) { + if (servletACP.getClass().getName().equals( + "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet")) { + TestUtil.logMsg("TSAuthConfigProviderServlet registered for" + + " message layer=HttpServlet" + " and appContextId=" + + servletAppContext); + } else { + TestUtil.logMsg( + "Wrong provider registerd for " + " message layer=HttpServlet" + + " and appContextId=" + servletAppContext); + return false; + } + + } else { + TestUtil.logMsg("Error : No AuthConfigprovider registerd for" + + " message layer=HttpServlet" + " and appContextId=" + + servletAppContext); + return false; + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return true; + + } + + /* + * Read the provider configuration XML file and registers each provider with + * Vendor's default AuthConfigFactory + */ + private Collection readProviderConfigurationXMLFile() { + Collection providerConfigurationEntriesCollection = null; + + TestUtil.logMsg("Reading TestSuite Providers from :" + + providerConfigurationFileLocation); + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + configFileProcessor = new ProviderConfigurationXMLFileProcessor( + providerConfigurationFileLocation); + + // Retrieve the ProviderConfigurationEntries collection + providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + TestUtil.logMsg("TestSuite Providers read successfully " + + "from ProviderConfiguration.xml file"); + + return providerConfigurationEntriesCollection; + + } catch (Exception e) { + TestUtil.logMsg("Error loading Providers"); + e.printStackTrace(); + } + return null; + + } + + /* + * This is used to make sure we have the correct Factory class being used. + * + */ + /* + * private void setFactoryClass(String acfClass) { + * + * try { AuthConfigFactory acf = AuthConfigFactory.getFactory(); Object acfObj + * = (Object) acf; if (! (acfObj instanceof + * com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory)) { if (acf!=null){ + * String curClass = acf.getClass().getName(); + * + * TestUtil.logMsg("Changing factory to class: " + acfClass + " from class: " + * + curClass); } AuthConfigFactory correctAcf = new TSAuthConfigFactory(); + * AuthConfigFactory.setFactory(correctAcf); } } catch (SecurityException ex) + * { // if here we may not have permission to invoke ACF.getFactory... String + * msg = + * "SecurityException: make sure you have permission to call ACF.getFactory"; + * msg = msg + + * "or ACF.setFactory(). Check your server side security policies."; + * TestUtil.logMsg(msg); ex.printStackTrace(); } } + */ + + /** + * + * @keywords: jaspic_servlet + * + * @testName: AuthConfigFactorySetFactory + * + * @assertion_ids: JASPIC:SPEC:7; JASPIC:SPEC:10; JASPIC:JAVADOC:87; + * JASPIC:JAVADOC:80 + * + * @test_Strategy: 1. Use the static setFactory method to set an ACF and this + * should always work. + * + * Description This method uses the getFactory() method to get + * the current factory, then it uses the setFactory() to + * change the current ACF. This method then verifies that the + * ACF's were indeed changed. We know that the setFactory() + * works as it is used in the bootstrap process - but this is + * an additional level of testing that allows us to set the + * factory in a slightly different manner than the bootstrap + * (eg reading it out of the java.security file. + */ + public void AuthConfigFactorySetFactory() throws Fault { + try { + // get current AuthConfigFactory + AuthConfigFactory currentAcf = AuthConfigFactory.getFactory(); + if (currentAcf == null) { + // this could fail due to permissions or because the system can't + // find ACF (check for setting of -Djava.security.properties) + TestUtil.logMsg("FAILURE - Could not get current AuthConfigFactory."); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } + String currentACFClass = currentAcf.getClass().getName(); + TestUtil.logMsg("currentACFClass = " + currentACFClass); + + // set our ACF to a new/different AuthConfigFactory + TSAuthConfigFactoryForStandalone newAcf = new TSAuthConfigFactoryForStandalone(); + AuthConfigFactory.setFactory(newAcf); + String newACFClass = newAcf.getClass().getName(); + TestUtil.logMsg("newACFClass = " + newACFClass); + + // verify our calls to getFactory() are getting the newly set factory + // instance and not the original ACF instance + AuthConfigFactory testAcf = AuthConfigFactory.getFactory(); + if (testAcf == null) { + TestUtil.logMsg("FAILURE - Could not get newly set AuthConfigFactory."); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } + String newlySetACFClass = testAcf.getClass().getName(); + TestUtil.logMsg("newlySetACFClass = " + newlySetACFClass); + + // Verify ACF's were set correctly + if (!newlySetACFClass.equals(newACFClass)) { + TestUtil.logMsg( + "FAILURE - our current ACF does not match our newly set ACF"); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } else { + String msg = "newlySetACFClass == newACFClass == " + newACFClass; + TestUtil.logMsg(msg); + } + + // restore original factory class + AuthConfigFactory.setFactory(currentAcf); + + TestUtil.logMsg("AuthConfigFactorySetFactory : PASSED"); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + } + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: ACFSwitchFactorys + * + * @assertion_ids: + * + * + * @test_Strategy: This test does the following: - gets current (CTS) factory + * - sets the vendors ACF thus replacing the CTS ACF - verify + * ACF's were correctly set - reset factory back to the + * original CTS factory + * + * 1. Use the static setFactory method to set an ACF and this + * should always work. and use the getFactory to verify it + * worked. + * + * Description + * + */ + public void ACFSwitchFactorys() throws Fault { + String strMsg1 = "ACFTestServlet->ACFSwitchFactorys() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFSwitchFactorys"); + TestUtil.logMsg("ACFSwitchFactorys : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFSwitchFactorys : FAILED"); + } + + TestUtil.logMsg("ACFSwitchFactorys : PASSED"); + } + + /** + * + * @keywords: jaspic_servlet + * + * @testName: ACFRemoveRegistrationWithBadId + * + * @assertion_ids: JASPIC:SPEC:345; + * + * + * @test_Strategy: This test verifies we get a return value of False when + * invoking ACF.removeRegistration(some_bad_id); + * + * 1. Use the static setFactory method to get an ACF and then + * attempt to invoke removeRegistration() with an invalid (ie + * non-existant) regId. This should return False (per + * javadoc). + * + * Description + * + */ + public void ACFRemoveRegistrationWithBadId() throws Fault { + String strMsg1 = "ACFTestServlet->ACFRemoveRegistrationWithBadId() passed"; + + String str = invokeServletAndGetResponse(acfServletPath, "POST", + "ACFRemoveRegistrationWithBadId"); + TestUtil.logMsg("ACFRemoveRegistrationWithBadId : str = " + str); + + int ii = str.indexOf(strMsg1); + + if (ii < 0) { + throw new Fault("ACFRemoveRegistrationWithBadId : FAILED"); + } + + TestUtil.logMsg("ACFRemoveRegistrationWithBadId : PASSED"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ModTestServlet.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ModTestServlet.java new file mode 100644 index 0000000..d1e4e10 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/ModTestServlet.java @@ -0,0 +1,493 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; +import java.security.Principal; + +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpConstraint; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(value = @HttpConstraint(rolesAllowed = { + "Administrator" }), httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "Administrator"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "Administrator") }) +@WebServlet(name = "ModTestServlet", urlPatterns = { "/ModTestServlet" }) +public class ModTestServlet extends HttpServlet { + + private String logFileLocation; + + private String servletAppContext = null; + + private String providerConfigFileLocation; + + private String testMethod = null; + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->doGet()"); + + doTests(request, response); + + out.println("Laving ModTestServlet->doGet()"); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + System.out.println("In ModTestServlet->doPost()"); + + doTests(request, response); + + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->doPost()"); + + } + + public void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + System.out.println("In ModTestServlet->service()"); + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->service()"); + + super.service(request, response); + } + + public void doTests(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (Exception ex) { + debug("got exception in ModTestServlet"); + ex.printStackTrace(); + } + + // get some common props that are passed into our servlet request + getPropsAndParams(request, response); + + if (testMethod.equals("testAuthenResultsOnHttpServlet")) { + MTSAuthenResultsOnHttpServlet(request, response); + } else if (testMethod.equals("testAuthenIsUserInRole")) { + MTSAuthenIsUserInRole(request, response); + } else if (testMethod.equals("testRemoteUserCorrespondsToPrin")) { + MTSRemoteUserCorrespondsToPrin(request, response); + } else if (testMethod.equals("testAuthenAfterLogout")) { + testAuthenAfterLogout(request, response); + } else if (testMethod.equals("testGPCIsUserInRole")) { + testGPCIsUserInRole(request, response); + } else if (testMethod.equals("testGPCGetUserPrincipal")) { + testGPCGetUserPrincipal(request, response); + } else if (testMethod.equals("testGPCGetRemoteUser")) { + testGPCGetRemoteUser(request, response); + } else if (testMethod.equals("testGPCGetAuthType")) { + testGPCGetAuthType(request, response); + } else { + // if here, it most likely means that we ran a test from within + // Client.java which + // invoked this servlet with the only intent being to check if access + // could be + // made. Some tests only care that they can access this servlet and do NOT + // need to run any particular testMethod in here. + debug("WARNING: ModTestServlet,doTests() testMethod not recognized: " + + testMethod); + } + } + + // this pulls out some params that are passed in on our servlet req + // that is made from within the client code (e.g. Client.java). + private void getPropsAndParams(HttpServletRequest req, + HttpServletResponse response) { + + // set logfile location + logFileLocation = req.getParameter("log.file.location"); + if ((logFileLocation != null) + && (-1 < logFileLocation.indexOf(JASPICData.DEFAULT_LOG_FILE))) { + // if here, we have logfile location value which contains + // JASPICData.DEFAULT_LOG_FILE + debug("logFileLocation already set"); + } else if (logFileLocation != null) { + debug("logFileLocation NOT set completely"); + System.setProperty("log.file.location", logFileLocation); + } else { + debug("ModTestServlet: logFileLocation null"); + } + debug("logFileLocation = " + logFileLocation); + + // set provider config file + providerConfigFileLocation = req + .getParameter("provider.configuration.file"); + debug("TS Provider ConfigFile = " + providerConfigFileLocation); + if (providerConfigFileLocation == null) { + debug("ERROR: getPropsAndParams(): providerConfigFileLocation = null"); + } else { + debug("getPropsAndParams(): providerConfigFileLocation = " + + providerConfigFileLocation); + } + + // set testMethod + testMethod = req.getParameter("method.under.test"); + + // Reusing some old code that is passing vendorACFClass in - so while + // we dont currently use it in this servlet, - it IS being passed in + // so just note it is here. + // String vendorACFClass = req.getParameter("vendor.authconfig.factory"); + + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + return; + } + + /* + * This should be satisfying assertion JASPIC:SPEC:322. + */ + public void MTSAuthenResultsOnHttpServlet(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->MTSAuthenResultsOnHttpServlet()"); + System.out.println("In ModTestServlet->MTSAuthenResultsOnHttpServlet()"); + + // after successful login, we should see non-null values for all of these! + String strAuthType = request.getAuthType(); + String strRemoteUser = request.getRemoteUser(); + Principal pp = request.getUserPrincipal(); + + if ((strAuthType != null) && (strRemoteUser != null) && (pp != null)) { + out.println("request.getAuthType() = " + strAuthType); + out.println("request.getRemoteUser() = " + strRemoteUser); + out.println("request.getUserPrincipal() = " + pp.toString()); + out.println("Authentication results on HttpServletRequest ok."); + out.println("ModTestServlet->testAuthenResultsOnHttpServlet() passed"); + } else if ((strRemoteUser == null) && (pp == null) + && (strAuthType == null)) { + out.println("request.getRemoteUser() == pp == null"); + out.println("ModTestServlet->testAuthenResultsOnHttpServlet() passed"); + } else { + out.println("Authentication results on HttpServletRequest Error."); + out.println("request.getAuthType() = " + strAuthType); + out.println("request.getRemoteUser() = " + strRemoteUser); + if (pp != null) { + out.println("request.getUserPrincipal() = " + pp.toString()); + } else { + out.println("request.getUserPrincipal() = null"); + } + } + } catch (Exception ex) { + System.out + .println("ModTestServlet->MTSAuthenResultsOnHttpServlet() failed"); + ex.printStackTrace(); + } + + return; + } // MTSAuthenResultsOnHttpServlet() + + /* + * This is basically the same thing as MTSAuthenResultsOnHttpServlet() but we + * are returning slightly different return values so... + */ + public void testAuthenAfterLogout(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->testAuthenAfterLogout()"); + debug("In ModTestServlet->testAuthenAfterLogout()"); + + // after successful login, we must get a non-null + // value for getUserPrincipal() + Principal pp = request.getUserPrincipal(); + + if (pp != null) { + // good - pp was not null which indicates successful authN + out.println("ModTestServlet->testAuthenAfterLogout() passed"); + } else { + // oh oh - we got null pp which indicates we are not authenticated + out.println( + "testAuthenAfterLogout() failed - getUserPrincipal() returned null."); + } + } catch (Exception ex) { + debug("ModTestServlet->testAuthenAfterLogout() failed"); + ex.printStackTrace(); + } + + return; + } // testAuthenAfterLogout() + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void MTSAuthenIsUserInRole(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->MTSAuthenIsUserInRole()"); + System.out.println("In ModTestServlet->MTSAuthenIsUserInRole()"); + + // after successful login, we should see true value for isUserInRole + boolean bval = request.isUserInRole("Administrator"); + + if (bval == true) { + debug(out, "isUserInRole() returns true."); + out.println("ModTestServlet->testAuthenIsUserInRole() passed"); + } else { + debug(out, "Authentication Error - isUserInRole() returns false."); + debug(out, "request.getRemoteUser() = " + request.getRemoteUser()); + Principal pp = request.getUserPrincipal(); + if (pp != null) { + debug(out, "request.getUserPrincipal().getName() = " + pp.getName()); + } else { + debug(out, "request.getUserPrincipal() == null"); + } + out.println("ModTestServlet->MTSAuthenIsUserInRole() failed"); + } + } catch (Exception ex) { + System.out.println("ModTestServlet->MTSAuthenIsUserInRole() failed"); + ex.printStackTrace(); + } + + return; + } // MTSAuthenIsUserInRole() + + /* + * (Per jsr-196 spec v1.1 section 3.8.4) This will get called after we have + * authenticated with our user j2ee in role Administrator. When we get into + * this test method, a call to getUserPrincipal(), getRemoteUser(), and to + * getUserPrincipal().getName() should all CORRESPOND. "Correspond" is not a + * hard term as it implies there could be some user mappings involved. + * + * (Using Servlet spec v3.1, section 13.3 - it states: + * "The getRemoteUser method returns the name of the remote user" AND "Calling + * the getName method on the Principal returned by getUserPrincipal returns + * the name of the remote user." We can use these two Servlet spec references + * combined with our JASPIC reference to validate that principal.getName() + * equals the same value returned by getRemoteUser(). + */ + public void MTSRemoteUserCorrespondsToPrin(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->MTSRemoteUserCorrespondsToPrin()"); + System.out.println("In ModTestServlet->MTSRemoteUserCorrespondsToPrin()"); + + // after successful login, we should see true value for isUserInRole + String strRemoteUser = request.getRemoteUser(); + Principal pp = request.getUserPrincipal(); + String prinName = null; + if (pp != null) { + prinName = pp.getName(); + } + + if ((prinName != null) && (strRemoteUser != null) + && prinName.equals(strRemoteUser)) { + out.println("principal.getName() = " + prinName); + out.println("request.getRemoteUser() = " + strRemoteUser); + out.println("ModTestServlet->testRemoteUserCorrespondsToPrin() passed"); + } else { + out.println("ModTestServlet->MTSRemoteUserCorrespondsToPrin() failed"); + out.println("principal.getName() = " + prinName); + out.println("request.getRemoteUser() = " + strRemoteUser); + if (pp != null) { + out.println( + "request.getUserPrincipal().toString() = " + pp.toString()); + } else { + out.println("request.getUserPrincipal() = null"); + } + } + + } catch (Exception ex) { + System.out + .println("ModTestServlet->MTSRemoteUserCorrespondsToPrin() failed"); + ex.printStackTrace(); + } + + return; + } // MTSRemoteUserCorrespondsToPrin() + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void testGPCIsUserInRole(HttpServletRequest request, + HttpServletResponse response) { + try { + boolean bval = false; + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->testGPCIsUserInRole()"); + + // first make sure user is in role! + // after successful login, we should see true value for isUserInRole + bval = request.isUserInRole("Administrator"); + if (bval == true) { + debug(out, "isUserInRole() returns true."); + } else { + debug(out, "Authentication Error - isUserInRole() returns false."); + debug(out, "request.getRemoteUser() = " + request.getRemoteUser()); + out.println("ModTestServlet->testGPCIsUserInRole() failed"); + } + + if (bval) { + out.println("ModTestServlet->testGPCIsUserInRole() passed"); + } + + } catch (Exception ex) { + System.out.println("ModTestServlet->testGPCIsUserInRole() failed"); + ex.printStackTrace(); + } + + return; + } + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void testGPCGetUserPrincipal(HttpServletRequest request, + HttpServletResponse response) { + try { + boolean bval = false; + + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->testGPCGetUserPrincipal()"); + + // getUserPrincipal() should have been set on proper validateRequest() + if (request.getUserPrincipal() == null) { + debug(out, + "ERROR - request.getUserPrincipal() == null but should not!"); + } + + String principalName = request.getUserPrincipal().getName(); + if (principalName != null) { + debug(out, "request.getUserPrincipal().getName() = " + principalName); + bval = true; + } else { + debug(out, + "ERROR - request.getUserPrincipal().getName() == null but should not be"); + out.println("ModTestServlet->testGPCGetUserPrincipal() failed"); + } + + if (bval) { + out.println("ModTestServlet->testGPCGetUserPrincipal() passed"); + } + + } catch (Exception ex) { + System.out.println("ModTestServlet->testGPCGetUserPrincipal() failed"); + ex.printStackTrace(); + } + + return; + } + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void testGPCGetRemoteUser(HttpServletRequest request, + HttpServletResponse response) { + try { + boolean bval = false; + + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->testGPCGetRemoteUser()"); + + // getRemoteUser() should have been set on proper validateRequest() + String remoteUser = request.getRemoteUser(); + if (remoteUser != null) { + debug(out, "request.getRemoteUser() = " + remoteUser); + bval = true; + } else { + debug(out, "ERROR - request.getRemoteUser() == null but should not be"); + out.println("ModTestServlet->testGPCGetRemoteUser() failed"); + } + + if (bval) { + out.println("ModTestServlet->testGPCGetRemoteUser() passed"); + } + + } catch (Exception ex) { + System.out.println("ModTestServlet->testGPCGetRemoteUser() failed"); + ex.printStackTrace(); + } + + return; + } + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void testGPCGetAuthType(HttpServletRequest request, + HttpServletResponse response) { + try { + boolean bval = false; + + PrintWriter out = response.getWriter(); + out.println("Enterred ModTestServlet->testGPCGetAuthType()"); + debug("enterred ModTestServlet->testGPCGetAuthType()"); + + // getAuthType() should have been set on proper validateRequest() + String authType = request.getAuthType(); + if (authType != null) { + debug(out, "request.getAuthType() = " + authType); + bval = true; + } else { + debug(out, "ERROR - request.getAuthType() == null but should not be"); + out.println("ModTestServlet->testGPCGetAuthType() failed"); + } + + if (bval) { + out.println("ModTestServlet->testGPCGetAuthType() passed"); + } + + } catch (Exception ex) { + System.out.println("ModTestServlet->testGPCGetAuthType() failed"); + ex.printStackTrace(); + } + + return; + } + + public void debug(PrintWriter out, String str) { + out.println(str); + System.out.println(str); + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OpenToAllServlet.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OpenToAllServlet.java new file mode 100644 index 0000000..aed8160 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OpenToAllServlet.java @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; +import java.security.Principal; + +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; + +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@ServletSecurity +@WebServlet(name = "OpenToAllServlet", urlPatterns = { "/OpenToAllServlet" }) +public class OpenToAllServlet extends HttpServlet { + private String logFileLocation; + + private String servletAppContext = null; + + private String providerConfigFileLocation; + + private String testMethod = null; + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter out = response.getWriter(); + doPost(request, response); + debug("Enterred OpenToAllServlet->doGet()"); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + PrintWriter out = response.getWriter(); + debug("Enterred OpenToAllServlet->doPost()"); + + doTests(request, response); + + } + + public void doTests(HttpServletRequest request, + HttpServletResponse response) { + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (Exception ex) { + debug("got exception in ModTestServlet"); + ex.printStackTrace(); + } + + // get some common props that are passed into our servlet request + getPropsAndParams(request, response); + + if (testMethod.equals("testGPCWithNoRequiredAuth")) { + TestGPCWithNoRequiredAuth(request, response); + } else if (testMethod.equals("testAuthenAfterLogout")) { + TestAuthenAfterLogout(request, response); + } else { + // if here, it most likely means that we ran a test from within + // Client.java which + // invoked this servlet with the only intent being to check if access + // could be + // made. Some tests only care that they can access this servlet and do NOT + // need to run any particular testMethod in here. + debug("WARNING: OpenToAllServlet.doTests() testMethod not recognized: " + + testMethod); + } + } + + public void TestAuthenAfterLogout(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + // out.println("Enterred OpenToAllServlet->TestAuthenAfterLogout()"); + System.out.println("In OpenToAllServlet->TestAuthenAfterLogout()"); + + Principal pp = request.getUserPrincipal(); + if (pp != null) { + // ohoh - when no authN required for this servlet, we are detecting + // that some authentication occurred -OR- that we are pre-logged in + // either way, thats a problem so force a logout. + out.println( + "OpenToAllServlet: we should not be authenticated so forcing logout"); + request.logout(); + } else { + out.println( + "OpenToAllServlet: pp == null so we were not pre-logged in."); + out.println( + "no need to force a logout since we are (correctly) not logged in."); + } + } catch (Exception ex) { + System.out.println("OpenToAllServlet->TestAuthenAfterLogout() failed"); + ex.printStackTrace(); + } + } + + /* + * This will get called after we have authenticated with our user j2ee in role + * Administrator. When we get into this test method, a call to isUserInRole + * better return true. if we have not authenticated, we expect to get false. + */ + public void TestGPCWithNoRequiredAuth(HttpServletRequest request, + HttpServletResponse response) { + try { + PrintWriter out = response.getWriter(); + out.println("Enterred OpenToAllServlet->TestGPCWithNoRequiredAuth()"); + System.out.println("In OpenToAllServlet->TestGPCWithNoRequiredAuth()"); + + // after successful login, we should see true value for isUserInRole + boolean bval = request.isUserInRole("Administrator"); + + if (bval == true) { + debug(out, "isUserInRole() returns true."); + debug( + "OpenToAllServlet->testAuthenIsUserInRole() isUserInRole() returns true"); + } else { + debug( + "OpenToAllServlet->TestGPCWithNoRequiredAuth() isUserInRole() returns false"); + } + out.println("OpenToAllServlet->testAuthenIsUserInRole() passed"); + + } catch (Exception ex) { + System.out + .println("OpenToAllServlet->TestGPCWithNoRequiredAuth() failed"); + ex.printStackTrace(); + } + + return; + } + + // this pulls out some params that are passed in on our servlet req + // that is made from within the client code (e.g. Client.java). + private void getPropsAndParams(HttpServletRequest req, + HttpServletResponse response) { + + // set logfile location + logFileLocation = req.getParameter("log.file.location"); + if ((logFileLocation != null) + && (-1 < logFileLocation.indexOf(JASPICData.DEFAULT_LOG_FILE))) { + // if here, we have logfile location value which contains + // JASPICData.DEFAULT_LOG_FILE + debug("logFileLocation already set"); + } else if (logFileLocation != null) { + debug("logFileLocation NOT set completely"); + System.setProperty("log.file.location", logFileLocation); + } else { + debug("ModTestServlet: logFileLocation null"); + } + debug("logFileLocation = " + logFileLocation); + + // set provider config file + providerConfigFileLocation = req + .getParameter("provider.configuration.file"); + debug("TS Provider ConfigFile = " + providerConfigFileLocation); + if (providerConfigFileLocation == null) { + debug("ERROR: getPropsAndParams(): providerConfigFileLocation = null"); + } else { + debug("getPropsAndParams(): providerConfigFileLocation = " + + providerConfigFileLocation); + } + + // set testMethod + testMethod = req.getParameter("method.under.test"); + + // Reusing some old code that is passing vendorACFClass in - so while + // we dont currently use it in this servlet, - it IS being passed in + // so just note it is here. + // String vendorACFClass = req.getParameter("vendor.authconfig.factory"); + + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + return; + } + + public void debug(PrintWriter out, String str) { + out.println(str); + System.out.println(str); + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OptionalAuthen.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OptionalAuthen.java new file mode 100644 index 0000000..d89f173 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/OptionalAuthen.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(httpMethodConstraints = { @HttpMethodConstraint(value = "GET"), + @HttpMethodConstraint(value = "POST") }) +@WebServlet(urlPatterns = { "/OptionalAuthen", + "/ModuleAuthStatusThrowExNoDispatch" }) +public class OptionalAuthen extends HttpServlet { + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter out = response.getWriter(); + doPost(request, response); + out.println("Enterred OptionalAuthen->doGet()"); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + System.out.println("In OptionalAuthen->doPost()"); + + PrintWriter out = response.getWriter(); + out.println("Enterred OptionalAuthen->doPost()"); + + out.println("request.getServletPath() = " + request.getServletPath()); + out.println("request.getPathInfo() = " + request.getPathInfo()); + out.println("request.getMethod() = " + request.getMethod()); + } + + public void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + System.out.println("In OptionalAuthen->service()"); + PrintWriter out = response.getWriter(); + out.println("Enterred OptionalAuthen->service()"); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/WrapperServlet.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/WrapperServlet.java new file mode 100644 index 0000000..8137978 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/WrapperServlet.java @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.servlet; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.logging.Level; + +import com.sun.ts.tests.jaspic.spi.common.CommonTests; +import com.sun.ts.tests.jaspic.spi.common.CommonUtils; +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.annotation.security.DeclareRoles; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HttpConstraint; +import jakarta.servlet.annotation.HttpMethodConstraint; +import jakarta.servlet.annotation.ServletSecurity; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +@DeclareRoles({ "Administrator", "Manager", "Employee" }) +@ServletSecurity(value = @HttpConstraint(rolesAllowed = { + "Administrator" }), httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "Administrator"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "Administrator") }) +@WebServlet(name = "WrapperServlet", urlPatterns = { "/WrapperServlet" }) +public class WrapperServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + private String logFileLocation; + + private String servletAppContext = null; + + private String providerConfigFileLocation; + + private String vendorACFClass; + + private String testMethod = null; + + private transient CommonTests commonTests; + + private TSLogger logger = null; + + @Override + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doTests(request, response); + } + + @SuppressWarnings("unused") + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doTests(request, response); + } + + public void doTests(HttpServletRequest request, + HttpServletResponse response) { + + debug("in WrapperServlet.doTests"); + + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (Exception ex) { + debug("got exception in WrapperServlet.doTests"); + ex.printStackTrace(); + } + + // get some common props + getPropsAndParams(request, response); + + // + // now send string out to logger so we can verify that the content + // gets processed BEFORE secureResponse. + debug("in WrapperServlet.doTests: calling logger.log()"); + String outStr = "WrapperServlet.doTests() content processed for requestURI"; + logger.log(Level.INFO, outStr); + + if (testMethod.equals("testRequestWrapper")) { + testRequestWrapper(request, response); + } else if (testMethod.equals("testResponseWrapper")) { + testResponseWrapper(request, response); + } + + // restore original (CTS) factory class + // note: this should be done in many of the calls but its a safety measure + // to ensure we are resetting things back to expected defaults + try { + CommonUtils.resetDefaultACF(); + } catch (Exception ex) { + debug("ACFTestServlet: error calling CommonUtils.resetDefaultACF(): " + + ex.getMessage()); + ex.printStackTrace(); + } + } + + private void getPropsAndParams(HttpServletRequest req, + HttpServletResponse response) { + + // set logfile location + logFileLocation = req.getParameter("log.file.location"); + if ((logFileLocation != null) + && (-1 < logFileLocation.indexOf(JASPICData.DEFAULT_LOG_FILE))) { + // if here, we have logfile location value which contains + // JASPICData.DEFAULT_LOG_FILE + debug("logFileLocation already set"); + } else { + debug("logFileLocation NOT set completely"); + System.setProperty("log.file.location", logFileLocation); + } + debug("logFileLocation = " + logFileLocation); + + // initialize TSLogger once we have logFileLocation set + initializeTSLogger(); + + // set provider config file + providerConfigFileLocation = req + .getParameter("provider.configuration.file"); + debug("TS Provider ConfigFile = " + providerConfigFileLocation); + if (providerConfigFileLocation == null) { + debug("ERROR: getPropsAndParams(): providerConfigFileLocation = null"); + } else { + debug("getPropsAndParams(): providerConfigFileLocation = " + + providerConfigFileLocation); + } + + // set testMethod + testMethod = req.getParameter("method.under.test"); + + // set vendor class + vendorACFClass = req.getParameter("vendor.authconfig.factory"); + if (vendorACFClass == null) { + debug("ERROR: getPropsAndParams(): vendorACFClass = null"); + } else { + debug("getPropsAndParams(): vendorACFClass = " + vendorACFClass); + } + + servletAppContext = IdUtil.getAppContextId(JASPICData.LAYER_SERVLET); + + return; + } + + public void testRequestWrapper(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + out.println("WrapperServlet->testRequestWrapper()"); + out.println( + "isRequestWrapped = " + request.getAttribute("isRequestWrapped")); + out.flush(); + } catch (Exception ex) { + System.out.println("WrapperServlet->testRequestWrapper() failed"); + ex.printStackTrace(); + } + } + + public void testResponseWrapper(HttpServletRequest request, + HttpServletResponse response) { + PrintWriter out = null; + try { + out = response.getWriter(); + out.println("WrapperServlet->testResponseWrapper()"); + out.println( + "isResponseWrapped = " + response.getHeader("isResponseWrapped")); + out.flush(); + } catch (Exception ex) { + System.out.println("WrapperServlet->testResponseWrapper() failed"); + ex.printStackTrace(); + } + } + + /* + * This is used to initialize our logger so that we can log from this servlet + * into the TSSVLog.txt file. This will allow us to test + * verifyRuntimeCallOrder() (from in Client.java) + */ + private void initializeTSLogger() { + if (logger == null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + } + + try { + System.out.println("logFileLocation = " + logFileLocation); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // create a new file + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/build.xml new file mode 100644 index 0000000..5913203 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/client.html b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/client.html new file mode 100644 index 0000000..6fe11e0 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/client.html @@ -0,0 +1,30 @@ + + + + + + Generic html for testing purposes + + +

Generic html for testing purposes

+ + + Static html page for testing purposes! + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.war.sun-web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.war.sun-web.xml new file mode 100644 index 0000000..90ca90e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.war.sun-web.xml @@ -0,0 +1,36 @@ + + + + + +/spitests_servlet_web + + Administrator + j2ee + + + Manager + javajoe + + + Employee + javajoe + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.xml new file mode 100644 index 0000000..180833e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/servlet/spitests_servlet_web.xml @@ -0,0 +1,28 @@ + + + + + spi_servlet + + + BASIC + default + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Client.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Client.java new file mode 100644 index 0000000..d51428a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Client.java @@ -0,0 +1,1929 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.soap; + +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +import javax.xml.namespace.QName; + +import com.sun.javatest.Status; +import com.sun.ts.lib.harness.EETest; +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.jaspic.spi.common.CommonTests; +import com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory; +import com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactoryForStandalone; +import com.sun.ts.tests.jaspic.tssv.config.TSRegistrationListener; +import com.sun.ts.tests.jaspic.tssv.util.IdUtil; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationEntry; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationXMLFileProcessor; +import com.sun.ts.tests.jaspic.util.LogFileProcessor; +import com.sun.ts.tests.jaspic.util.WebServiceUtils; + +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.RegistrationListener; +import jakarta.xml.ws.BindingProvider; +import jakarta.xml.ws.WebServiceRef; + +/** + * + * @author Raja Perumal + */ +public class Client extends EETest { + @WebServiceRef(name = "service/HelloService") + static HelloService service; + + private Hello port; + + private Properties props = null; + + private static final String UserNameProp = "user"; + + private static final String UserPasswordProp = "password"; + + private String username = ""; + + private String password = ""; + + private TSURL ctsurl = new TSURL(); + + private String hostname = "localhost"; + + private String logicalHostName = "server"; + + private String PROTOCOL = "http"; + + private String urlString = null; + + private int portnum = 8000; + + private String platformMode = null; + + private transient LogFileProcessor logProcessor = null; + + private transient CommonTests commonTests; + + // server side application context identifier + private String expectedAppContextId = null; + + // ServiceName and PortName mapping configuration going java-to-wsdl + private static final String SERVICE_NAME = "HelloService"; + + private static final String PORT_NAME = "HelloPort"; + + private static final String NAMESPACEURI = "http://soap.spi.jaspic.tests.ts.sun.com/"; + + private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME); + + private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME); + + private transient ProviderConfigurationXMLFileProcessor configFileProcessor = null; + + private Collection providerConfigurationEntriesCollection = null; + + private String soapAppContext = "localhost /Hello_web/Hello"; + + private String servletAppContext = null; + + private String logFileLocation; + + private String providerConfigFileLocation; + + private String vendorACFClass; + + public static void main(String[] args) { + Client theTests = new Client(); + Status s = theTests.run(args, System.out, System.err); + s.exit(); + } + + /* + * @class.setup_props: log.file.location; provider.configuration.file; + * vendor.authconfig.factory; webServerHost; webServerPort; platform.mode; + * user; password; logical.hostname.soap; + */ + public void setup(String[] args, Properties p) throws Fault { + props = p; + try { + username = props.getProperty(UserNameProp); + password = props.getProperty(UserPasswordProp); + hostname = props.getProperty("webServerHost"); + platformMode = props.getProperty("platform.mode"); + logicalHostName = props.getProperty("logical.hostname.soap"); + portnum = Integer.parseInt(props.getProperty("webServerPort")); + urlString = ctsurl.getURLString(PROTOCOL, hostname, portnum, + "/Hello_web/Hello"); + + // Get app-context-id from ProviderConfiguration.xml file + expectedAppContextId = IdUtil.getAppContextId("soap"); + + logFileLocation = props.getProperty("log.file.location"); + TestUtil.logMsg("Log file location = " + logFileLocation); + + providerConfigFileLocation = props + .getProperty("provider.configuration.file"); + TestUtil.logMsg( + "TestSuite Provider ConfigFile = " + providerConfigFileLocation); + + vendorACFClass = props.getProperty("vendor.authconfig.factory"); + TestUtil.logMsg("Vendor AuthConfigFactory class = " + vendorACFClass); + + // If there is no matching app-context-id then try with default id + if (expectedAppContextId.equals("")) { + expectedAppContextId = logicalHostName + " " + "/Hello_web/Hello"; + } + + sayHelloProtected(); + + // create LogProcessor + logProcessor = new LogFileProcessor(props); + + // retrieve logs based on application Name + logProcessor.fetchLogs("pullAllLogRecords|fullLog"); + + // this is class that holds generic tests in it + commonTests = new CommonTests(); + + } catch (Exception e) { + throw new Fault("Setup failed:", e); + } + + TestUtil.logMsg("setup ok"); + } + + /* + * sayHelloProtected + * + * This method is invoked first by all tests, as a result of this client and + * server soap runtime generates corresponding messages in the log and the + * other tests verify those messages. + */ + private void sayHelloProtected() throws Fault { + + try { + Hello port = null; + + if (platformMode.equals("jakartaEE")) { + port = (Hello) getJavaEEPort(); + } else { + port = (Hello) getStandAlonePort(); + } + + BindingProvider bindingProvider = (BindingProvider) port; + Map map = bindingProvider.getRequestContext(); + + TestUtil.logMsg( + "Setting the target endpoint address on WS port: " + urlString); + map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString); + + TestUtil.logMsg("Invoking sayHelloProtected on Hello port"); + String text = port.sayHelloProtected("Raja"); + TestUtil.logMsg("Got Output : " + text); + + } catch (Exception e) { + e.printStackTrace(); + throw new Fault("Test sayHelloProtected failed"); + } + + } + + /** + * @keywords: jaspic_soap + * + * @testName: GetConfigProvider + * + * @assertion_ids: JASPIC:SPEC:8; JASPIC:SPEC:14; JASPIC:SPEC:116; + * JASPIC:SPEC:117; JASPIC:JAVADOC:77; JASPIC:JAVADOC:79; + * JASPIC:JAVADOC:80; JASPIC:JAVADOC:84; JASPIC:JAVADOC:85; + * JASPIC:JAVADOC:91; JASPIC:SPEC:110; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether AuthConfigFactory.getConfigProvider is + * called in the server. + * + * Description The runtime must invoke + * AuthConfigFactory.getConfigProvider to obtain the + * AuthConfigProvider. The runtime must also specify + * appropriate(non-null) layer and application context + * identifiers in its call to getConfigProvider. + * + */ + public void GetConfigProvider() throws Fault { + boolean verified = false; + + String args[] = { "TSAuthConfigFactory.getConfigProvider called", + "getConfigProvider called for Layer : SOAP and AppContext :" + + expectedAppContextId }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("GetConfigProvider failed : " + + "AuthConfigFactory.getConfigProvider not called"); + } else + TestUtil.logMsg("TSAuthConfigFactory.getConfigProvider called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: GetFactory + * + * @assertion_ids: JASPIC:SPEC:7; JASPIC:SPEC:10; JASPIC:JAVADOC:77; + * JASPIC:JAVADOC:80; JASPIC:JAVADOC:84; JASPIC:JAVADOC:79; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether AuthConfigFactory.getConfigProvider is + * called in the server. + * + * Description The runtime must invoke + * AuthConfigFactory.getConfigProvider to obtain the + * AuthConfigProvider. By calling getConfigProvider, we can + * assume getFactory() was called. + * + */ + public void GetFactory() throws Fault { + boolean verified = false; + + String args[] = { "TSAuthConfigFactory.getFactory called Indirectly" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault( + "GetFactory failed : " + "AuthConfigFactory.getFactory not called"); + } else + TestUtil.logMsg("TSAuthConfigFactory.getFactory called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ServerAuthConfig + * + * @assertion_ids: JASPIC:SPEC:11; JASPIC:SPEC:13 ; JASPIC:SPEC:16; + * JASPIC:JAVADOC:95 + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether provider.getServerAuthConfig is called in + * the server. + * + * Description The runtime must invoke + * AuthConfigProvider.getServerAuthConfig() to obtain the + * AuthConfig. The runtime must also specify + * appropriate(non-null) layer(i.e for this test case "SOAP" + * layer) and application context identifiers in its call to + * getServerAuthConfig. + * + */ + public void ServerAuthConfig() throws Fault { + boolean verified = false; + + String args[] = { + "TSAuthConfigProvider.getServerAuthConfig called for layer=SOAP" + + " : appContext=" + expectedAppContextId }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ServerAuthConfig failed : " + + "AuthConfigProvider.getServerAuthConfig not called"); + } else + TestUtil.logMsg("TSAuthConfigProvider.getServerAuthConfig called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ClientAuthConfig + * + * @assertion_ids: JASPIC:SPEC:11; JASPIC:SPEC:12 ; JASPIC:SPEC:16; + * JASPIC:JAVADOC:92; JASPIC:JAVADOC:93; JASPIC:SPEC:110; + * JASPIC:SPEC:111 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether AuthConfigProvider.ClientAuthConfig is + * called in the server. + * + * Description The runtime must invoke + * AuthConfigProvider.getClientAuthConfig() to obtain the + * AuthConfig. The runtime must also specify + * appropriate(non-null) layer(i.e for this test case "SOAP" + * layer) and application context identifiers in its call to + * getClientAuthConfig. + * + */ + public void ClientAuthConfig() throws Fault { + boolean verified = false; + + String srchStrPrefix = "TSAuthConfigProvider.getClientAuthConfig called for layer=SOAP : appContext="; + + String args[] = { "service/HelloService", + "http://" + hostname + ":" + portnum + "/Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ClientAuthConfig failed : " + + "AuthConfigProvider.getClientAuthConfig not called"); + } else + TestUtil.logMsg("TSAuthConfigProvider.getClientAuthConfig called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: SecureRequest + * + * @assertion_ids: JASPIC:SPEC:35; JASPIC:JAVADOC:5; JASPIC:SPEC:36; + * JASPIC:JAVADOC:75 + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ClientAuthContext.secureRequest() is called + * + * Description The runtime must invoke + * ClientAuthContext.secureRequest() + * + */ + public void SecureRequest() throws Fault { + boolean verified = false; + + String args[] = { "TSClientAuthContext.secureRequest called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("SecureRequest failed : " + + "ClientAuthContext.secureRequest not called"); + } else + TestUtil.logMsg("ClientAuthContext.secureRequest called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ValidateResponse + * + * @assertion_ids: JASPIC:SPEC:42 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ClientAuthContext.validateResponse() is + * called + * + * Description The runtime must invoke + * ClientAuthContext.validateResponse() + * + */ + public void ValidateResponse() throws Fault { + boolean verified = false; + + String args[] = { "TSClientAuthContext.validateResponse called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("validateResponse failed : " + + "ClientAuthContext.validateResponse not called"); + } else + TestUtil.logMsg("ClientAuthContext.validateResponse called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ValidateRequest + * + * @assertion_ids: JASPIC:SPEC:50; JASPIC:JAVADOC:16; JASPIC:JAVADOC:17; + * JASPIC:JAVADOC:23; JASPIC:SPEC:23; JASPIC:SPEC:19 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ServerAuthContext.validateRequest() is + * called + * + * Description The runtime must invoke + * ServerAuthContext.validateRequest() + * + */ + public void ValidateRequest() throws Fault { + boolean verified = false; + + String args[] = { "TSServerAuthContext.validateRequest called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ValidateRequest failed : " + + "ServerAuthContext.validateRequest not called"); + } else + TestUtil.logMsg("ServerAuthContext.validateRequest called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: SecureResponse + * + * @assertion_ids: JASPIC:SPEC:59; JASPIC:JAVADOC:16; JASPIC:JAVADOC:17; + * JASPIC:JAVADOC:23; JASPIC:JAVADOC:26 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ServerAuthContext.secureResponse() is called + * + * Description The runtime must invoke + * ServerAuthContext.secureResponse() + * + */ + public void SecureResponse() throws Fault { + boolean verified = false; + + String args[] = { "TSServerAuthContext.secureResponse called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("SecureResponse failed : " + + "ServerAuthContext.secureResponse not called"); + } else + TestUtil.logMsg("ServerAuthContext.secureResponse called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ClientAuthContext + * + * @assertion_ids: JASPIC:SPEC:34; JASPIC:JAVADOC:72; JASPIC:JAVADOC:97; + * JASPIC:JAVADOC:98 + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ClientAuthConfig.getAuthContext() is called + * + * Description The runtime must invoke + * clientAuthConfig().getAuthContext() to obtain the + * ClientAuthContext. + * + */ + public void ClientAuthContext() throws Fault { + boolean verified = false; + + String srchStrPrefix = "TSClientAuthConfig.getAuthContext: layer=SOAP : appContext="; + + String args[] = { "service/HelloService", + "http://" + hostname + ":" + portnum + "/Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ClientAuthContext failed : " + + "clientAuthConfig.getAuthContext not called"); + } else + TestUtil.logMsg("clientAuthConfig.getAuthContext called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ServerAuthContext + * + * @assertion_ids: JASPIC:SPEC:34; JASPIC:JAVADOC:100; JASPIC:SPEC:153; + * JASPIC:SPEC:156; JASPIC:JAVADOC:101 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether ServerAuthConfig.getAuthContext() is called + * + * Description The runtime must invoke + * serverAuthConfig().getAuthContext() to obtain the + * ServerAuthContext. + * + */ + public void ServerAuthContext() throws Fault { + boolean verified = false; + String args[] = { + "TSServerAuthConfig.getAuthContext: layer=SOAP : appContext=" + + expectedAppContextId }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ServerAuthContext failed : " + + "serverAuthConfig.getAuthContext not called"); + } else + TestUtil.logMsg("serverAuthConfig.getAuthContext called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: MessageInfo + * + * @assertion_ids: JASPIC:SPEC:35; JASPIC:SPEC:44; JASPIC:JAVADOC:5; + * JASPIC:SPEC:112; JASPIC:JAVADOC:9; JASPIC:JAVADOC:10; + * JASPIC:JAVADOC:11; JASPIC:JAVADOC:28; JASPIC:SPEC:23; + * JASPIC:SPEC:19; JASPIC:SPEC:36; JASPIC:SPEC:37; + * JASPIC:SPEC:43; JASPIC:SPEC:51; JASPIC:SPEC:113; + * JASPIC:SPEC:131; JASPIC:SPEC:132; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the messageInfo passed to secureRequest() + * validateRequest(), secureResponse() and validateResponse() + * contiains right values for getRequestMessage() and + * getResponseMessage() as per the spec. + * + * 3. clientSubject - a Subject that represents the source of + * the service request, or null. + * + * Description The MessageInfo argument used in any call made + * by the message processing runtime to secureRequest, + * validateResponse, validateRequest, or secureResponse must + * have been initialized such that the non-null objects + * returned by the getRequestMessage and getResponseMessage + * methods of the MessageInfo are an instanceof + * jakarta.xml.soap.SOAPMessage. + * + * + */ + public void MessageInfo() throws Fault { + boolean verified = false; + + String args[] = { + "secureRequest : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage", + "validateRequest : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage", + "secureResponse : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage", + "secureResponse : MessageInfo.getResponseMessage() is of type jakarta.xml.soap.SOAPMessage", + "validateResponse : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage", + "validateResponse : MessageInfo.getResponseMessage() is of type jakarta.xml.soap.SOAPMessage" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("MessageInfo failed : " + + "The request and response messages contains incorrect values"); + } else + TestUtil.logMsg("MessageInfo contains right values"); + } + + /** + * @testName: NameAndPasswordCallbackSupport + * + * @assertion_ids: JASPIC:SPEC:123; JASPIC:JAVADOC:103 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether CallbackHandler for client runtime supports + * NameCallback and PasswordCallback + * + * Description Unless the client runtime is embedded in a + * server runtime (e.g.; an invocation of a web service by a + * servlet running in a Servlet container), The + * CallbackHandler passed to ClientAuthModule.initialize must + * support the following callbacks: NameCallback, + * PasswordCallback + * + */ + public void NameAndPasswordCallbackSupport() throws Fault { + boolean verified = false; + String args[] = { + "In SOAP : ClientRuntime CallbackHandler supports NameCallback", + "In SOAP : ClientRuntime CallbackHandler supports PasswordCallback" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("NameAndPasswordCallbackSupport failed"); + } else + TestUtil.logMsg( + "CallbackHandler supports NameCallback " + "and PasswordCallback"); + } + + /** + * @testName: ClientRuntimeCommonCallbackSupport + * + * @assertion_ids: JASPIC:SPEC:114; JASPIC:JAVADOC:35; JASPIC:JAVADOC:36; + * JASPIC:JAVADOC:49; JASPIC:JAVADOC:51; JASPIC:JAVADOC:54; + * JASPIC:JAVADOC:63; JASPIC:JAVADOC:65; JASPIC:JAVADOC:68; + * JASPIC:JAVADOC:69; JASPIC:JAVADOC:71; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether CallbackHandler for client runtime supports + * CertStoreCallback, PrivateKeyCallback, SecretKeyCallback, + * TrustStoreCallback + * + * Description + * + * The CallbackHandler passed to the initialize method of an + * authentication module should support the following + * callbacks, and it must be possible to configure the runtime + * such that the CallbackHandler passed at module + * initialization module supports the following callbacks (in + * addition to any others required to be supported by the + * applicable internal profile): CertStoreCallback, + * PrivateKeyCallback, SecretKeyCallback, TrustStoreCallback + * + * + */ + public void ClientRuntimeCommonCallbackSupport() throws Fault { + boolean verified = false; + String args[] = { + "In SOAP : ClientRuntime CallbackHandler supports CertStoreCallback", + "In SOAP : ClientRuntime CallbackHandler supports PrivateKeyCallback", + "In SOAP : ClientRuntime CallbackHandler supports SecretKeyCallback", + "In SOAP : ClientRuntime CallbackHandler supports TrustStoreCallback" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ClientRuntimeCommonCallbackSupport failed"); + } else + TestUtil.logMsg("SOAP Client Runtime CallbackHandler supports " + + "CertStoreCallback, PrivateKeyCallback, SecretKeyCallback" + + " and TrustStoreCallback "); + } + + /** + * @testName: ServerRuntimeCommonCallbackSupport + * + * @assertion_ids: JASPIC:SPEC:114; JASPIC:JAVADOC:35; JASPIC:JAVADOC:36; + * JASPIC:JAVADOC:49; JASPIC:JAVADOC:51; JASPIC:JAVADOC:54; + * JASPIC:JAVADOC:63; JASPIC:JAVADOC:65; JASPIC:JAVADOC:68; + * JASPIC:JAVADOC:69; JASPIC:JAVADOC:71; JASPIC:JAVADOC:106 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether CallbackHandler for server runtime supports + * CertStoreCallback, PrivateKeyCallback, SecretKeyCallback, + * TrustStoreCallback + * + * Description + * + * The CallbackHandler passed to the initialize method of an + * authentication module should support the following + * callbacks, and it must be possible to configure the runtime + * such that the CallbackHandler passed at module + * initialization module supports the following callbacks (in + * addition to any others required to be supported by the + * applicable internal profile): CertStoreCallback, + * PrivateKeyCallback, SecretKeyCallback, TrustStoreCallback + * + * + */ + public void ServerRuntimeCommonCallbackSupport() throws Fault { + boolean verified = false; + String args[] = { + "In SOAP : ServerRuntime CallbackHandler supports CertStoreCallback", + "In SOAP : ServerRuntime CallbackHandler supports PrivateKeyCallback", + "In SOAP : ServerRuntime CallbackHandler supports SecretKeyCallback", + "In SOAP : ServerRuntime CallbackHandler supports TrustStoreCallback" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ServerRuntimeCommonCallbackSupport failed"); + } else + TestUtil.logMsg("SOAP ServerRuntime CallbackHandler supports " + + "CertStoreCallback, PrivateKeyCallback, SecretKeyCallback" + + " and TrustStoreCallback "); + } + + /** + * @testName: ServerRuntimeCallbackSupport + * + * @assertion_ids: JASPIC:SPEC:114; JASPIC:SPEC:149; JASPIC:JAVADOC:38; + * JASPIC:JAVADOC:39; JASPIC:JAVADOC:40; JASPIC:JAVADOC:42; + * JASPIC:JAVADOC:43; JASPIC:JAVADOC:44; JASPIC:JAVADOC:46; + * JASPIC:JAVADOC:30; JASPIC:JAVADOC:41; JASPIC:JAVADOC:45 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether CallbackHandler for server runtime supports + * CallerPrincipalCallback, GroupPrincipalCallback and + * PasswordValidationCallback + * + * Description + * + * The CallbackHandler passed to the + * ServerAuthModule.initialize must support the following + * callbacks, + * + * CallerPrincipalCallback, GroupPrincipalCallback, + * PasswordValidationCallback + * + * + */ + public void ServerRuntimeCallbackSupport() throws Fault { + boolean verified = false; + String args[] = { + "In SOAP : ServerRuntime CallbackHandler supports CallerPrincipalCallback", + "In SOAP : ServerRuntime CallbackHandler supports GroupPrincipalCallback", + "In SOAP : ServerRuntime CallbackHandler supports PasswordValidationCallback" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ServerRuntimeCallbackSupport failed"); + } else + TestUtil.logMsg("SOAP ServerRuntime CallbackHandler supports " + + "CallerPrincipalCallback, GroupPrincipalCallback," + + " and PasswordValidationCallback "); + } + + /** + * @keywords: jaspic_soap + * + * @testName: OperationId + * + * @assertion_ids: JASPIC:SPEC:121; JASPIC:SPEC:125; JASPIC:JAVADOC:73 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the operationId is "sayHelloProtected" + * + * Description + * + * If getOperation returns a non-null operation identifier, + * then the operation identifier must be the String value + * corresponding to the operation name appearing in the + * service description (i.e., WSDL). + * + * When its getOperation method is called, any authentication + * context configuration object obtained for the SOAP layer, + * must attempt to derive the corresponding operation + * identifier value from the request message (within + * messageInfo). + * + * + */ + public void OperationId() throws Fault { + boolean verified = false; + + String args[] = { + "getAuthContextID() called for layer=SOAP shows AuthContextId=" + + "sayHelloProtected" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("OperationId failed"); + } else + TestUtil.logMsg("Valid OperationId returned"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACPClientAuthConfig + * + * @assertion_ids: JASPIC:SPEC:124; JASPIC:JAVADOC:77 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the arguments(layer and appcontextId) passed + * to obtain AuthConfigProvider is same as the arguments used + * in calling getClientAuthConfig. + * + * Description + * + * If a non-null AuthConfigProvider is returned (by the call + * to getConfigProvider), the messaging runtime must call + * getClientAuthConfig on the provider to obtain the + * authentication context configuration object pertaining to + * the application context at the layer. The layer and + * appContext arguments of the call to getClientAuthConfig + * must be the same as those used to acquire the provider. + * + * + */ + public void ACPClientAuthConfig() throws Fault { + boolean verified = false; + String srchStrPrefix = "TSAuthConfigFactory.getConfigProvider returned non-null provider for" + + " Layer : SOAP and AppContext :"; + + String args[] = { "service/HelloService", + "http://" + hostname + ":" + portnum + "/Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ACPClientAuthConfig failed"); + } else + TestUtil.logMsg("ACPClientAuthConfig : Same layer and appContextId used"); + + srchStrPrefix = "TSAuthConfigProvider.getClientAuthConfig called for " + + "layer=SOAP : appContext="; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ACPClientAuthConfig failed"); + } else + TestUtil.logMsg("ACPClientAuthConfig : Same layer and appContextId used"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACPAuthContext + * + * @assertion_ids: JASPIC:SPEC:125; JASPIC:SPEC:150; JASPIC:JAVADOC:5; + * JASPIC:JAVADOC:28; JASPIC:JAVADOC:73; JASPIC:JAVADOC:79 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the arguments(operation) passed to obtain + * getAuthContext is same as defined in Section 4.7.1 + * + * Description The authentication context identifier used in + * the call to getAuthContext must be equivalent to the value + * that would be acquired by calling getAuthContextID with the + * MessageInfo that will be used in the corresponding call to + * secureRequest (by a client runtime) or validateRequest (by + * a server runtime). + * + */ + public void ACPAuthContext() throws Fault { + boolean verified = false; + + String args[] = { + + "TSAuthConfigFactory.getConfigProvider returned non-null provider for" + + " Layer : SOAP and AppContext :" + expectedAppContextId, + + "TSServerAuthConfig.getAuthContext: layer=SOAP" + " : appContext=" + + expectedAppContextId + " operationId=sayHelloProtected" + + }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ACPAuthContext failed"); + } else + TestUtil.logMsg("Calls to getAuthContext contains valid server side" + + " Application Context Identifiers"); + + String srchStrPrefix = "TSClientAuthConfig.getAuthContext: layer=SOAP" + + " : appContext="; + + String cArgs[] = { "service/HelloService", + "http://" + hostname + ":" + portnum + "/Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(cArgs, + srchStrPrefix); + + if (!verified) { + throw new Fault("ACPAuthContext failed"); + } else + TestUtil.logMsg("Calls to getAuthContext contains valid operationId"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: CACRequestResponse + * + * @assertion_ids: JASPIC:SPEC:130; JASPIC:JAVADOC:7; JASPIC:JAVADOC:9; + * JASPIC:SPEC:19; JASPIC:SPEC:23; JASPIC:SPEC:129; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether for a non-null ClientAuthContext, + * secureRequest and validateResponse are called properly. + * + * Description + * + * If the client runtime obtained a non-null ClientAuthContext + * by using the operation identifier corresponding to the + * request message, then at point (1) in the message + * processing model, the runtime must call secureRequest on + * the ClientAuthContext, and at point (4) the runtime must + * call validateResponse on the ClientAuthContext. + * + * + */ + public void CACRequestResponse() throws Fault { + boolean verified = false; + + String args[] = { + + "TSClientAuthConfig.getAuthContext: returned non-null" + + " ClientAuthContext for operationId=sayHelloProtected", + + "TSClientAuthContext.secureRequest called", + + "TSClientAuthContext.validateResponse called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("CACRequestResponse failed"); + } else + TestUtil.logMsg("CAC secureRequest and validateResponse called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ClientRuntimeMessageInfoMap + * + * @assertion_ids: JASPIC:SPEC:133; JASPIC:JAVADOC:7 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether the Map in messageInfo object passed to + * secureRequest and validateResponse contains the right value + * for key jakarta.xml.ws.wsdl.service + * + * Description This profile requires that the message + * processing runtime establish the following key-value pairs + * within the Map of the MessageInfo passed in the calls to + * secureRequest and validateResponse + * Key=jakarta.xml.ws.wsdl.service Value= the value of the + * qualified service name, represented as a + * javax.xml.namespace.QName + * + */ + public void ClientRuntimeMessageInfoMap() throws Fault { + boolean verified = false; + + QName expectedQName = new QName("http://soap.spi.jaspic.tests.ts.sun.com/", + "HelloService"); + + String args[] = { + + "TSClientAuthModule.secureRequest messageInfo :" + + "jakarta.xml.ws.wsdl.service=" + expectedQName.toString(), + + "TSClientAuthModule.validateResponse messageInfo :" + + "jakarta.xml.ws.wsdl.service=" + expectedQName.toString() + + }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ClientRuntimeMessageInfoMap failed"); + } else + TestUtil.logMsg("ClientRuntimeMessageInfoMap contains right values"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACPServerAuthConfig + * + * @assertion_ids: JASPIC:SPEC:150; JASPIC:JAVADOC:79; JASPIC:JAVADOC:94 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify Whether the arguments(layer and appcontextId) passed + * to obtain AuthConfigProvider is same as the arguments used + * in calling getServerAuthConfig. + * + * Description + * + * If a non-null AuthConfigProvider is returned (by the call + * to getConfigProvider), the messaging runtime must call + * getServerAuthConfig on the provider to obtain the + * authentication context configuration object pertaining to + * the application context at the layer. The layer and + * appContext arguments of the call to getServerAuthConfig + * must be the same as those used to acquire the provider. + * + * + */ + public void ACPServerAuthConfig() throws Fault { + boolean verified = false; + + String args[] = { + "TSAuthConfigFactory.getConfigProvider returned non-null provider for" + + " Layer : SOAP and AppContext :" + expectedAppContextId, + + "TSAuthConfigProvider.getServerAuthConfig called for " + + "layer=SOAP : appContext=" + expectedAppContextId }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("ACPServerAuthConfig failed"); + } else + TestUtil.logMsg("ACPServerAuthConfig : Same layer and appContextId used"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: SACRequestResponse + * + * @assertion_ids: JASPIC:SPEC:130; JASPIC:JAVADOC:13; JASPIC:JAVADOC:16; + * JASPIC:JAVADOC:17; JASPIC:JAVADOC:23; JASPIC:JAVADOC:26; + * JASPIC:JAVADOC:28; JASPIC:SPEC:155; + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether for a non-null ServerAuthContext, + * validateRequest and secureResponse are called properly. + * + * Description + * + * If the server runtime obtained a non-null ServerAuthContext + * by using the operation identifier corresponding to the + * request message, then at point (2) in the message + * processing model, the runtime must call validateRequest on + * the ClientAuthContext, and at point (3) the runtime must + * call secureResponse on the ServerAuthContext. + * + * + */ + public void SACRequestResponse() throws Fault { + boolean verified = false; + + String args[] = { + + "TSServerAuthConfig.getAuthContext: returned non-null" + + " ServerAuthContext for operationId=sayHelloProtected", + + "TSServerAuthContext.validateRequest called", + + "TSServerAuthContext.secureResponse called" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContains(args); + + if (!verified) { + throw new Fault("SACRequestResponse failed"); + } else + TestUtil.logMsg("SAC validateRequest and secureResponse called"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ClientAppContextId + * + * @assertion_ids: JASPIC:SPEC:208 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether for the client side appilcation context + * Identifier is correctly used by the runtime. + * + * Description A Client application context Identifier must be + * the String value composed by concatenating the client scope + * identifier, a blank separator character, and the client + * reference to the service. The clien scope identifier is not + * testable but we can check the client reference to the + * service. + * + */ + public void ClientAppContextId() throws Fault { + boolean verified = false; + String srchStrPrefix = "TSAuthConfigProvider.getClientAuthConfig called for " + + "layer=SOAP : appContext="; + + String args[] = { + + "service/HelloService", + + "http://" + hostname + ":" + portnum + "/Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ClientAppContextId failed"); + } else + TestUtil.logMsg("Found right ClientAppContextId"); + + } + + /** + * @keywords: jaspic_soap + * + * @testName: ServerAppContextId + * + * @assertion_ids: JASPIC:SPEC:209 + * + * @test_Strategy: 1. Register TSSV with the AppServer. (See User guide for + * Registering TSSV with your AppServer ). + * + * 2. Use FetchLog servlet to read the server side log to + * verify whether for the server side appilcation context + * Identifier is correctly used by the runtime. + * + * Description A server application context Identifier shall + * be the String value composed by concatenating a logical + * hostname a blank separator character, and the path + * component of the service endpoint URI corresponding to the + * webservice. + */ + public void ServerAppContextId() throws Fault { + boolean verified = false; + String srchStrPrefix = "TSAuthConfigProvider.getServerAuthConfig called for " + + "layer=SOAP : appContext="; + + String args[] = { + + logicalHostName + " /Hello_web/Hello" }; + + // verify whether the log contains required messages. + verified = logProcessor.verifyLogContainsOneOfSubString(args, + srchStrPrefix); + + if (!verified) { + throw new Fault("ServerAppContextId failed"); + } else + TestUtil.logMsg("Found right ServerAppContextId"); + + } + + public Object getJavaEEPort() throws Exception { + TestUtil.logMsg("Get Hello Port from HelloService"); + Object port = service.getPort(Hello.class); + return port; + } + + public Object getStandAlonePort() throws Exception { + URL wsdlurl = new URL(urlString + "?WSDL"); + return WebServiceUtils.getPort(wsdlurl, SERVICE_QNAME, HelloService.class, + PORT_QNAME, Hello.class); + } + + public void cleanup() throws Fault { + logMsg("cleanup ok"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: AuthConfigFactoryRegistration + * + * @assertion_ids: JASPIC:JAVADOC:80 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. Use the system properties to read the TestSuite + * providers defined in ProviderConfigruation.xml file and + * register them with vendor's authconfig factory. + * + * + * Description + * + * + */ + public void AuthConfigFactoryRegistration() throws Fault { + boolean verified = false; + + verified = register(logFileLocation, providerConfigFileLocation, + vendorACFClass); + + if (!verified) { + throw new Fault("AuthConfigFactoryRegistration failed : "); + } else + TestUtil.logMsg("TestSuite Providers registration successful"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACFGetFactory + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:335; JASPIC:SPEC:7; + * + * @test_Strategy: This s mainly concerned with testing the runtimes handling + * of ACF as follows: - get current (CTS) ACF - switch to use + * different (CTS) ACF - verify calls to ACF use the + * newer/expected ACF - restore original ACF + */ + public void ACFGetFactory() throws Fault { + try { + commonTests._ACF_getFactory(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFGetFactory failed : "); + } + + TestUtil.logMsg("ACFGetFactory passed."); + + } + + /** + * + * @keywords: jaspic_soap + * + * @testName: ACFSwitchFactorys + * + * @assertion_ids: + * + * + * @test_Strategy: This test does the following: - gets current (CTS) factory + * - sets the vendors ACF thus replacing the CTS ACF - verify + * ACF's were correctly set - reset factory back to the + * original CTS factory + * + * 1. Use the static setFactory method to set an ACF and this + * should always work. and use the getFactory to verify it + * worked. + * + * Description + * + */ + public void ACFSwitchFactorys() throws Fault { + try { + commonTests._ACFSwitchFactorys(vendorACFClass); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFSwitchFactorys failed : "); + } + TestUtil.logMsg("ACFSwitchFactorys() passed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: testACFComesFromSecFile + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:330; + * + * @test_Strategy: This is calling a method on the server(actually servlet) + * side that will invoke getFactory() to verify a non-null + * facotry instance is returned. It will also verify that the + * authconfigprovider.factory security property is properly + * set/used. + * + */ + public void testACFComesFromSecFile() throws Fault { + try { + commonTests._testACFComesFromSecFile(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("testACFComesFromSecFile failed : "); + } + TestUtil.logMsg("testACFComesFromSecFile() passed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACFPersistentRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:329; JASPIC:SPEC:331; JASPIC:SPEC:332; + * JASPIC:SPEC:340; JASPIC:SPEC:341; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register another + * persistent ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - try to + * re-register (persistently) standalone provider - verify 2nd + * attempt at added standalone provider REPLACED the first but + * it should NOT have added another nor failed. - also confirm + * that regID for standalone ACP stayed the same after 1st and + * 2nd attempt to register standalone ACP - verify that the + * 2nd re-registering of ACP replaced the ACP AND the + * description. - unregister standalone ACP and setFactory + * back to CTS default + * + */ + public void ACFPersistentRegisterOnlyOneACP() throws Fault { + try { + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFileLocation, vendorACFClass, true); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFPersistentRegisterOnlyOneACP failed : "); + } + TestUtil.logMsg("ACFPersistentRegisterOnlyOneACP() passed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACFInMemoryRegisterOnlyOneACP + * + * @assertion_ids: JASPIC:SPEC:334; JASPIC:SPEC:342; JASPIC:SPEC:343; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register + * (in-memory) ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - try to + * re-register (in-memory) standalone provider - verify 2nd + * attempt at added standalone provider REPLACED the first but + * it should NOT have added another nor failed. - also confirm + * that regID for standalone ACP stayed the same after 1st and + * 2nd attempt to register standalone ACP - verify that the + * 2nd re-registering of ACP replaced the ACP AND the + * description. - unregister standalone ACP and setFactory + * back to CTS default + * + */ + public void ACFInMemoryRegisterOnlyOneACP() throws Fault { + try { + commonTests._ACFRegisterOnlyOneACP(logFileLocation, + providerConfigFileLocation, vendorACFClass, false); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFInMemoryRegisterOnlyOneACP failed : "); + } + TestUtil.logMsg("ACFInMemoryRegisterOnlyOneACP() passed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: ACFUnregisterACP + * + * @assertion_ids: JASPIC:SPEC:344; + * + * @test_Strategy: This will make a server (actually servlet) side method call + * that will do the following: - load vendors ACF - + * (persistent) register of CTS ACP's in the vendors ACF - get + * list of vendors registered provider ID's - register + * (in-memory) ACP (this is standalone ACP profile) - verify + * another regId was added for standalone ACP - unregister the + * in-memory ACP we just registered - verify + * removeRegistration() method call returned proper boolean - + * verify expected # of registry eentries - verify 2nd call to + * removeRegistration() with regId that was previously removed + * and should expect return val of false + * + */ + public void ACFUnregisterACP() throws Fault { + try { + commonTests._ACFUnregisterACP(logFileLocation, providerConfigFileLocation, + vendorACFClass); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFUnregisterACP failed : "); + } + TestUtil.logMsg("ACFUnregisterACP() passed"); + } + + /** + * + * @keywords: jaspic_soap + * + * @testName: ACFRemoveRegistrationWithBadId + * + * @assertion_ids: JASPIC:SPEC:345; + * + * + * @test_Strategy: This test verifies we get a return value of False when + * invoking ACF.removeRegistration(some_bad_id); + * + * 1. Use the static setFactory method to get an ACF and then + * attempt to invoke removeRegistration() with an invalid (ie + * non-existant) regId. This should return False (per + * javadoc). + * + * Description + * + */ + public void ACFRemoveRegistrationWithBadId() throws Fault { + try { + commonTests._ACFRemoveRegistrationWithBadId(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new Fault("ACFRemoveRegistrationWithBadId failed : "); + } + TestUtil.logMsg("ACFRemoveRegistrationWithBadId() passed"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: getRegistrationContextId + * + * @assertion_ids: JASPIC:JAVADOC:77 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. Use the system properties to read the TestSuite + * providers defined in ProviderConfigruation.xml file and + * register them with vendor's authconfig factory. + * + * + * Description This will use an appContext value that was used + * to register a provider, and it will see if it can use the + * AuthConfigFactory.RegistrationContext API to try and access + * the same appContext value that was used during the + * registration process. + * + */ + public void getRegistrationContextId() throws Fault { + boolean verified = false; + String appContext = "localhost /Hello_web/Hello"; + + // register providers in vendor factory + verified = register(logFileLocation, providerConfigFileLocation, + vendorACFClass); + if (!verified) { + throw new Fault("getRegistrationContextId failed : "); + } + + // verify we can access a given provider (any provider) appcontext id + boolean bVerified = false; + + AuthConfigFactory acf = null; + + try { + acf = AuthConfigFactory.getFactory(); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory."; + msg = msg + " Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + } + + if (acf == null) { + throw new Fault("getRegistrationContextId failed : could not get acf"); + } + + String[] regIDs = acf.getRegistrationIDs(null); + for (int ii = 0; ii < regIDs.length; ii++) { + // loop through the ACF's registration ids + + if (regIDs[ii] != null) { + AuthConfigFactory.RegistrationContext acfReg; + acfReg = acf.getRegistrationContext(regIDs[ii]); + if (acfReg != null) { + TestUtil.logMsg("appContext = " + appContext); + TestUtil.logMsg("acfReg.getAppContext() = " + acfReg.getAppContext()); + TestUtil.logMsg("layer = " + acfReg.getMessageLayer()); + String str = acfReg.getAppContext(); + if ((str != null) && (str.equals(appContext))) { + // we found our provider info + TestUtil + .logMsg("Found it : RegistrationID for our ACP=" + regIDs[ii]); + bVerified = true; + break; + } + } + } + } + + if (!bVerified) { + String msg = "Could not find appContext=" + appContext; + msg += " in the ACF's list of registration id info"; + TestUtil.logMsg(msg); + throw new Fault("getRegistrationContextId failed : "); + } + + TestUtil.logMsg("TestSuite Providers registration successful"); + } + + /** + * @keywords: jaspic_soap + * + * @testName: AuthConfigFactoryVerifyPersistence + * + * @assertion_ids: JASPIC:JAVADOC:75 + * + * @test_Strategy: 1. Get System properties log.file.location, + * provider.configuration.file and vendor.authconfig.factory + * + * 2. Load vendor's AuthConfigFactory and make sure the + * registered providers return properly for the right message + * layer and appContextId + * + * Note: We test the persistance behaviour for vendor's + * AuthConfigFactory by registering providers from a persisted + * file, then we verify the registrations went correctly. + * + * Description + * + * + */ + public void AuthConfigFactoryVerifyPersistence() throws Fault { + + boolean verified = false; + + try { + + // register providers in vendor factory + verified = register(logFileLocation, providerConfigFileLocation, + vendorACFClass); + if (!verified) { + throw new Fault("getRegistrationContextId failed : "); + } + + // Get system default AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + TestUtil.logMsg("Default AuthConfigFactory class name = " + + acf.getClass().getName()); + + verified = verifyRegistrations(acf); + + } else { + TestUtil.logErr("Default AuthConfigFactory is null" + + " can't verify registrations for TestSuite Providers"); + } + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory."; + msg = msg + " Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + + } catch (Exception e) { + e.printStackTrace(); + } + + if (!verified) { + throw new Fault("AuthConfigFactoryPersistence failed : "); + } else + TestUtil.logMsg("AuthConfigFactory Persistence works"); + } + + public boolean register(String logFileLocation, + String providerConfigFileLocation, String vendorACFClass) { + + try { + + printVerticalIndent(); + + // Get an instance of Vendor's AuthConfigFactory + AuthConfigFactory vFactory = getVendorAuthConfigFactory(vendorACFClass); + + // Set vendor's AuthConfigFactory + AuthConfigFactory.setFactory(vFactory); + + // Get system default AuthConfigFactory + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + if (acf != null) { + TestUtil.logMsg("Default AuthConfigFactory class name = " + + acf.getClass().getName()); + + } else { + TestUtil.logErr("Default AuthConfigFactory is null" + + " can't register TestSuite Providers with null"); + // System.exit(1); + return false; + } + + /** + * Read the ProviderConfiguration XML file This file contains the list of + * providers that needs to be loaded by the vendor's default + * AuthConfigFactory + */ + providerConfigurationEntriesCollection = readProviderConfigurationXMLFile(); + + ProviderConfigurationEntry pce = null; + + printVerticalIndent(); + Iterator iterator = providerConfigurationEntriesCollection.iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with vendor's default AuthConfigFactory + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + TestUtil.logMsg( + "Registering Provider " + pce.getProviderClassName() + " ..."); + acf.registerConfigProvider(pce.getProviderClassName(), + pce.getProperties(), pce.getMessageLayer(), + pce.getApplicationContextId(), pce.getRegistrationDescription()); + TestUtil.logMsg("Registration Successful"); + } + } + printVerticalIndent(); + + // Check whether the providers are registered for the right message layer + // and appContext + // verifyRegistrations(acf); + + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + + } catch (Exception e) { + TestUtil.logMsg("Error Registering TestSuite AuthConfig Providers"); + e.printStackTrace(); + } + + return true; + + } + + /** + * This method instantiates and ruturns a AuthConfigFactory based on the + * specified className + */ + private AuthConfigFactory getVendorAuthConfigFactory(String className) { + + AuthConfigFactory vFactory = null; + + if (className != null) { + try { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + Class clazz = Class.forName(className, true, loader); + + vFactory = (AuthConfigFactory) clazz.newInstance(); + TestUtil.logMsg("Instantiated Vendor's AuthConfigFactory"); + + } catch (Exception e) { + TestUtil.logMsg("Error instantiating vendor's " + + "AuthConfigFactory class :" + className); + e.printStackTrace(); + + } + } + + return vFactory; + } + + private void printVerticalIndent() { + TestUtil + .logMsg("**********************************************************"); + TestUtil.logMsg("\n"); + + } + + private boolean verifyRegistrations(AuthConfigFactory acf) { + TestUtil.logMsg("Verifying Provider Registrations ..."); + + try { + + // create a Registration listener + RegistrationListener rlis = new TSRegistrationListener(); + + // Get AuthConfigProvider for soap layer + AuthConfigProvider acp = acf.getConfigProvider(JASPICData.LAYER_SOAP, + soapAppContext, rlis); + + if (acp != null) { + if (acp.getClass().getName().equals( + "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProvider")) { + TestUtil.logMsg("TSAuthConfigProvider registered for" + + " message layer=SOAP" + " and appContextId=" + soapAppContext); + } else { + TestUtil.logMsg("Wrong provider registerd for " + + " message layer=SOAP" + " and appContextId=" + soapAppContext); + return false; + + } + + } else { + TestUtil.logMsg("Error : No AuthConfigprovider registerd for" + + " message layer=SOAP" + " and appContextId=" + soapAppContext); + return false; + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return true; + + } + + /* + * Read the provider configuration XML file and registers each provider with + * Vendor's default AuthConfigFactory + */ + private Collection readProviderConfigurationXMLFile() { + Collection providerConfigurationEntriesCollection = null; + + TestUtil.logMsg( + "Reading TestSuite Providers from :" + providerConfigFileLocation); + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + configFileProcessor = new ProviderConfigurationXMLFileProcessor( + providerConfigFileLocation); + + // Retrieve the ProviderConfigurationEntries collection + providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + TestUtil.logMsg("TestSuite Providers read successfully " + + "from ProviderConfiguration.xml file"); + + return providerConfigurationEntriesCollection; + + } catch (Exception e) { + TestUtil.logMsg("Error loading Providers"); + e.printStackTrace(); + } + return null; + + } + + /* + * This is used to make sure we have the correct Factory class being used. + * + */ + private void setFactoryClass(String acfClass) { + + try { + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + Object acfObj = (Object) acf; + if (!(acfObj instanceof com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory)) { + if (acf != null) { + String curClass = acf.getClass().getName(); + + TestUtil.logMsg("Changing factory to class: " + acfClass + + " from class: " + curClass); + } + AuthConfigFactory correctAcf = new TSAuthConfigFactory(); + AuthConfigFactory.setFactory(correctAcf); + } + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + } + } + + /** + * + * @keywords: jaspic_soap + * + * @testName: AuthConfigFactorySetFactory + * + * @assertion_ids: JASPIC:SPEC:7; JASPIC:SPEC:10; JASPIC:JAVADOC:87; + * JASPIC:JAVADOC:80 + * + * @test_Strategy: 1. Use the static setFactory method to set an ACF and this + * should always work. + * + * Description This method uses the getFactory() method to get + * the current factory, then it uses the setFactory() to + * change the current ACF. This method then verifies that the + * ACF's were indeed changed. We know that the setFactory() + * works as it is used in the bootstrap process - but this is + * an additional level of testing that allows us to set the + * factory in a slightly different manner than the bootstrap + * (eg reading it out of the java.security file. + */ + public void AuthConfigFactorySetFactory() throws Fault { + try { + // get current AuthConfigFactory + AuthConfigFactory currentAcf = AuthConfigFactory.getFactory(); + if (currentAcf == null) { + TestUtil.logMsg("FAILURE - Could not get current AuthConfigFactory."); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } + String currentACFClass = currentAcf.getClass().getName(); + TestUtil.logMsg("currentACFClass = " + currentACFClass); + + // set our ACF to a new/different AuthConfigFactory + TSAuthConfigFactoryForStandalone newAcf = new TSAuthConfigFactoryForStandalone(); + AuthConfigFactory.setFactory(newAcf); + String newACFClass = newAcf.getClass().getName(); + TestUtil.logMsg("newACFClass = " + newACFClass); + + // verify our calls to getFactory() are getting the newly set factory + // instance and not the original ACF instance + AuthConfigFactory testAcf = AuthConfigFactory.getFactory(); + if (testAcf == null) { + TestUtil.logMsg("FAILURE - Could not get newly set AuthConfigFactory."); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } + String newlySetACFClass = testAcf.getClass().getName(); + TestUtil.logMsg("newlySetACFClass = " + newlySetACFClass); + + // Verify ACF's were set correctly + if (!newlySetACFClass.equals(newACFClass)) { + TestUtil.logMsg( + "FAILURE - our current ACF does not match our newly set ACF"); + throw new Fault("AuthConfigFactorySetFactory : FAILED"); + } else { + String msg = "newlySetACFClass == newACFClass == " + newACFClass; + TestUtil.logMsg(msg); + } + + // restore original factory class + AuthConfigFactory.setFactory(currentAcf); + + TestUtil.logMsg("AuthConfigFactorySetFactory : PASSED"); + } catch (SecurityException ex) { + // if here we may not have permission to invoke ACF.getFactory... + String msg = "SecurityException: make sure you have permission to call ACF.getFactory"; + msg = msg + + "or ACF.setFactory(). Check your server side security policies."; + TestUtil.logMsg(msg); + ex.printStackTrace(); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Hello.ear.sun-application.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Hello.ear.sun-application.xml new file mode 100644 index 0000000..87fa703 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/Hello.ear.sun-application.xml @@ -0,0 +1,27 @@ + + + + + + 0 + + Administrator + j2ee + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloImpl.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloImpl.java new file mode 100644 index 0000000..7e5af1b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloImpl.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.spi.soap; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService(name = "Hello", serviceName = "HelloService") + +public class HelloImpl { + + @WebMethod + public String sayHelloProtected(String param) { + + return "Hello " + param; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService.wsdl b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService.wsdl new file mode 100644 index 0000000..d0ce2d5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService_schema1.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService_schema1.xsd new file mode 100644 index 0000000..da88ee9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/HelloService_schema1.xsd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/build.xml new file mode 100644 index 0000000..35268be --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/build.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/jakartaEE.web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/jakartaEE.web.xml new file mode 100644 index 0000000..b1d3af5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/spi/soap/jakartaEE.web.xml @@ -0,0 +1,42 @@ + + + + + soap_app + + Hello + com.sun.ts.tests.jaspic.spi.soap.HelloImpl + 0 + + ADM + Administrator + + + + Hello + /Hello + + + 54 + + + the administrator role + Administrator + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/build.xml new file mode 100644 index 0000000..2cdbfb8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/ProviderConfiguration.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/ProviderConfiguration.xml new file mode 100644 index 0000000..70c364c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/ProviderConfiguration.xml @@ -0,0 +1,64 @@ + + + + + + com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProvider + + false + USER_NAME_PASSWORD + + SOAP + null + TestSuite JSR 196 Config Provider + + + com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProvider + + false + USER_NAME_PASSWORD + + SOAP + localhost /Hello_web/Hello + TestSuite JSR 196 Config Provider + + + com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet + + true + USER_NAME_PASSWORD + + HttpServlet + server /spitests_servlet_web + Registration for TSAuthConfigProviderServlet using spitests_servlet_web + + + com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet + + true + USER_NAME_PASSWORD + + HttpServlet + server /spitests_servlet_web/WrapperServlet + Registration for TSAuthConfigProviderServlet using spitests_servlet_web + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/SOAPTSServerAuthConfig.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/SOAPTSServerAuthConfig.java new file mode 100644 index 0000000..9abc0d5 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/SOAPTSServerAuthConfig.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Iterator; +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.MessageInfo; +import jakarta.xml.soap.MimeHeaders; +import jakarta.xml.soap.Name; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +public class SOAPTSServerAuthConfig extends TSServerAuthConfig { + + protected SOAPTSServerAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props) { + super(layer, applicationCtxt, cbkHandler, props); + } + + public SOAPTSServerAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props, TSLogger tsLogger) { + + super(layer, applicationCtxt, cbkHandler, props); + + if (tsLogger != null) { + logger = tsLogger; + } + + String str = "TSServerAuthConfig called for layer=" + layer + + " : appContext=" + applicationCtxt; + logger.log(Level.INFO, str); + } + + @Override + public String getAuthContextID(MessageInfo messageInfo) { + logger.log(Level.INFO, "getAuthContextID called"); + String rval = null; + + if (messageLayer.equals(JASPICData.LAYER_SOAP)) { + + rval = getOpName((SOAPMessage) messageInfo.getRequestMessage()); + + String logMsg = "getAuthContextID() called for layer=" + messageLayer; + logMsg += " shows AuthContextId=" + rval; + logger.log(Level.INFO, logMsg); + + } else if (messageLayer.equals(JASPICData.LAYER_SERVLET)) { + + super.getAuthContextID(messageInfo); + + } else { + + rval = null; + + } + + return rval; + } + + private String getOpName(SOAPMessage message) { + if (message == null) { + return null; + } + + String rvalue = null; + + // first look for a SOAPAction header. + // this is what .net uses to identify the operation + + MimeHeaders headers = message.getMimeHeaders(); + if (headers != null) { + String[] actions = headers.getHeader("SOAPAction"); + if (actions != null && actions.length > 0) { + rvalue = actions[0]; + if (rvalue != null && rvalue.equals("\"\"")) { + rvalue = null; + } + } + } + + // if that doesn't work then we default to trying the name + // of the first child element of the SOAP envelope. + + if (rvalue == null) { + Name name = getName(message); + if (name != null) { + rvalue = name.getLocalName(); + } + } + + return rvalue; + } + + private Name getName(SOAPMessage message) { + Name rvalue = null; + SOAPPart soap = message.getSOAPPart(); + if (soap != null) { + try { + SOAPEnvelope envelope = soap.getEnvelope(); + if (envelope != null) { + SOAPBody body = envelope.getBody(); + if (body != null) { + Iterator it = body.getChildElements(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof SOAPElement) { + rvalue = ((SOAPElement) o).getElementName(); + break; + } + } + } + } + } catch (SOAPException se) { + if (logger.isLoggable(Level.FINE)) { + logger.log(Level.FINE, "WSS: Unable to get SOAP envelope", se); + } + } + } + + return rvalue; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactory.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactory.java new file mode 100644 index 0000000..8477edc --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactory.java @@ -0,0 +1,733 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.Vector; +import java.util.logging.Level; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationEntry; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationXMLFileProcessor; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.RegistrationListener; +import jakarta.security.auth.message.module.ServerAuthModule; + +/** + * + * @author Raja Perumal + * + * This is an AuthConfigFactory implementation class that will get + * loaded by the MessageProcessingRuntime (MPR). Once this is loaded + * into the MPR and the the constructor is called, the constructor will + * call a series of methods that will ultimately be performing the + * assertion tests and logging results. It will be the responsibility of + * the client code to verify results. + * + * Important: It is very likely that the logged messages of this class + * are being searched for in the logfile by the client code. Because of + * this, refrain from changing log messages in this file. + * + */ +public class TSAuthConfigFactory + extends jakarta.security.auth.message.config.AuthConfigFactory { + + private static TSLogger logger = null; + + private static Map authConfigProviderMap = new Hashtable(); + + private static Map registrationListenerMap = new Hashtable(); + + private static Map registrationContextMap = new Hashtable(); + + private static ProviderConfigurationXMLFileProcessor configFileProcessor = null; + + public TSAuthConfigFactory() { + initializeTSLogger(); + logger.log(Level.INFO, "Initialized TSLogger"); + readProviderConfigurationXMLFile(); + + // To print all the registered providers + // logger.log(Level.INFO, "KeysRegistered = "+ + // returnString(getRegistrationIDs(null))); + } + + /* + * Read the provider configuration XML file and registers each provider with + * TSAuthConfigFactory + */ + private void readProviderConfigurationXMLFile() { + String providerConfigFileLocation = System + .getProperty("provider.configuration.file"); + + if (providerConfigFileLocation == null) { + // looks like prop (via jvm option) is not set correctly + logger.log(Level.SEVERE, + "provider.configuration.file property is not properly set/specified"); + System.out.println( + "provider.configuration.file property is not properly set/specified"); + } + + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + configFileProcessor = new ProviderConfigurationXMLFileProcessor( + providerConfigFileLocation); + + // Retrieve the ProviderConfigurationEntries collection + Collection providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + ProviderConfigurationEntry pce = null; + + Iterator iterator = providerConfigurationEntriesCollection + .iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with TSAuthConfigFactory + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + // System.out.println("XXXX: pce.getApplicationContextId() = " + + // pce.getApplicationContextId()); + registerConfigProvider(pce.getProviderClassName(), + pce.getProperties(), pce.getMessageLayer(), + pce.getApplicationContextId(), pce.getRegistrationDescription()); + } + } + + } catch (Exception e) { + e.printStackTrace(); + if ((e.getMessage() != null) && (!e.getMessage().equals(""))) { + logger.log(Level.SEVERE, e.getMessage()); + } else { + logger.log(Level.SEVERE, "Error in readProviderConfigurationXMLFile()"); + } + } + + } + + /** + * Get a registered AuthConfigProvider from the factory. + * + * Get the provider of ServerAuthConfig and/or ClientAuthConfig objects + * registered for the identified message layer and application context. + * + * @param layer + * a String identifying the message layer for which the registered + * AuthConfigProvider is to be returned. This argument may be null. + * + * @param appContext + * a String that identifys the application messaging context for + * which the registered AuthConfigProvider is to be returned. This + * argument may be null. + * + * @param listener + * the RegistrationListener whose notify method is to be + * invoked if the corresponding registration is unregistered or + * replaced. The value of this argument may be null. + * + * @return the implementation of the AuthConfigProvider interface registered + * at the factory for the layer and appContext or null if no + * AuthConfigProvider is selected. + * + *

+ * All factories shall employ the following precedence rules to select + * the registered AuthConfigProvider that matches the layer and + * appContext arguments: + *

    + *
  • The provider that is specifically registered for both the + * corresponding message layer and appContext shall be selected. + *
  • if no provider is selected according to the preceding rule, the + * provider specifically registered for the corresponding appContext + * and for all message layers shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the provider specifically registered for the corresponding message + * layer and for all appContexts shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the provider registered for all message layers and for all + * appContexts shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the factory shall terminate its search for a registered provider. + *
+ */ + @Override + public AuthConfigProvider getConfigProvider(String layer, String appContext, + RegistrationListener listener) { + AuthConfigProvider localACP = null; + + // Runtime calls getConfigProvider() after calling + // AuthConfigFactory.getFactory() + // So we can assume TSAuthConfigFactory.getFactory() was called indirectly + logger.log(Level.INFO, "TSAuthConfigFactory.getFactory called Indirectly"); + logger.log(Level.INFO, "TSAuthConfigFactory.getConfigProvider called"); + logger.log(Level.INFO, "getConfigProvider called for Layer : " + layer + + " and AppContext :" + appContext); + + if (authConfigProviderMap != null) { + localACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + + // check if a provider is registered for null appContextId (i.e for all + // appContextId) + if (localACP == null) { + localACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + "null"); + } + // register the listener for AuthConfigProvider + if ((listener != null) && (localACP != null)) { + registrationListenerMap.put(localACP, listener); + } + + String logMsg = "TSAuthConfigFactory.getConfigProvider returned non-null provider for"; + logMsg += " Layer : " + layer + " and AppContext :" + appContext; + logger.log(Level.INFO, logMsg); + return localACP; + } else { + String logMsg = "TSAuthConfigFactory.getConfigProvider returned null provider for"; + logMsg += " Layer : " + layer + " and AppContext :" + appContext; + logger.log(Level.INFO, logMsg); + return null; + } + + } + + /** + * Get the the registration context for the identified registration. + * + * @param registrationID + * a String that identifies a provider registration at the factory + * + * @return a RegistrationContext or null. When a Non-null value is returned, + * it is a copy of the registration context corresponding to the + * registration. Null is returned when the registration identifier + * does not correpond to an active registration + */ + @Override + public RegistrationContext getRegistrationContext(String registrationID) { + return (RegistrationContext) registrationContextMap.get(registrationID); + } + + /** + * Get the registration identifiers for all registrations of the provider + * instance at the factory. + * + * @param provider + * the AuthConfigurationProvider whose registration identifiers are + * to be returned. This argument may be null, in which case, it + * indicates that the the id's of all active registration within the + * factory are returned. + * + * @return an array of String values where each value identifies a provider + * registration at the factory. This method never returns null; it + * returns an empty array when their are no registrations at the + * factory for the identified provider. + */ + @Override + public String[] getRegistrationIDs(AuthConfigProvider provider) { + + Vector keyMatchVector = new Vector(); + + if (provider != null) { + Set entries = authConfigProviderMap.entrySet(); + Iterator iterator = entries.iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + // Add all the matching keys to keyMatchVector + if (entry.getValue().equals(provider)) { + keyMatchVector.add(entry.getKey()); + } + } + } else { + // if provider=null then return all keys from authConfigProviderMap + Set authConfigProviderMapKeySet = authConfigProviderMap.keySet(); + + Iterator iterator = authConfigProviderMapKeySet.iterator(); + while (iterator.hasNext()) { + // Add all keys to keyMatchVector + keyMatchVector.add(iterator.next()); + } + } + + // create the result string array using keyMatchVector + String result[] = new String[keyMatchVector.size()]; + int index = 0; + + Iterator keyMatchVectorIterator = keyMatchVector.iterator(); + + while (keyMatchVectorIterator.hasNext()) { + // populate result string array with the contents of keyMatchVector + result[index++] = (String) keyMatchVectorIterator.next(); + } + + return result; + } + + /** + * Disassociate the listener from all the provider registrations whose layer + * and appContext values are matched by the corresponding arguments to this + * method. + * + * @param listener + * the RegistrationListener to be detached. + * + * @param layer + * a String identifying the message layer or null. + * + * @param appContext + * a String value identifying the application contex or null. + * + * @return an array of String values where each value identifies a provider + * registration from which the listener was removed. This method never + * returns null; it returns an empty array if the listener was not + * removed from any registrations. + * + * @exception SecurityException + * if the caller does not have permission to detach the listener + * from the factory. + * + */ + + @Override + public String[] detachListener(RegistrationListener listener, String layer, + String appContext) { + String[] str = { "" }; + return str; + } + + /** + * Remove the identified provider registration from the factory and invoke any + * listeners associated with the removed registration. + * + * @param registrationID + * a String that identifies a provider registration at the factory + * + * @return true if there was a registration with the specified identifier and + * it was removed. Return false if the registraionID was invalid. + * + * @exception SecurityException + * if the caller does not have permission to unregister the + * provider at the factory. + * + */ + @Override + public boolean removeRegistration(String registrationID) { + // get the corresponding ConfigProvider for registrationID + // and lookup any listeners associated with that provider, if so + // invoke notify method on them + registrationContextMap.remove(registrationID); + return (authConfigProviderMap.remove(registrationID) != null); + } + + /** + * Registers within the factory, a provider of ServerAuthConfig and/or + * ClientAuthConfig objects for a message layer and application context + * identifier. + * + *

+ * At most one registration may exist within the factory for a given + * combination of message layer and appContext. Any pre-existing registration + * with identical values for layer and appContext is replaced by a subsequent + * registration. When replacement occurs, the registration identifier, layer, + * and appContext identifier remain unchanged, and the AuthConfigProvider + * (with initialization properties) and description are replaced. + * + *

+ * Within the lifetime of its Java process, a factory must assign unique + * registration identifiers to registrations, and must never assign a + * previously used registration identifier to a registration whose message + * layer and or appContext identifier differ from the previous use. + * + *

+ * Programmatic registrations performed via this method must update (according + * to the replacement rules described above), the persistent declarative + * representation of provider registrations employed by the factory + * constructor. + * + * @param className + * the fully qualified name of an AuthConfigProvider implementation + * class. This argument must not be null. + * + * @param properties + * a Map object containing the initialization properties to be passed + * to the provider constructor. This argument may be null. When this + * argument is not null, all the values and keys occuring in the Map + * must be of type String. + * + * @param layer + * a String identifying the message layer for which the provider will + * be registered at the factory. A null value may be passed as an + * argument for this parameter, in which case, the provider is + * registered at all layers. + * + * @param appContext + * a String value that may be used by a runtime to request a + * configuration object from this provider. A null value may be + * passed as an argument for this parameter, in which case, the + * provider is registered for all configuration ids (at the indicated + * layers). + * + * @param description + * a text String descripting the provider. this value may be null. + * + * @return a String identifier assigned by the factory to the provider + * registration, and that may be used to remove the registration from + * the provider. + * + * @exception SecurityException + * if the caller does not have permission to register a provider + * at the factory. + * + * @exception AuthException + * if the provider construction or registration fails. + */ + @Override + public String registerConfigProvider(String className, Map properties, + String layer, String appContext, String description) { + String result = null; + AuthConfigProvider acp = null; + + // Hashtable can't store null as key or value so change the + // appcontextId to be string "null" if the input value is null + if (appContext == null) + appContext = "null"; + + if (layer == null) + layer = "null"; + + logger.log(Level.INFO, "registerConfigProvider() called for layer " + layer + + " and appContext " + appContext); + try { + // Here we instantiate only TSAuthConfigProvider + // this needs to be revisited. + if (className + .equals("com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProvider")) { + // instantiate CTS AuthConfigProviderImpl with logger + acp = new TSAuthConfigProvider(properties, null, logger); + } else if (className.equals( + "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet")) { + acp = new TSAuthConfigProviderServlet(properties, logger, null); + } else { + throw new RuntimeException("Unknown class : " + className); + } + + RegistrationContext previousRC = null; + AuthConfigProvider previousACP = null; + previousACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + previousRC = (RegistrationContext) registrationContextMap + .get(layer + appContext); + + if (previousACP == null) { + authConfigProviderMap.put(layer + appContext, acp); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, true)); + + // Add new provider to the persistent store(ProviderConfiguration.xml) + ProviderConfigurationXMLFileProcessor.addProviderConfigEntry(className, + properties, layer, appContext, description); + + } else if ((previousACP != null) + && (previousRC.isPersistent() == false)) { + authConfigProviderMap.put(layer + appContext, acp); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, true)); + + // Add new provider to the persistent store(ProviderConfiguration.xml) + ProviderConfigurationXMLFileProcessor.addProviderConfigEntry(className, + properties, layer, appContext, description); + } + result = layer + appContext; + + // logger.log(Level.INFO, "Registration Id = + // "+returnString(getRegistrationIDs(acp))); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception :" + e.getMessage()); + } + return result; + + } + + /** + * Registers within the (in-memory) factory, a provider of ServerAuthConfig + * and/or ClientAuthConfig objects for a message layer and application context + * identifier. This method does NOT effect the factory's persistent + * declarative representation of provider registrations, and intended to be + * used by Providers to perform self-Registration. + * + *

+ * At most one registration may exist within the factory for a given + * combination of message layer and appContext. Any pre-existing registration + * with identical values for layer and appContext is replaced by a subsequent + * registration. When replacement occurs, the registration identifier, layer, + * and appContext identifier remain unchanged, and the AuthConfigProvider + * (with initialization properties) and description are replaced. + * + *

+ * Within the lifetime of its Java process, a factory must assign unique + * registration identifiers to registrations, and must never assign a + * previously used registration identifier to a registration whose message + * layer and or appContext identifier differ from the previous use. + * + * @param provider + * the AuthConfigProvider to be registered at the factory (or null). + * Calling this method with a null value for this parameter shall + * cause getConfigProvider to return null when it + * iscalled with layer and appContext values for which the resulting + * registration is the best match. + * + * @param layer + * a String identifying the message layer for which the provider will + * be registered at the factory. A null value may be passed as an + * argument for this parameter, in which case, the provider is + * registered at all layers. + * + * @param appContext + * a String value that may be used by a runtime to request a + * configuration object from this provider. A null value may be + * passed as an argument for this parameter, in which case, the + * provider is registered for all configuration ids (at the indicated + * layers). + * + * @param description + * a text String descripting the provider. this value may be null. + * + * @return a String identifier assigned by the factory to the provider + * registration, and that may be used to remove the registration from + * the provider. + * + * @exception SecurityException + * if the caller does not have permission to register a provider + * at the factory. + * + * @exception AuthException + * if the provider registration fails. + */ + @Override + public String registerConfigProvider(AuthConfigProvider provider, + String layer, String appContext, String description) { + + String result = null; + String providerClassName = null; + + logger.log(Level.INFO, "registerConfigProvider() called for layer " + layer + + " and appContext " + appContext); + + if (provider == null) { + return result; + } + + try { + RegistrationContext previousRC = null; + AuthConfigProvider previousACP = null; + previousACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + previousRC = (RegistrationContext) registrationContextMap + .get(layer + appContext); + + if (previousACP == null) { + + authConfigProviderMap.put(layer + appContext, provider); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, false)); + + } else if ((previousACP != null) && (previousRC.isPersistent() == true)) { + // update registration context + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, false)); + + if (provider != null) { + providerClassName = provider.getClass().getName(); + } + + // delete existing provider from its persistent state + ProviderConfigurationXMLFileProcessor.deleteProviderConfigEntry( + providerClassName, layer, appContext, description); + } + result = layer + appContext; + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception :" + e.getMessage()); + } + + return result; + } + + /** + * Registers within the (in-memory) factory, an instance of a ServerAuthModule for a + * message layer and application context identifier as identified by a profile specific context object. + * + *

+ * This will override any other modules that have already been registered, either via proprietary + * means or using the standard API. The ServerAuthModule is removed, via a call to + * removeServerAuthModule when the context associated with the profile specific context object ends. + * + *

+ * Note that this method is a convenience method that can be used instead of registerConfigProvider, + * but should ultimately have the same effect. That is, the layer and appContext parameters + * are generated from the context object, and the ServerAuthModule is wrapped by an implementation + * specific AuthConfigProvider, which are then used to call registerConfigProvider or an + * internal method with the same effect. The returned registration ID is then associated with the profile specific + * context object, and also returned from this method. + * + *

+ * A "profile specific context object" is for example the ServletContext in the + * Servlet Container Profile. The context associated with this ServletContext ends + * when for example the application corresponding to it is undeployed. Association of the + * registration ID with the ServletContext simply means calling the setAttribute + * method on the ServletContext, with the registration ID as value. (The name attribute has not been + * standardised in this version of the specification) + * + * @param serverAuthModule the ServerAuthModule instance to be registered + * @param context the profile specific context of the application for which the module is registered + * @return A String identifier assigned by the factory to the provider registration, and that may be used to remove the + * registration from the factory. + */ + public String registerServerAuthModule(ServerAuthModule serverAuthModule, Object context) { + logger.log(Level.INFO, "registerServerAuthModule() called for serverAuthModule " + serverAuthModule + + " and context " + context); + return context.toString(); + } + + /** + * Remove the ServerAuthModule (and potentially encompassing wrappers/factories) that was previously registered via a call + * to registerServerAuthModule. + * + *

+ * Note that this method is a convenience method that can be used instead of removeRegistration, but should ultimately + * have the same effect. That is calling removeRegistration with the return value from registerServerAuthModule + * must have the same effect in that the ServerAuthModule is removed. + * + * @param context the profile specific context of the application for which the module is removed. + */ + public void removeServerAuthModule(Object context) { + logger.log(Level.INFO, "removeServerAuthModule() called for context " + context); + } + + /** + * Cause the factory to reprocess its persisent declarative representation of + * provider registrations. + * + *

+ * A factory should only replace an existing registration when a change of + * provider implementation class or initialization properties has occured. + * + * @exception AuthException + * if an error occured during the reinitialization. + * + * @exception SecurityException + * if the caller does not have permission to refresh the factory. + */ + @Override + public void refresh() { + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) + return; + else { + try { + logFileLocation = System.getProperty("log.file.location"); + System.out.println("logFileLocation = " + logFileLocation); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // create a new file + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } + + private String returnString(String[] array) { + String output = ""; + for (int i = 0; i < array.length; i++) { + output += "|" + array[i]; + } + + return output; + } + + private static class RegistrationContextImpl implements RegistrationContext { + private String messageLayer; + + private String appContext; + + private String description; + + private boolean isPersistent; + + private RegistrationContextImpl(String messageLayer, String appContext, + String description, boolean isPersistent) { + this.messageLayer = messageLayer; + this.appContext = appContext; + this.description = description; + this.isPersistent = isPersistent; + } + + @Override + public String getMessageLayer() { + return messageLayer; + } + + @Override + public String getAppContext() { + return appContext; + } + + @Override + public String getDescription() { + return description; + } + + /** + * Get the persisted status from the registration context. + * + * @return a boolean indicating whether the registration is the result of a + * className based registration, or an instance based (e.g. self-) + * registration. Only registrations performed by Class name are + * persistent. + */ + @Override + public boolean isPersistent() { + return isPersistent; + } + + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactoryForStandalone.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactoryForStandalone.java new file mode 100644 index 0000000..7229395 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigFactoryForStandalone.java @@ -0,0 +1,743 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.Vector; +import java.util.logging.Level; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationEntry; +import com.sun.ts.tests.jaspic.tssv.util.ProviderConfigurationXMLFileProcessor; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.RegistrationListener; +import jakarta.security.auth.message.module.ServerAuthModule; + +/** + * + * @author Raja Perumal + * + * This is an AuthConfigFactory implementation class that will get + * loaded by the MessageProcessingRuntime (MPR). Once this is loaded + * into the MPR and the the constructor is called, the constructor will + * call a series of methods that will ultimately be performing the + * assertion tests and logging results. It will be the responsibility of + * the client code to verify results. + * + * Important: It is very likely that the logged messages of this class + * are being searched for in the logfile by the client code. Because of + * this, refrain from changing log messages in this file. + * + */ +public class TSAuthConfigFactoryForStandalone + extends jakarta.security.auth.message.config.AuthConfigFactory { + + private static TSLogger logger = null; + + private static Map authConfigProviderMap = new Hashtable(); + + private static Map registrationListenerMap = new Hashtable(); + + private static Map registrationContextMap = new Hashtable(); + + private static ProviderConfigurationXMLFileProcessor configFileProcessor = null; + + public TSAuthConfigFactoryForStandalone() { + initializeTSLogger(); + logger.log(Level.INFO, "Initialized TSLogger"); + readProviderConfigurationXMLFile(); + + // To print all the registered providers + // logger.log(Level.INFO, "KeysRegistered = "+ + // returnString(getRegistrationIDs(null))); + } + + /* + * Read the provider configuration XML file and registers each provider with + * TSAuthConfigFactoryForStandalone + */ + private void readProviderConfigurationXMLFile() { + String providerConfigFileLocation = System + .getProperty("provider.configuration.file"); + + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + configFileProcessor = new ProviderConfigurationXMLFileProcessor( + providerConfigFileLocation); + + // Retrieve the ProviderConfigurationEntries collection + Collection providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + ProviderConfigurationEntry pce = null; + + Iterator iterator = providerConfigurationEntriesCollection + .iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with TSAuthConfigFactoryForStandalone + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + Map newProps = getCleanACPProps(pce.getProperties()); + registerConfigProvider(pce.getProviderClassName(), newProps, + pce.getMessageLayer(), pce.getApplicationContextId(), + pce.getRegistrationDescription()); + } + } + + } catch (Exception e) { + e.printStackTrace(); + if ((e.getMessage() != null) && (!e.getMessage().equals(""))) { + logger.log(Level.SEVERE, e.getMessage()); + } else { + logger.log(Level.SEVERE, "Error in readProviderConfigurationXMLFile()"); + } + } + + } + + /* + * When registering a config provider, the properties passed to the + * ACF.registerConfigProvider() call can ONLY contain props t hat are string + * types. Non-String types must NOT be passed to the registerConfigProvider() + * method. This method will 'clean' a Property map so that its props can be + * passed to the registerConfigProvider() method. + */ + private Map getCleanACPProps(Map origProps) { + + if (origProps == null) { + return null; + } + + HashMap props = new HashMap<>(); + + // loop thru passed in props and remove anything that is + // not of type String since only String type Props are allowed in our + // calls to registerConfigProvider() + for(String key : origProps.keySet()) { + if (key != null) { + Object val = origProps.get(key); + if ((val != null) && ((val instanceof java.lang.String))) { + // we found entry that is not String so remove it + props.put(key, (String) val); + System.out.println("TSAuthConfigFactoryForStandalone: added key=" + + key + " with value = " + val); + } else { + System.out.println( + "TSAuthConfigFactoryForStandalone: found non-string value for key=" + + key); + } + } + } + + return props; + } + + /** + * Get a registered AuthConfigProvider from the factory. + * + * Get the provider of ServerAuthConfig and/or ClientAuthConfig objects + * registered for the identified message layer and application context. + * + * @param layer + * a String identifying the message layer for which the registered + * AuthConfigProvider is to be returned. This argument may be null. + * + * @param appContext + * a String that identifys the application messaging context for + * which the registered AuthConfigProvider is to be returned. This + * argument may be null. + * + * @param listener + * the RegistrationListener whose notify method is to be + * invoked if the corresponding registration is unregistered or + * replaced. The value of this argument may be null. + * + * @return the implementation of the AuthConfigProvider interface registered + * at the factory for the layer and appContext or null if no + * AuthConfigProvider is selected. + * + *

+ * All factories shall employ the following precedence rules to select + * the registered AuthConfigProvider that matches the layer and + * appContext arguments: + *

    + *
  • The provider that is specifically registered for both the + * corresponding message layer and appContext shall be selected. + *
  • if no provider is selected according to the preceding rule, the + * provider specifically registered for the corresponding appContext + * and for all message layers shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the provider specifically registered for the corresponding message + * layer and for all appContexts shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the provider registered for all message layers and for all + * appContexts shall be selected. + *
  • if no provider is selected according to the preceding rules, + * the factory shall terminate its search for a registered provider. + *
+ */ + @Override + public AuthConfigProvider getConfigProvider(String layer, String appContext, + RegistrationListener listener) { + AuthConfigProvider localACP = null; + + // Runtime calls getConfigProvider() after calling + // AuthConfigFactory.getFactory() + logger.log(Level.INFO, "getConfigProvider called for Layer : " + layer + + " and AppContext :" + appContext); + + if (authConfigProviderMap != null) { + localACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + + // register the listener for AuthConfigProvider + if ((listener != null) && (localACP != null)) { + registrationListenerMap.put(localACP, listener); + } + + String logMsg = "getConfigProvider returned non-null provider for"; + logMsg += " Layer : " + layer + " and AppContext :" + appContext; + logger.log(Level.INFO, logMsg); + return localACP; + } else { + String logMsg = "getConfigProvider returned null provider for"; + logMsg += " Layer : " + layer + " and AppContext :" + appContext; + logger.log(Level.INFO, logMsg); + return null; + } + + } + + /** + * Get the the registration context for the identified registration. + * + * @param registrationID + * a String that identifies a provider registration at the factory + * + * @return a RegistrationContext or null. When a Non-null value is returned, + * it is a copy of the registration context corresponding to the + * registration. Null is returned when the registration identifier + * does not correpond to an active registration + */ + public RegistrationContext getRegistrationContext(String registrationID) { + return (RegistrationContext) registrationContextMap.get(registrationID); + } + + /** + * Get the registration identifiers for all registrations of the provider + * instance at the factory. + * + * @param provider + * the AuthConfigurationProvider whose registration identifiers are + * to be returned. This argument may be null, in which case, it + * indicates that the the id's of all active registration within the + * factory are returned. + * + * @return an array of String values where each value identifies a provider + * registration at the factory. This method never returns null; it + * returns an empty array when their are no registrations at the + * factory for the identified provider. + */ + public String[] getRegistrationIDs(AuthConfigProvider provider) { + + Vector keyMatchVector = new Vector(); + + if (provider != null) { + Set entries = authConfigProviderMap.entrySet(); + Iterator iterator = entries.iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + // Add all the matching keys to keyMatchVector + if (entry.getValue().equals(provider)) { + keyMatchVector.add(entry.getKey()); + } + } + } else { + // if provider=null then return all keys from authConfigProviderMap + Set authConfigProviderMapKeySet = authConfigProviderMap.keySet(); + + Iterator iterator = authConfigProviderMapKeySet.iterator(); + while (iterator.hasNext()) { + // Add all keys to keyMatchVector + keyMatchVector.add(iterator.next()); + } + } + + // create the result string array using keyMatchVector + String result[] = new String[keyMatchVector.size()]; + int index = 0; + + Iterator keyMatchVectorIterator = keyMatchVector.iterator(); + + while (keyMatchVectorIterator.hasNext()) { + // populate result string array with the contents of keyMatchVector + result[index++] = (String) keyMatchVectorIterator.next(); + } + + return result; + } + + /** + * Disassociate the listener from all the provider registrations whose layer + * and appContext values are matched by the corresponding arguments to this + * method. + * + * @param listener + * the RegistrationListener to be detached. + * + * @param layer + * a String identifying the message layer or null. + * + * @param appContext + * a String value identifying the application contex or null. + * + * @return an array of String values where each value identifies a provider + * registration from which the listener was removed. This method never + * returns null; it returns an empty array if the listener was not + * removed from any registrations. + * + * @exception SecurityException + * if the caller does not have permission to detach the listener + * from the factory. + * + */ + @Override + public String[] detachListener(RegistrationListener listener, String layer, + String appContext) { + return null; + } + + /** + * Remove the identified provider registration from the factory and invoke any + * listeners associated with the removed registration. + * + * @param registrationID + * a String that identifies a provider registration at the factory + * + * @return true if there was a registration with the specified identifier and + * it was removed. Return false if the registraionID was invalid. + * + * @exception SecurityException + * if the caller does not have permission to unregister the + * provider at the factory. + * + */ + @Override + public boolean removeRegistration(String registrationID) { + // get the corresponding ConfigProvider for registrationID + // and lookup any listeners associated with that provider, if so + // invoke notify method on them + registrationContextMap.remove(registrationID); + return (authConfigProviderMap.remove(registrationID) != null); + } + + /** + * Registers within the factory, a provider of ServerAuthConfig and/or + * ClientAuthConfig objects for a message layer and application context + * identifier. + * + *

+ * At most one registration may exist within the factory for a given + * combination of message layer and appContext. Any pre-existing registration + * with identical values for layer and appContext is replaced by a subsequent + * registration. When replacement occurs, the registration identifier, layer, + * and appContext identifier remain unchanged, and the AuthConfigProvider + * (with initialization properties) and description are replaced. + * + *

+ * Within the lifetime of its Java process, a factory must assign unique + * registration identifiers to registrations, and must never assign a + * previously used registration identifier to a registration whose message + * layer and or appContext identifier differ from the previous use. + * + *

+ * Programmatic registrations performed via this method must update (according + * to the replacement rules described above), the persistent declarative + * representation of provider registrations employed by the factory + * constructor. + * + * @param className + * the fully qualified name of an AuthConfigProvider implementation + * class. This argument must not be null. + * + * @param properties + * a Map object containing the initialization properties to be passed + * to the provider constructor. This argument may be null. When this + * argument is not null, all the values and keys occuring in the Map + * must be of type String. + * + * @param layer + * a String identifying the message layer for which the provider will + * be registered at the factory. A null value may be passed as an + * argument for this parameter, in which case, the provider is + * registered at all layers. + * + * @param appContext + * a String value that may be used by a runtime to request a + * configuration object from this provider. A null value may be + * passed as an argument for this parameter, in which case, the + * provider is registered for all configuration ids (at the indicated + * layers). + * + * @param description + * a text String descripting the provider. this value may be null. + * + * @return a String identifier assigned by the factory to the provider + * registration, and that may be used to remove the registration from + * the provider. + * + * @exception SecurityException + * if the caller does not have permission to register a provider + * at the factory. + * + * @exception AuthException + * if the provider construction or registration fails. + */ + @Override + public String registerConfigProvider(String className, Map properties, + String layer, String appContext, String description) { + String result = null; + AuthConfigProvider acp = null; + String theClass = "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderStandalone"; + + logger.log(Level.INFO, "registerConfigProvider() called for layer " + layer + + " and appContext " + appContext); + try { + // Here we instantiate only TSAuthConfigProvider + // this needs to be revisited. + if (className + .equals("com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProvider")) { + // instantiate CTS AuthConfigProviderImpl with logger + acp = new TSAuthConfigProvider(properties, null, logger); + + } else if (className.equals( + "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderServlet")) { + acp = new TSAuthConfigProviderServlet(properties, logger, null); + + } else if (className.equals(theClass)) { + acp = new TSAuthConfigProviderStandalone(properties, logger, null); + + } else { + throw new RuntimeException("Unknown class : " + className); + } + + RegistrationContext previousRC = null; + AuthConfigProvider previousACP = null; + previousACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + previousRC = (RegistrationContext) registrationContextMap + .get(layer + appContext); + + if (previousACP == null) { + authConfigProviderMap.put(layer + appContext, acp); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, true)); + + // Add new provider to the persistent store(ProviderConfiguration.xml) + ProviderConfigurationXMLFileProcessor.addProviderConfigEntry(className, + properties, layer, appContext, description); + + } else if ((previousACP != null) + && (previousRC.isPersistent() == false)) { + authConfigProviderMap.put(layer + appContext, acp); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, true)); + + // Add new provider to the persistent store(ProviderConfiguration.xml) + ProviderConfigurationXMLFileProcessor.addProviderConfigEntry(className, + properties, layer, appContext, description); + } + result = layer + appContext; + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception :" + e.getMessage()); + } + return result; + + } + + /** + * Registers within the (in-memory) factory, a provider of ServerAuthConfig + * and/or ClientAuthConfig objects for a message layer and application context + * identifier. This method does NOT effect the factory's persistent + * declarative representation of provider registrations, and intended to be + * used by Providers to perform self-Registration. + * + *

+ * At most one registration may exist within the factory for a given + * combination of message layer and appContext. Any pre-existing registration + * with identical values for layer and appContext is replaced by a subsequent + * registration. When replacement occurs, the registration identifier, layer, + * and appContext identifier remain unchanged, and the AuthConfigProvider + * (with initialization properties) and description are replaced. + * + *

+ * Within the lifetime of its Java process, a factory must assign unique + * registration identifiers to registrations, and must never assign a + * previously used registration identifier to a registration whose message + * layer and or appContext identifier differ from the previous use. + * + * @param provider + * the AuthConfigProvider to be registered at the factory (or null). + * Calling this method with a null value for this parameter shall + * cause getConfigProvider to return null when it + * iscalled with layer and appContext values for which the resulting + * registration is the best match. + * + * @param layer + * a String identifying the message layer for which the provider will + * be registered at the factory. A null value may be passed as an + * argument for this parameter, in which case, the provider is + * registered at all layers. + * + * @param appContext + * a String value that may be used by a runtime to request a + * configuration object from this provider. A null value may be + * passed as an argument for this parameter, in which case, the + * provider is registered for all configuration ids (at the indicated + * layers). + * + * @param description + * a text String descripting the provider. this value may be null. + * + * @return a String identifier assigned by the factory to the provider + * registration, and that may be used to remove the registration from + * the provider. + * + * @exception SecurityException + * if the caller does not have permission to register a provider + * at the factory. + * + * @exception AuthException + * if the provider registration fails. + */ + @Override + public String registerConfigProvider(AuthConfigProvider provider, + String layer, String appContext, String description) { + + String result = null; + String providerClassName = null; + + logger.log(Level.INFO, "registerConfigProvider() called for layer " + layer + + " and appContext " + appContext); + + if (provider == null) { + return result; + } + + try { + RegistrationContext previousRC = null; + AuthConfigProvider previousACP = null; + previousACP = (AuthConfigProvider) authConfigProviderMap + .get(layer + appContext); + previousRC = (RegistrationContext) registrationContextMap + .get(layer + appContext); + + if (previousACP == null) { + authConfigProviderMap.put(layer + appContext, provider); + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, false)); + + } else if ((previousACP != null) && (previousRC.isPersistent() == true)) { + // update registration context + registrationContextMap.put(layer + appContext, + new RegistrationContextImpl(layer, appContext, description, false)); + + if (provider != null) { + providerClassName = provider.getClass().getName(); + } + + // delete existing provider from its persistent state + configFileProcessor.deleteProviderConfigEntry(providerClassName, layer, + appContext, description); + } + result = layer + appContext; + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception :" + e.getMessage()); + } + + return result; + } + + /** + * Registers within the (in-memory) factory, an instance of a ServerAuthModule for a + * message layer and application context identifier as identified by a profile specific context object. + * + *

+ * This will override any other modules that have already been registered, either via proprietary + * means or using the standard API. The ServerAuthModule is removed, via a call to + * removeServerAuthModule when the context associated with the profile specific context object ends. + * + *

+ * Note that this method is a convenience method that can be used instead of registerConfigProvider, + * but should ultimately have the same effect. That is, the layer and appContext parameters + * are generated from the context object, and the ServerAuthModule is wrapped by an implementation + * specific AuthConfigProvider, which are then used to call registerConfigProvider or an + * internal method with the same effect. The returned registration ID is then associated with the profile specific + * context object, and also returned from this method. + * + *

+ * A "profile specific context object" is for example the ServletContext in the + * Servlet Container Profile. The context associated with this ServletContext ends + * when for example the application corresponding to it is undeployed. Association of the + * registration ID with the ServletContext simply means calling the setAttribute + * method on the ServletContext, with the registration ID as value. (The name attribute has not been + * standardised in this version of the specification) + * + * @param serverAuthModule the ServerAuthModule instance to be registered + * @param context the profile specific context of the application for which the module is registered + * @return A String identifier assigned by the factory to the provider registration, and that may be used to remove the + * registration from the factory. + */ + public String registerServerAuthModule(ServerAuthModule serverAuthModule, Object context) { + logger.log(Level.INFO, "registerServerAuthModule() called for serverAuthModule " + serverAuthModule + + " and context " + context); + return context.toString(); + } + + /** + * Remove the ServerAuthModule (and potentially encompassing wrappers/factories) that was previously registered via a call + * to registerServerAuthModule. + * + *

+ * Note that this method is a convenience method that can be used instead of removeRegistration, but should ultimately + * have the same effect. That is calling removeRegistration with the return value from registerServerAuthModule + * must have the same effect in that the ServerAuthModule is removed. + * + * @param context the profile specific context of the application for which the module is removed. + */ + public void removeServerAuthModule(Object context) { + logger.log(Level.INFO, "removeServerAuthModule() called for context " + context); + } + + /** + * Cause the factory to reprocess its persisent declarative representation of + * provider registrations. + * + *

+ * A factory should only replace an existing registration when a change of + * provider implementation class or initialization properties has occured. + * + * @exception AuthException + * if an error occured during the reinitialization. + * + * @exception SecurityException + * if the caller does not have permission to refresh the factory. + */ + @Override + public void refresh() { + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) { + return; + } else { + try { + logFileLocation = System.getProperty("log.file.location"); + System.out.println("logFileLocation = " + logFileLocation); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // create a new file + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } + + private String returnString(String[] array) { + String output = ""; + for (int i = 0; i < array.length; i++) { + output += "|" + array[i]; + } + + return output; + } + + private static class RegistrationContextImpl implements RegistrationContext { + private String messageLayer; + + private String appContext; + + private String description; + + private RegistrationContextImpl(String messageLayer, String appContext, + String description, boolean isPersistent) { + this.messageLayer = messageLayer; + this.appContext = appContext; + this.description = description; + } + + @Override + public String getMessageLayer() { + return messageLayer; + } + + @Override + public String getAppContext() { + return appContext; + } + + @Override + public String getDescription() { + return description; + } + + /** + * Get the persisted status from the registration context. + * + * @return a boolean indicating whether the registration is the result of a + * className based registration, or an instance based (e.g. self-) + * registration. Only registrations performed by Class name are + * persistent. + */ + @Override + public boolean isPersistent() { + return false; + } + + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProvider.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProvider.java new file mode 100644 index 0000000..87bc5af --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProvider.java @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.AuthDataCallbackHandler; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.ClientAuthConfig; +import jakarta.security.auth.message.config.ServerAuthConfig; + +/** + * + * @author Raja Perumal + */ +public class TSAuthConfigProvider + implements jakarta.security.auth.message.config.AuthConfigProvider { + private static TSLogger logger = null; + + private static Map properties = null; + + private HashMap clientAuthConfigMap = new HashMap(); + + private HashMap serverAuthConfigMap = new HashMap(); + + // This will be called when a vendor registers TSAuthConfigProvider + public TSAuthConfigProvider(Map props, AuthConfigFactory factory) { + properties = props; + + // For self registration + if (factory != null) { + factory.registerConfigProvider(this, null, null, + "TSAuthConfig Provider self registration"); + } + + if (logger == null) { + initializeTSLogger(); + } + } + + // TSAuthConfigFactory invokes this constructor with TSLogger + public TSAuthConfigProvider(Map props, AuthConfigFactory factory, + TSLogger tsLogger) { + properties = props; + + // For self registration + if (factory != null) { + factory.registerConfigProvider(this, null, null, + "TSAuthConfig Provider self registration"); + } + + if (tsLogger != null) + logger = tsLogger; + + } + + /** + * Get an instance of ClientAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ClientAuthConfig instance that + * describes the configuration of ClientAuthModules at a given message layer, + * and for use in an identified application context. + * + * @param layer + * a String identifying the message layer for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ClientAuthModules + * encapsulated by ClientAuthContext objects derived from the + * returned ClientAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ClientAuthConfig Object that describes the configuration of + * ClientAuthModules at the message layer and messaging context + * identified by the layer and appContext arguments. This method does + * not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ClientAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + * + * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ClientAuthConfig getClientAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + String logStr = "TSAuthConfigProvider.getClientAuthConfig called for " + + "layer=" + layer + " : " + "appContext=" + appContext; + + logger.log(Level.INFO, logStr); + + try { + if (handler == null) { + // instantiate a default callback handler that gets + // username and password from the environment using + // system property j2eelogin.name j2eelogin.password + handler = new AuthDataCallbackHandler(); + } else { + // even if we receive vendor callbackhandler replace it with our own + // callbackhandler for jaspic test. + System.out.println( + "Received callbackHandler =" + handler.getClass().getName()); + handler = new AuthDataCallbackHandler(); + } + + ClientAuthConfig clientAuthConfig = new TSClientAuthConfig(layer, + appContext, handler, properties, logger); + clientAuthConfigMap.put(layer + appContext, clientAuthConfig); + return clientAuthConfig; + } catch (Exception e) { + throw new AuthException(e.getMessage()); + } + } + + /** + * Get an instance of ServerAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ServerAuthConfig instance that + * describes the configuration of ServerAuthModules at a given message layer, + * and for a particular application context. + * + * @param layer + * a String identifying the message layer for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ServerAuthModules + * encapsulated by ServerAuthContext objects derived from the + * returned ServerAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ServerAuthConfig Object that describes the configuration of + * ServerAuthModules at a given message layer, and for a particular + * application context. This method does not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ServerAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + *

+ * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ServerAuthConfig getServerAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + String logStr = "TSAuthConfigProvider.getServerAuthConfig called for " + + "layer=" + layer + " : " + "appContext=" + appContext; + + logger.log(Level.INFO, logStr); + try { + + if ((!layer.equals(JASPICData.LAYER_SERVLET)) && (handler == null)) { + // instantiate a default callback handler that gets + // username and password from the environment using + // system property j2eelogin.name j2eelogin.password + handler = new AuthDataCallbackHandler(); + } else if ((layer.equals(JASPICData.LAYER_SERVLET)) + && (handler == null)) { + // this is used to help verify assertion JASPI:SPEC:71 which + // that we should NOT have a null cbh passed in + String msg = "FAILURE: layer=" + layer + " appContext=" + appContext; + msg += " getServerAuthConfig() received CallbackHandler=null"; + logger.log(Level.INFO, msg); + } + + ServerAuthConfig serverAuthConfig = null; + + if(JASPICData.LAYER_SOAP.equals(layer)) { + serverAuthConfig = new SOAPTSServerAuthConfig(layer, + appContext, handler, properties, logger); + } else { + serverAuthConfig = new TSServerAuthConfig(layer, + appContext, handler, properties, logger); + } + + serverAuthConfigMap.put(layer + appContext, serverAuthConfig); + return serverAuthConfig; + } catch (Exception e) { + throw new AuthException(e.getMessage()); + } + } + + /** + * Causes a dynamic configuration provider to update its internal state such + * that any resulting change to its state is reflected in the corresponding + * authentication context configuration objects previously created by the + * provider within the current process context. + * + * @exception AuthException + * if an error occured during the refresh. + * + * @exception SecurityException + * if the caller does not have permission to refresh the + * provider. + */ + public void refresh() { + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) + return; + else { + try { + logFileLocation = System.getProperty("log.file.location"); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // if log file already exists, just append to it + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderServlet.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderServlet.java new file mode 100644 index 0000000..fc19190 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderServlet.java @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.ClientAuthConfig; +import jakarta.security.auth.message.config.ServerAuthConfig; + +/** + * This class is an implementation of the AuthConfigProvider for use by the + * servlet profile tests. + * + * @author Sun Microsystems + * + */ +public class TSAuthConfigProviderServlet + implements jakarta.security.auth.message.config.AuthConfigProvider { + private static TSLogger logger; + + private HashMap serverAuthConfigMap = new HashMap(); + + private static Map properties = null; + + // This will be called when a vendor registers TSAuthConfigProviderServlet + public TSAuthConfigProviderServlet(Map props, AuthConfigFactory factory) { + properties = props; + + // For self registration + if (factory != null) { + factory.registerConfigProvider(this, null, null, + "TSAuthConfigProviderServlet self registration"); + } + + if (logger == null) { + initializeTSLogger(); + } + logger.log(Level.INFO, + "invoked TSAuthConfigProviderServlet() constructor(2 args)"); + } + + /** + * This constructor takes a TSLogger instance as a param. + */ + public TSAuthConfigProviderServlet(Map props, TSLogger tsLogger, + AuthConfigFactory factory) { + properties = props; + + // For self registration + if (factory != null) { + factory.registerConfigProvider(this, null, null, + "TSAuthConfigProviderServlet self registration"); + } + + if (tsLogger != null) { + logger = tsLogger; + } + logger.log(Level.INFO, + "invoked TSAuthConfigProviderServlet() constructor(3 args)"); + } + + /** + * Get an instance of ClientAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ClientAuthConfig instance that + * describes the configuration of ClientAuthModules at a given message layer, + * and for use in an identified application context. + * + * @param layer + * a String identifying the message layer for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ClientAuthModules + * encapsulated by ClientAuthContext objects derived from the + * returned ClientAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ClientAuthConfig Object that describes the configuration of + * ClientAuthModules at the message layer and messaging context + * identified by the layer and appContext arguments. This method does + * not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ClientAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + * + * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ClientAuthConfig getClientAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + + logger.log(Level.INFO, + "WARNING: shouldn't get into ClientAuthConfig() for servlet profile"); + + // shouldn't get in here for servlet profile + return (ClientAuthConfig) null; + } + + /** + * Get an instance of ServerAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ServerAuthConfig instance that + * describes the configuration of ServerAuthModules at a given message layer, + * and for a particular application context. + * + * @param layer + * a String identifying the message layer for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ServerAuthModules + * encapsulated by ServerAuthContext objects derived from the + * returned ServerAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ServerAuthConfig Object that describes the configuration of + * ServerAuthModules at a given message layer, and for a particular + * application context. This method does not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ServerAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + *

+ * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ServerAuthConfig getServerAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + + logger.log(Level.INFO, + "TSAuthConfigProviderServlet.getServerAuthConfig() called"); + + String logStr = "TSAuthConfigProviderServlet.getServerAuthConfig" + + " : layer=" + layer + " : appContext=" + appContext; + logger.log(Level.INFO, logStr); + try { + if (handler == null) { + // this is used to help verify assertion JASPI:SPEC:71 which + // that we should NOT have a null cbh passed in + String msg = "FAILURE: layer=" + layer + " appContext=" + appContext; + msg += " getServerAuthConfig() received CallbackHandler=null"; + logger.log(Level.INFO, msg); + } else { + String msg = "layer=" + layer + " appContext=" + appContext; + msg += " getServerAuthConfig() received CallbackHandler=non-null"; + logger.log(Level.INFO, msg); + } + + ServerAuthConfig serverAuthConfig = new TSServerAuthConfig(layer, + appContext, handler, properties, logger); + serverAuthConfigMap.put(layer + appContext, serverAuthConfig); + + return serverAuthConfig; + } catch (Exception e) { + e.printStackTrace(); + throw new AuthException(e.getMessage()); + } + } + + /** + * Causes a dynamic configuration provider to update its internal state such + * that any resulting change to its state is reflected in the corresponding + * authentication context configuration objects previously created by the + * provider within the current process context. + * + * @exception AuthException + * if an error occured during the refresh. + * + * @exception SecurityException + * if the caller does not have permission to refresh the + * provider. + */ + public void refresh() { + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) + return; + else { + try { + logFileLocation = System.getProperty("log.file.location"); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // if log file already exists, just append to it + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderStandalone.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderStandalone.java new file mode 100644 index 0000000..bd0ca4b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSAuthConfigProviderStandalone.java @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2007, 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSFileHandler; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; +import com.sun.ts.tests.jaspic.tssv.util.TSXMLFormatter; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.ClientAuthConfig; +import jakarta.security.auth.message.config.ServerAuthConfig; + +/** + * This class is an implementation of the AuthConfigProvider for use by the core + * tests. This is used to support the scenario when a profile other than + * Servlet/SOAP is being defined and used with JSR 196. + * + * At the time of this test creation, the 2 main supported profiles are SOAP and + * Servlet. But it is very possible that someone may use JSR-196 to define their + * own profiles. For that case, we need to have something we can use for the + * core tests besides SOAP/Servlet tests. This is used to support that case. + * + * @author Sun Microsystems + * + */ +public class TSAuthConfigProviderStandalone + implements jakarta.security.auth.message.config.AuthConfigProvider { + + // this is a default string used for Persistent Registration description + public static String DESC_KEY = "description_key"; + + private static TSLogger logger; + + private HashMap serverAuthConfigMap = new HashMap(); + + private static Map properties = null; + + private String description = null; + + // This will be called when a vendor registers TSAuthConfigProviderStandalone + public TSAuthConfigProviderStandalone(Map props, AuthConfigFactory factory) { + + this(props, null, factory, null); + + logger.log(Level.INFO, + "invoked TSAuthConfigProviderStandalone() constructor(2 args)"); + } + + /** + * This constructor takes a TSLogger instance as a param. + */ + public TSAuthConfigProviderStandalone(Map props, TSLogger tsLogger, + AuthConfigFactory factory) { + + this(props, tsLogger, factory, null); + + logger.log(Level.INFO, + "invoked TSAuthConfigProviderStandalone() constructor(3 args)"); + } + + /** + * This constructor takes a TSLogger instance as a param. + */ + public TSAuthConfigProviderStandalone(Map props, TSLogger tsLogger, + AuthConfigFactory factory, String description) { + properties = props; + + // For self registration + if (factory != null) { + factory.registerConfigProvider(this, null, null, + "TSAuthConfigProviderStandalone self registration"); + } + + if (tsLogger != null) { + this.logger = tsLogger; + } else { + initializeTSLogger(); + } + + if (description != null) { + // this is usually the case for in-memory registration + this.description = description; + } else { + // this is usually the case for persistent registration + this.description = getDescFromProps(props); + if (this.description == null) { + this.description = "PERSIST_DEFAULT"; + } + } + + logger.log(Level.INFO, + "invoked TSAuthConfigProviderStandalone() constructor(4 args)"); + } + + private String getDescFromProps(Map props) { + + String strDesc = null; + if (props != null) { + strDesc = (String) props.get(DESC_KEY); + } + + return strDesc; + } + + /** + * Get an instance of ClientAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ClientAuthConfig instance that + * describes the configuration of ClientAuthModules at a given message layer, + * and for use in an identified application context. + * + * @param layer + * a String identifying the message layer for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ClientAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ClientAuthModules + * encapsulated by ClientAuthContext objects derived from the + * returned ClientAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ClientAuthConfig Object that describes the configuration of + * ClientAuthModules at the message layer and messaging context + * identified by the layer and appContext arguments. This method does + * not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ClientAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + * + * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ClientAuthConfig getClientAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + + logger.log(Level.INFO, + "WARNING: shouldnt get into ClientAuthConfig() for servlet profile"); + + // shouldnt get in here for servlet profile + return (ClientAuthConfig) null; + } + + /** + * Get an instance of ServerAuthConfig from this provider. + * + *

+ * The implementation of this method returns a ServerAuthConfig instance that + * describes the configuration of ServerAuthModules at a given message layer, + * and for a particular application context. + * + * @param layer + * a String identifying the message layer for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param appContext + * a String that identifies the messaging context for the returned + * ServerAuthConfig object. This argument must not be null. + * + * @param handler + * a CallbackHandler to be passed to the ServerAuthModules + * encapsulated by ServerAuthContext objects derived from the + * returned ServerAuthConfig. This argument may be null, in which + * case the implementation may assign a default handler to the + * configuration. + * + * @return a ServerAuthConfig Object that describes the configuration of + * ServerAuthModules at a given message layer, and for a particular + * application context. This method does not return null. + * + * @exception AuthException + * if this provider does not support the assignment of a default + * CallbackHandler to the returned ServerAuthConfig. + * + * @exception SecurityException + * if the caller does not have permission to retrieve the + * configuration. + *

+ * The CallbackHandler assigned to the configuration must support + * the Callback objects required to be supported by the profile + * of this specification being followed by the messaging runtime. + * The CallbackHandler instance must be initialized with any + * application context needed to process the required callbacks + * on behalf of the corresponding application. + */ + public ServerAuthConfig getServerAuthConfig(String layer, String appContext, + CallbackHandler handler) throws AuthException { + + logger.log(Level.INFO, + "TSAuthConfigProviderStandalone.getServerAuthConfig() called"); + + String logStr = "TSAuthConfigProviderStandalone.getServerAuthConfig" + + " : layer=" + layer + " : appContext=" + appContext; + logger.log(Level.INFO, logStr); + try { + if (handler == null) { + // this is used to help verify assertion JASPI:SPEC:71 which + // that we should NOT have a null cbh passed in + String msg = "FAILURE: layer=" + layer + " appContext=" + appContext; + msg += " getServerAuthConfig() received CallbackHandler=null"; + logger.log(Level.INFO, msg); + } else { + String msg = "layer=" + layer + " appContext=" + appContext; + msg += " getServerAuthConfig() received CallbackHandler=non-null"; + logger.log(Level.INFO, msg); + } + + ServerAuthConfig serverAuthConfig = new TSServerAuthConfig(layer, + appContext, handler, properties, logger); + serverAuthConfigMap.put(layer + appContext, serverAuthConfig); + + return serverAuthConfig; + } catch (Exception e) { + e.printStackTrace(); + throw new AuthException(e.getMessage()); + } + } + + /** + * Causes a dynamic configuration provider to update its internal state such + * that any resulting change to its state is reflected in the corresponding + * authentication context configuration objects previously created by the + * provider within the current process context. + * + * @exception AuthException + * if an error occured during the refresh. + * + * @exception SecurityException + * if the caller does not have permission to refresh the + * provider. + */ + public void refresh() { + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) + return; + else { + try { + logFileLocation = System.getProperty("log.file.location"); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // if log file already exists, just append to it + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } + + public String getDescription() { + return description; + } + + public void setDescription(String val) { + description = val; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthConfig.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthConfig.java new file mode 100644 index 0000000..f10897f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthConfig.java @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Iterator; +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.config.ClientAuthContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.xml.soap.MimeHeaders; +import jakarta.xml.soap.Name; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +/** + * + * @author Raja Perumal + */ +public class TSClientAuthConfig + implements jakarta.security.auth.message.config.ClientAuthConfig { + + private static String messageLayer = null; + + private static String appContext = null; + + private static CallbackHandler callbackHandler = null; + + private static TSLogger logger = null; + + private Map properties = null; + + /** + * Creates a new instance of ClientAuthConfigImpl + */ + public TSClientAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props) { + messageLayer = layer; + appContext = applicationCtxt; + callbackHandler = cbkHandler; + properties = props; + } + + public TSClientAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props, TSLogger tsLogger) { + this(layer, applicationCtxt, cbkHandler, props); + logger = tsLogger; + String str = "TSClientAuthConfig called for layer=" + layer + + " : appContext=" + applicationCtxt; + logger.log(Level.INFO, str); + } + + /** + * Get the authentication context identifier corresponding to the request and + * response objects encapsulated in messageInfo. + * + * @param messageInfo + * a contextual Object that encapsulates the client request and + * server response objects. + * + * @return the operation identifier related to the encapsulated request and + * response objects, or null. + * + * @throws IllegalArgumentException + * if the type of the message objects incorporated in messageInfo + * are not compatible with the message types supported by this + * authentication context configuration object. + */ + public String getAuthContextID(MessageInfo messageInfo) { + String rval = null; + logger.log(Level.INFO, "TSClientAuthConfig.getOperation called"); + if (messageLayer.equals(JASPICData.LAYER_SOAP)) { + + return getOpName((SOAPMessage) messageInfo.getRequestMessage()); + + } else if (messageLayer.equals(JASPICData.LAYER_SERVLET)) { + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + rval = request.getServletPath() + " " + request.getMethod(); + return rval; + } else + return null; + } + + private String getOpName(SOAPMessage message) { + if (message == null) { + return null; + } + + String rvalue = null; + + // first look for a SOAPAction header. + // this is what .net uses to identify the operation + MimeHeaders headers = message.getMimeHeaders(); + if (headers != null) { + String[] actions = headers.getHeader("SOAPAction"); + if (actions != null && actions.length > 0) { + rvalue = actions[0]; + if (rvalue != null && rvalue.equals("\"\"")) { + rvalue = null; + } + } + } + + // if that doesn't work then we default to trying the name + // of the first child element of the SOAP envelope. + if (rvalue == null) { + Name name = getName(message); + if (name != null) { + rvalue = name.getLocalName(); + } + } + + return rvalue; + } + + private Name getName(SOAPMessage message) { + Name rvalue = null; + SOAPPart soap = message.getSOAPPart(); + if (soap != null) { + try { + SOAPEnvelope envelope = soap.getEnvelope(); + if (envelope != null) { + SOAPBody body = envelope.getBody(); + if (body != null) { + Iterator it = body.getChildElements(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof SOAPElement) { + rvalue = ((SOAPElement) o).getElementName(); + break; + } + } + } + } + } catch (SOAPException se) { + logger.log(Level.INFO, "WSS: Unable to get SOAP envelope"); + } + } + + return rvalue; + } + + /** + * Causes a dynamic anthentication context configuration object to update the + * internal state that it uses to process calls to its + * getAuthContext method. + * + * @exception AuthException + * if an error occured during the update. + * + * @exception SecurityException + * if the caller does not have permission to refresh the + * configuration object. + */ + public void refresh() { + + } + + /** + * Get the message layer name of this authentication context configuration + * object. + * + * @return the message layer name of this configuration object, or null if the + * configuration object pertains to an unspecified message layer. + */ + public String getMessageLayer() { + return messageLayer; + } + + /** + * Get the application context identifier of this authentication context + * configuration object. + * + * @return the String identifying the application context of this + * configuration object or null if the configuration object pertains + * to an unspecified application context. + */ + public String getAppContext() { + return appContext; + } + + /** + * Get a ClientAuthContext instance from this ClientAuthConfig. + * + *

+ * The implementation of this method returns a ClientAuthContext instance that + * encapsulates the ClientAuthModules used to secure and validate + * requests/responses associated with the given operation. + * + *

+ * Specifically, this method accesses this ClientAuthConfig object with the + * argument operation to determine the ClientAuthModules that are to be + * encapsulated in the returned ClientAuthContext instance. + * + *

+ * The ClientAuthConfig object establishes the request and response + * MessagePolicy objects that are passed to the encapsulated modules when they + * are initialized by the returned ClientAuthContext instance. It is the + * modules' responsibility to enforce these policies when invoked. + * + * @param operation + * an operation identifier used to index the provided config, + * or null. This value must be identical to the value returned by the + * getOperation method for all MessageInfo + * objects passed to the secureRequest method of the + * returned ClientAuthContext. + * + * @param clientSubject + * a Subject that represents the source of the service request to be + * secured by the acquired authentication context. The principal + * and/or credentials of the Subject may be used to select or acquire + * the authentication context. If the Subject is not null, additional + * Principals or credentials (pertaining to the source of the + * request) may be added to the Subject. A null value may be passed + * to for this parameter. + * + * @param properties + * a Map object that may be used by the caller to augment the + * properties that will be passed to the encapsulated modules at + * module initialization. The null value may be passed for this + * parameter. + * + * @return a ClientAuthContext instance that encapsulates the + * ClientAuthModules used to secure and validate requests/responses + * associated with the given operation, or null (indicating + * that no modules are configured). + * + * @exception AuthException + * if this operation fails. + */ + public ClientAuthContext getAuthContext(String operation, + Subject clientSubject, Map properties) throws AuthException { + + // Copy properties that are passed in this method to this.properties + // + // Note: this.properties is obtained from the Provider which gets those + // properties during provider registration time from the factory. + this.properties.putAll(properties); + + try { + + String logStr = "TSClientAuthConfig.getAuthContext: layer=" + + messageLayer + " : appContext=" + appContext; + logger.log(Level.INFO, logStr); + + logger.log(Level.INFO, + "TSClientAuthConfig.getAuthContext: layer=" + messageLayer + + " : appContext=" + appContext + " operationId=" + operation); + + ClientAuthContext clientAuthContext = new TSClientAuthContext( + messageLayer, appContext, callbackHandler, operation, clientSubject, + this.properties, logger); + + logStr = "TSClientAuthConfig.getAuthContext: returned non-null" + + " ClientAuthContext for operationId=" + operation; + logger.log(Level.INFO, logStr); + return clientAuthContext; + } catch (Exception e) { + throw new AuthException(e.getMessage()); + } + + } + + /** + * Used to determine whether the authentication context configuration object + * encapsulates any protected authentication contexts. + * + * @return true if the configuration object encapsulates at least one + * protected authentication context. Otherwise, this method returns + * false. + */ + public boolean isProtected() { + // To verify protected code path, always return true. + return true; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthContext.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthContext.java new file mode 100644 index 0000000..c9ceda9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSClientAuthContext.java @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.module.ClientAuthModule; + +/** + * + * @author Raja Perumal + */ +public class TSClientAuthContext + implements jakarta.security.auth.message.config.ClientAuthContext { + + private static ClientAuthModule clientAuthModule = null; + + private static TSLogger logger = null; + + private static String messageLayer = null; + + private static String appContext = null; + + private static CallbackHandler handler = null; + + private static String operation = null; + + private static Subject clientSubject = null; + + private static Map properties = null; + + public TSClientAuthContext() { + + } + + public TSClientAuthContext(String messageLayer, String appContext, + CallbackHandler handler, String operation, Subject clientSubject, + Map properties, TSLogger tsLogger) throws AuthException { + + this(messageLayer, appContext, handler, operation, clientSubject, + properties); + logger = tsLogger; + ClientAuthModule cam = null; + logger.log(Level.INFO, "TSClientAuthContext called"); + + // pass TSlogger to TSServerAuthModule through properties + properties.put("TSLogger", logger); + + if (messageLayer.equals(JASPICData.LAYER_SOAP)) { + if (appContext.indexOf("SendSuccessHello") > -1) { + cam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSSendSuccessClientAuthModule(); + cam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("SendFailureHello") > -1) { + cam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSSendFailureClientAuthModule(); + cam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("FailureHello") > -1) { + cam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSFailureClientAuthModule(); + cam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("AuthExceptionHello") > -1) { + cam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSAuthExceptionClientAuthModule(); + cam.initialize(null, null, handler, properties); + + } else { + cam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSClientAuthModule(); + cam.initialize(null, null, handler, properties); + } + } else if (messageLayer.equals(JASPICData.LAYER_SERVLET)) { + cam = new com.sun.ts.tests.jaspic.tssv.module.servlet.TSClientAuthModule(); + cam.initialize(null, null, handler, properties); + } + + clientAuthModule = cam; + + } + + private TSClientAuthContext(String layer, String appContxt, + CallbackHandler hndler, String operatn, Subject cliSubject, Map props) + throws AuthException { + + messageLayer = layer; + appContext = appContxt; + handler = hndler; + operation = operatn; + clientSubject = cliSubject; + properties = props; + + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + logger.log(Level.INFO, "TSClientAuthContext.secureRequest called"); + + return clientAuthModule.secureRequest(messageInfo, clientSubject); + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + logger.log(Level.INFO, "TSClientAuthContext.validateResponse called"); + return clientAuthModule.validateResponse(messageInfo, clientSubject, + serviceSubject); + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + clientAuthModule.cleanSubject(messageInfo, subject); + + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSRegistrationListener.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSRegistrationListener.java new file mode 100644 index 0000000..9037fad --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSRegistrationListener.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.RegistrationListener; + +public class TSRegistrationListener implements RegistrationListener { + + String profileLayer; + + String appContext; + + boolean notified = false; + + AuthConfigFactory acf = null; + + public TSRegistrationListener() { + this.profileLayer = null; + this.appContext = null; + acf = AuthConfigFactory.getFactory(); + } + + public TSRegistrationListener(String profileLayer, String appContext) { + this.profileLayer = profileLayer; + this.appContext = appContext; + acf = AuthConfigFactory.getFactory(); + } + + public String getProfileLayer() { + return this.profileLayer; + } + + public void setProfileLayer(String val) { + this.profileLayer = val; + } + + public String getAppContext() { + return this.appContext; + } + + public void setAppContext(String val) { + this.appContext = val; + } + + public void resetNotifyFlag() { + notified = false; + } + + public boolean notified() { + return notified; + } + + /* + * check if notifications should occur by verifying if our actual notification + * (ie wasNotified) matches with our expected notification (ie notified()) + * return true on success and false otherwise. + */ + public boolean check(String layer, String context) { + boolean match = false; + boolean rval = true; + + if ((layer == null + || ((profileLayer != null) && profileLayer.equals(layer))) + && (context == null + || ((appContext != null) && appContext.equals(context)))) { + match = true; + } + + String msg = "TSRegistrationListener: layer=" + profileLayer + + ", appcontext="; + msg += appContext + " ExpectedVal=" + notified() + " actualVal=" + match + + "for layer=" + layer + " context=" + context; + + if (match && notified()) { + // should have been notification - which matches whats in notified() + rval = true; + } else if (match && !notified()) { + rval = false; + debug("in check(): " + msg); + } + + return rval; + } + + /* + * Notify the listener that a registration with which it was associated was + * replaced or unregistered. + */ + @Override + public void notify(String layer, String context) { + notified = true; + boolean bLayersMatch = (profileLayer == layer) + || profileLayer.equals(layer); + boolean bContextsMatch = (appContext == context) + || appContext.equals(context); + + if (bLayersMatch && bContextsMatch) { + // successful notification + debug( + "successful notification for layer=" + layer + " context=" + context); + } else { + // error - notify had problem + String msg = "ERROR - listener notified at wrong profileLayer: " + layer + + " or context: " + context; + debug(msg); + } + } + + private void debug(String out) { + System.out.println(out); + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthConfig.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthConfig.java new file mode 100644 index 0000000..4d7cf1a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthConfig.java @@ -0,0 +1,481 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.config.ServerAuthContext; +import jakarta.servlet.http.HttpServletRequest; + +/** + * + * @author Raja Perumal + * + * Important: It is very likely that the logged messages of this class + * are being searched for in the logfile by the client code. Because of + * this, refrain from changing log messages in this file. + * + */ +public class TSServerAuthConfig + implements jakarta.security.auth.message.config.ServerAuthConfig { + protected static String messageLayer = null; + + protected static String appContext = null; + + protected static CallbackHandler handler = null; + + protected static TSLogger logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + + protected static Map properties = null; + + protected static Map authMandatoryMap; + + protected TSServerAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props) { + messageLayer = layer; + appContext = applicationCtxt; + handler = cbkHandler; + properties = props; + } + + public TSServerAuthConfig(String layer, String applicationCtxt, + CallbackHandler cbkHandler, Map props, TSLogger tsLogger) { + + this(layer, applicationCtxt, cbkHandler, props); + + if (tsLogger != null) { + logger = tsLogger; + } + + String str = "TSServerAuthConfig called for layer=" + layer + + " : appContext=" + applicationCtxt; + logger.log(Level.INFO, str); + } + + /** + * Get the message layer name of this authentication context configuration + * object. + * + * @return the message layer name of this configuration object, or null if the + * configuration object pertains to an unspecified message layer. + */ + @Override + public String getMessageLayer() { + logger.log(Level.INFO, "getMessageLayer called"); + return messageLayer; + } + + /** + * Get the application context identifier of this authentication context + * configuration object. + * + * @return the String identifying the application context of this + * configuration object or null if the configuration object pertains + * to an unspecified application context. + */ + @Override + public String getAppContext() { + logger.log(Level.INFO, "getAppContext called"); + return appContext; + } + + /** + * Get the authentication context identifier corresponding to the request and + * response objects encapsulated in messageInfo. + * + * @param messageInfo + * a contextual Object that encapsulates the client request and + * server response objects. + * + * @return the auth context identifier related to the encapsulated request and + * response objects, or null. + * + * @throws IllegalArgumentException + * if the type of the message objects incorporated in messageInfo + * are not compatible with the message types supported by this + * authentication context configuration object. + * + */ + + @Override + public String getAuthContextID(MessageInfo messageInfo) { + logger.log(Level.INFO, "getAuthContextID called"); + String rval = null; + + if (messageLayer.equals(JASPICData.LAYER_SERVLET)) { + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + rval = request.getServletPath() + " " + request.getMethod(); + + dumpServletProfileKeys(messageInfo, "getAuthContextID", + JASPICData.LAYER_SERVLET); + } else { + rval = null; + } + + String logMsg = "getAuthContextID() called for layer=" + messageLayer; + logMsg += " shows AuthContextId=" + rval; + logger.log(Level.INFO, logMsg); + + return rval; + } + + /* + * This is a convenience method that will likely only be called once. + * Currently there is only one key to dump from the map, but his may change in + * the future. + */ + private void dumpServletProfileKeys(MessageInfo msgInfo, String callerMethod, + String messageLayer) { + + Map map = msgInfo.getMap(); + + // for debugging only + // dumpAllKeyValues(map); + + // lets pull out some servlet info that we can use to help uniquely + // identify the source of this request + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + String servletName = request.getServletPath(); + + // see assertion JASPI:SPEC:306 (section 3.8.1.1) for details on this + // jsr-196 states the following key must exist for servlet profile + String strKey = "jakarta.security.auth.message.MessagePolicy.isMandatory"; + if (map != null) { + String keyVal = (String) map.get(strKey); + String msg = "dumpServletProfileKeys() called with attrs: "; + msg += " layer=" + messageLayer; + msg += " servletName=" + servletName; + msg += " callerMethod=" + callerMethod; + msg += " key=" + strKey; + + if (keyVal == null) { + msg += " value=Invalid"; + addMandatoryStatusToMap(msgInfo, messageLayer, appContext, false); + } else { + // We dont care if Boolean.valueOf(keyVal).booleanValue() is true + // or false. We only care that it is a boolean value -which means + // this is considered a valid key-value pair. + msg += " value=Valid"; + addMandatoryStatusToMap(msgInfo, messageLayer, appContext, true); + } + + logger.log(Level.INFO, msg); + } + } + + private void addMandatoryStatusToMap(MessageInfo msgInfo, String layer, + String appContext, boolean isMandatory) { + if (authMandatoryMap == null) { + authMandatoryMap = new Hashtable(); + } + + // see if entry already exists and if not we need to add the entry + Boolean booleanObj = (Boolean) authMandatoryMap.get(layer + appContext); + if (booleanObj == null) { + authMandatoryMap.put(layer + appContext, new Boolean(isMandatory)); + } + } + + private boolean getMandatoryStatusFromMap(String layer, String appContext) { + boolean bval = false; + + if (layer.equals("JASPICData.LAYER_SERVLET")) { + if (authMandatoryMap != null) { + Boolean booleanObj = (Boolean) authMandatoryMap.get(layer + appContext); + bval = booleanObj.booleanValue(); + } else { + String msg = "Could Not properly determine isMandatory status."; + msg += " Will return false."; + logger.log(Level.INFO, msg); + bval = false; + } + } + + return bval; + } + + /* + * for debug purposes only + */ + private void dumpAllKeyValues(Map map) { + + if (map == null) { + logger.log(Level.INFO, "map is null"); + return; + } + + Set keys = map.keySet(); + Iterator iterator = keys.iterator(); + while (iterator.hasNext()) { + String msg = ""; + String key = (String) iterator.next(); + if (key != null) { + msg = "key=" + key; + String val = (String) map.get(key); + if (val != null) { + msg += " value=" + val; + } else { + msg += " value=null"; + } + logger.log(Level.INFO, msg); + } + } + } + + /** + * Causes a dynamic anthentication context configuration object to update the + * internal state that it uses to process calls to its + * getAuthContext method. + * + * @exception AuthException + * if an error occured during the update. + * + * @exception SecurityException + * if the caller does not have permission to refresh the + * configuration object. + */ + @Override + public void refresh() { + logger.log(Level.INFO, "refresh called"); + } + + /** + * Used to determine whether the authentication context configuration object + * encapsulates any protected authentication contexts. + * + * @return true if the configuration object encapsulates at least one + * protected authentication context. Otherwise, this method returns + * false. + */ + @Override + public boolean isProtected() { + // To verify protected code path, always return true. + return true; + } + + /** + * Get a ServerAuthContext instance from this ServerAuthConfig. This method + * should get called by the MPR. + * + *

+ * The implementation of this method returns a ServerAuthContext instance that + * encapsulates the ServerAuthModules used to validate requests and secure + * responses associated with the given operation. + * + *

+ * Specifically, this method accesses this ServerAuthConfig object with the + * argument operation to determine the ServerAuthModules that are to be + * encapsulated in the returned ServerAuthContext instance. + * + *

+ * The ServerAuthConfig object establishes the request and response + * MessagePolicy objects that are passed to the encapsulated modules when they + * are initialized by the returned ServerAuthContext instance. It is the + * modules' responsibility to enforce these policies when invoked. + * + * @param operation + * an operation identifier used to index the provided config, + * or null. This value must be identical to the value returned by the + * getOperation method for all MessageInfo + * objects passed to the validateRequest method of the + * returned ServerAuthContext. + * + * @param serviceSubject + * a Subject that represents the source of the service response to be + * secured by the acquired authentication context. The principal + * and/or credentials of the Subject may be used to select or acquire + * the authentication context. If the Subject is not null, additional + * Principals or credentials (pertaining to the source of the + * response) may be added to the Subject. A null value may be passed + * to for this parameter. + * + * @param properties + * a Map object that may be used by the caller to augment the + * properties that will be passed to the encapsulated modules at + * module initialization. The null value may be passed for this + * parameter. + * + * @return a ServerAuthContext instance that encapsulates the + * ServerAuthModules used to secure and validate requests/responses + * associated with the given operation, or null (indicating + * that no modules are configured). + * + * @exception AuthException + * if this operation fails. + */ + @Override + public ServerAuthContext getAuthContext(String operation, + Subject serviceSubject, Map properties) throws AuthException { + + String logStr = "TSServerAuthConfig.getAuthContext: layer=" + messageLayer + + " : appContext=" + appContext; + logger.log(Level.INFO, logStr); + + logger.log(Level.INFO, + "TSServerAuthConfig.getAuthContext: layer=" + messageLayer + + " : appContext=" + appContext + " operationId=" + operation); + + if (serviceSubject != null) { + properties.put(JASPICData.SVC_SUBJECT_KEY, serviceSubject); + logger.log(Level.INFO, + "found a non-null serviceSubject in getAuthContext()"); + } + + // Copy properties that are passed in this method to this.properties + // + // Note: this.properties is obtained from the Provider which gets those + // properties during provider registration time from the factory. + try { + if ((this.properties != null) && (properties != null)) { + this.properties.putAll(properties); + } + } catch (Exception ex) { + logger.log(Level.INFO, "Exception : " + ex.getMessage()); + } + + checkIf115Compatible(properties); + + // validate operation is correct for the message layer type + validateOperationId(operation, messageLayer); + + try { + boolean bIsMand = getMandatoryStatusFromMap(messageLayer, appContext); + ServerAuthContext sac = new TSServerAuthContext(messageLayer, appContext, + handler, operation, serviceSubject, this.properties, bIsMand, logger); + + logStr = "TSServerAuthConfig.getAuthContext: returned non-null ServerAuthContext"; + logger.log(Level.INFO, logStr); + + // For SOAP layer + logStr = "TSServerAuthConfig.getAuthContext: returned non-null" + + " ServerAuthContext for operationId=" + operation; + logger.log(Level.INFO, logStr); + return sac; + } catch (Exception e) { + logger.log(Level.SEVERE, + "Got AuthException in TSServerAuthConfig.getAuthContext"); + logger.log(Level.SEVERE, e.getMessage()); + throw new AuthException(e.getMessage()); + } + } + + /* + * this is used to help us verify JASPI:SPEC:300 This is a convenience method + * that will likely only be called once. Currently there is only one key to + * dump from the props, but this may change in the future. + */ + private void checkIf115Compatible(Map properties) { + + String msg = "layer=" + messageLayer + " appContext=" + appContext; + + // jsr-196 states the following key must exist if JSR-115 is supported + // but it must NOT exist if 115 is NOT supported. + String strKey = "jakarta.security.jacc.PolicyContext"; + msg += " Key=" + strKey; + if (properties != null) { + String keyVal = (String) properties.get(strKey); + + if (keyVal == null) { + msg += " does NOT exist thus Not 115 compatible"; + } else if (keyVal != null) { + msg += " does exist thus 115 compatible"; + logger.log(Level.INFO, "key=" + strKey + " value=" + keyVal); // XXXX - + // debugging + } + } else { + msg += " does NOT exist thus Not 115 compatible"; + } + logger.log(Level.INFO, msg); + } + + /* + * The goal of this method is to help us verify if we have a properly + * constructed operationID. This method will log messages indicating if we do + * or do not have a valid operationID. + */ + private void validateOperationId(String operation, String layer) { + String MNAME = "TSServerAuthConfig.validateOperationId() : "; + String sProfile; + String lstr; + boolean bPassed = true; + + operation = operation.trim(); + if (operation == null) { + logger.log(Level.SEVERE, + MNAME + " there was a null operationId and should not be!"); + } + + if (layer.equals(JASPICData.LAYER_SERVLET)) { + // name should consist of following format + // + // there should ONLY be one whitspace + sProfile = "HttpServlet profile"; + if (operation.startsWith("http:")) { + // should not start with a context path + lstr = MNAME + sProfile + " should not start with a context path"; + logger.log(Level.SEVERE, lstr); + bPassed = false; + } + + if ((operation.indexOf(" ") != operation.lastIndexOf(" "))) { + // if here then we have more than one whitespace and should not! + lstr = MNAME + sProfile + " found more than one whitespace."; + logger.log(Level.SEVERE, lstr); + bPassed = false; + } + + int ii = operation.indexOf(" "); + String httpMethod = operation.substring(ii); + httpMethod = httpMethod.trim(); + if (!(httpMethod.equalsIgnoreCase("GET") + || httpMethod.equalsIgnoreCase("POST") + || httpMethod.equalsIgnoreCase("PUT"))) { + // it should be one of these three supported http methods + lstr = MNAME + sProfile + " invalid http method type :" + httpMethod + + ". Must be POST|GET|PUT"; + logger.log(Level.SEVERE, lstr); + bPassed = false; + } + + if (bPassed) { + logger.log(Level.INFO, MNAME + sProfile + " : PASSED"); + } else { + logger.log(Level.SEVERE, MNAME + sProfile + " : FAILED"); + } + + } else if (layer.equals(JASPICData.LAYER_SOAP)) { + // Nothing to verify here for SOAP profile + } + + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthContext.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthContext.java new file mode 100644 index 0000000..1b728a1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/TSServerAuthContext.java @@ -0,0 +1,674 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.config; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.security.auth.message.module.ServerAuthModule; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; + +/** + * + * @author Raja Perumal + * + * Important: It is very likely that the logged messages of this class + * are being searched for in the logfile by the client code. Because of + * this, refrain from changing log messages in this file. + * + */ +public class TSServerAuthContext + implements jakarta.security.auth.message.config.ServerAuthContext { + + private static ServerAuthModule serverAuthModule = null; + + private static String messageLayer = null; + + private static String appContext = null; + + private static CallbackHandler handler = null; + + private static String operation = null; + + private static Subject clientSubject = null; + + private static Map properties = null; + + private static TSLogger logger = null; + + private static String soapUPTokenAppContext = "HelloService HelloPort"; + + private static String servletUPTokenAppContext = "spitests_servlet_web"; + + private static MessageInfo messageInfoFromVerifyReq = null; + + private static boolean isMandatory = false; + + /** Creates a new instance of ServerAuthContext */ + public TSServerAuthContext() { + } + + public TSServerAuthContext(String messageLayer, String appContext, + CallbackHandler handler, String operation, Subject clientSubject, + Map properties, boolean isAuthMandatory, TSLogger tsLogger) + throws AuthException { + this(messageLayer, appContext, handler, operation, clientSubject, + properties); + logger = tsLogger; + logger.log(Level.INFO, "TSServerAuthContext called"); + String logStr = "TSServerAuthContext called for messageLayer=" + + messageLayer + " : appContext=" + appContext; + logger.log(Level.INFO, logStr); + logStr += " : operation=" + operation; + logger.log(Level.INFO, logStr); + + ServerAuthModule sam = null; + properties.put("TSLogger", logger); + + isMandatory = isAuthMandatory; + + // Create a TargetPolicy for AUTHENTICATE_SENDER + MessagePolicy.TargetPolicy msgTargetPolicy = + + new MessagePolicy.TargetPolicy(null, + new MessagePolicy.ProtectionPolicy() { + public String getID() { + return MessagePolicy.ProtectionPolicy.AUTHENTICATE_SENDER; + } + }); + MessagePolicy.TargetPolicy[] msgTargetPolicies = { msgTargetPolicy }; + MessagePolicy requestMessagePolicy = new MessagePolicy(msgTargetPolicies, + isMandatory); + + // Create a TargetPolicy for AUTHENTICATE_CONTENT + MessagePolicy.TargetPolicy msgTargetPolicyContent = + + new MessagePolicy.TargetPolicy(null, + new MessagePolicy.ProtectionPolicy() { + public String getID() { + return MessagePolicy.ProtectionPolicy.AUTHENTICATE_CONTENT; + } + }); + MessagePolicy.TargetPolicy[] msgTargetPoliciesContent = { + msgTargetPolicyContent }; + MessagePolicy responseMessagePolicy = new MessagePolicy( + msgTargetPoliciesContent, isMandatory); + + // Note: We could also choose auth modules based on appContext but + // MessageLayer seems to be the ideal candidate for choosing + // auth modules. + if (messageLayer.equals(JASPICData.LAYER_SOAP)) { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSServerAuthModule(); + + if (appContext.equals(soapUPTokenAppContext)) { + + sam.initialize(requestMessagePolicy, responseMessagePolicy, handler, + properties); + } else if (appContext.indexOf("SendSuccessHello") > -1) { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSSendSuccessServerAuthModule(); + sam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("SendFailureHello") > -1) { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSSendFailureServerAuthModule(); + sam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("FailureHello") > -1) { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSFailureServerAuthModule(); + sam.initialize(null, null, handler, properties); + + } else if (appContext.indexOf("AuthExceptionHello") > -1) { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSAuthExceptionServerAuthModule(); + sam.initialize(null, null, handler, properties); + + } else { + sam = new com.sun.ts.tests.jaspic.tssv.module.soap.TSServerAuthModule(); + sam.initialize(null, null, handler, properties); + } + + } else if (messageLayer.equals(JASPICData.LAYER_SERVLET)) { + System.out.println("AppContext =" + appContext); + + if (appContext.contains(servletUPTokenAppContext) + && operation.contains("WrapperServlet")) { + sam = new com.sun.ts.tests.jaspic.tssv.module.servlet.TSServletWrapperSAM(); + sam.initialize(requestMessagePolicy, responseMessagePolicy, handler, + properties); + + } else if (appContext.contains(servletUPTokenAppContext)) { + sam = new com.sun.ts.tests.jaspic.tssv.module.servlet.TSServerAuthModule(); + sam.initialize(requestMessagePolicy, responseMessagePolicy, handler, + properties); + } else { + sam = new com.sun.ts.tests.jaspic.tssv.module.servlet.TSServerAuthModule(); + sam.initialize(requestMessagePolicy, null, handler, properties); + } + } + + serverAuthModule = sam; + } + + /* + * This should be private so that we can be sure people pass a valid TSLogger + * into the public constructor. + */ + private TSServerAuthContext(String layer, String appCtxt, + CallbackHandler hndlr, String optn, Subject cliSubject, Map props) + throws AuthException { + messageLayer = layer; + appContext = appCtxt; + handler = hndlr; + operation = optn; + clientSubject = cliSubject; + properties = props; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When paththis status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + Object reqObj = null; + + String msg = "TSServerAuthContext.validateRequest called"; + + // this msg used to verify assertion: JASPI:SPEC:50 + logger.log(Level.INFO, msg); + + // this msg used to verify assertion: JASPI:SPEC:88 + msg += " for layer=" + messageLayer; + logger.log(Level.INFO, msg); + + // the following msg used to verify assertion: JASPI:SPEC:89 + if (messageInfo != null) { + reqObj = messageInfo.getRequestMessage(); + if (reqObj != null) { + // if here, we want to see if our reqObj is type HttpServletRequest + if (reqObj instanceof jakarta.servlet.http.HttpServletRequest) { + String contextPath = ((HttpServletRequest) reqObj).getContextPath(); + String servletPath = ((HttpServletRequest) reqObj).getServletPath(); + + // note: we are leaving off the pathInfo since we only want + // to log contextPath and servletPath info so it's + // more of a pseudo requestURI we are validating but + // note that this will match our client so should be fine. + String requestURI = contextPath + servletPath; + msg += " for requestURI=" + requestURI; + } else { + msg += " reqObj instanceof=" + reqObj.getClass().getName(); + } + } else { + msg += " reqObj=NULL"; + } + } + + // used to assist with the verification of assertion JASPI:SPEC:52 + String subjStr = messageLayer + " profile: "; + if (clientSubject != null) { + subjStr += "TSServerAuthContext.validateRequest called with non-null client Subject"; + } else { + subjStr += "TSServerAuthContext.validateRequest called with null client Subject"; + } + logger.log(Level.INFO, subjStr); + + // used to assist with the verification of assertion JASPI:SPEC:52 + verifyClientSubject(clientSubject); + + // used to assist with the verification of assertion JASPI:SPEC:53 and + // JASPI:SPEC:313 + verifyServiceSubject(serviceSubject); + + AuthStatus rval = serverAuthModule.validateRequest(messageInfo, + clientSubject, serviceSubject); + + logger.log(Level.INFO, msg); + + dumpAuthStatusString(rval, msg); + + // save off the MessageInfo object instance so that we can verify the + // same one is used in the call to SecureRequest (JASPI:SPEC:60) + messageInfoFromVerifyReq = messageInfo; + + return rval; + } + + public void dumpAuthStatusString(AuthStatus rval, String msg) { + + if (msg == null) { + msg = ""; + } + + if (rval == AuthStatus.SUCCESS) { + msg += " AuthStatus=AuthStatus.SUCCESS"; + } else if (rval == AuthStatus.FAILURE) { + msg += " AuthStatus=AuthStatus.FAILURE"; + } else if (rval == AuthStatus.SEND_SUCCESS) { + msg += " AuthStatus=AuthStatus.SEND_SUCCESS"; + } else if (rval == AuthStatus.SEND_FAILURE) { + msg += " AuthStatus=AuthStatus.SEND_FAILURE"; + } else if (rval == AuthStatus.SEND_CONTINUE) { + msg += " AuthStatus=AuthStatus.SEND_CONTINUE"; + } else { + msg += " AuthStatus=" + rval; + } + + logger.log(Level.INFO, msg); + } + + /* + * This verifies the client subject object for validateRequest() calls. This + * is used to assist with the verification of assertion JASPI:SPEC:52 by + * logging information about the state of the clientSubject The spec (section + * 2.1.5) states that clientSubject can not be null and that it can not be + * read-only. + * + */ + public void verifyClientSubject(Subject clientSubject) { + String msg = ""; + + if (clientSubject == null) { + // this is failure against the spec + msg = "FAILURE detected - ClientSubjects should not be null."; + } else { + msg = "Valid ClientSubjects - it was not null."; + } + logger.log(Level.INFO, msg); + + if (clientSubject != null) { + if (clientSubject.isReadOnly()) { + // this is failure against the spec + msg = "FAILURE detected - ClientSubjects should not be read-only."; + } else { + msg = "Valid ClientSubjects - it was not read-only."; + } + logger.log(Level.INFO, msg); + } + + } + + /* + * This verifies the service subject object for validateRequest() calls. This + * is used to assist with the verification of assertion JASPI:SPEC:53 by + * logging information regarding wether or not the serviceSubject passed into + * validateRequest was the same as what was used to acquire the + * ServerAuthContext. + */ + public void verifyServiceSubject(Subject serviceSubject) { + String msg = ""; + String key = JASPICData.SVC_SUBJECT_KEY; + Subject value = (Subject) properties.get(key); + + if (value != null) { + msg = "got a non-null subject out of the map"; + logger.log(Level.INFO, msg); + + if (serviceSubject == null) { + msg = "FAILURE detected - ServiceSubjects should be the same and are not."; + } else if (value.equals(serviceSubject)) { + msg = "ServiceSubjects correctly matched."; + } else { + // if here, serviceSubjects dont match but should + msg = "FAILURE detected - ServiceSubjects should be the same and are not."; + } + logger.log(Level.INFO, msg); + + if ((serviceSubject != null) && (value.equals(serviceSubject))) { + // to help verify assertion JASPI:SPEC:313 (per spec section 2.1.5.2): + // If a non-null Subject was used to call the ServerAuthContext + // the same Subject must be passed as the serviceSubject in this + // call. If a non-null serviceSubject is used in this call, it + // must not be read-only + if (serviceSubject.isReadOnly()) { + // should not get here. + msg = "FAILURE detected - ServiceSubjects should not be read-only."; + logger.log(Level.INFO, msg); + } else { + msg = "Valid ServiceSubjects - it was not read-only."; + logger.log(Level.INFO, msg); + } + } + } + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + AuthStatus rval = AuthStatus.SUCCESS; + Object reqObj = null; + Object respObj = null; + String msg = "TSServerAuthContext.secureResponse called"; + + // this msg used to verify assertion: JASPI:SPEC:130 + logger.log(Level.INFO, msg); + + msg = "secureResponse called for layer=" + messageLayer; + + try { + if (messageInfo != null) { + + verifyMessageInfoObjsMatch(messageInfo); // JASPI:SPEC:60 + + reqObj = messageInfo.getRequestMessage(); + respObj = messageInfo.getResponseMessage(); + if (reqObj != null) { + // if here, we want to see if our reqObj is type HttpServletRequest + if (reqObj instanceof jakarta.servlet.http.HttpServletRequest) { + String contextPath = ((HttpServletRequest) reqObj).getContextPath(); + String servletPath = ((HttpServletRequest) reqObj).getServletPath(); + + // note: we are leaving off the pathInfo since we only want + // to log contextPath and servletPath info so it's + // more of a pseudo requestURI we are validating but + // note that this will match our client so should be fine. + String requestURI = contextPath + servletPath; + msg += " for requestURI=" + requestURI; + } else { + msg += " reqObj instanceof=" + reqObj.getClass().getName(); + } + } else { + msg += " reqObj=NULL"; + } + } + logger.log(Level.INFO, msg); + + // used to assist with the verification of assertion JASPI:SPEC:61 + verifySecureRespServiceSubject(serviceSubject); + + rval = serverAuthModule.secureResponse(messageInfo, serviceSubject); + msg = ""; + dumpAuthStatusString(rval, msg); + + if (rval.equals(AuthStatus.SUCCESS)) { + // explicitly set return code but remember that we must be sure the + // response we stuff into the MessageInfo is wrapped in a + // HttpServletResponseWrapper object (jsr-196 spec section 3.8.3.4) + if (respObj != null) { + ((HttpServletResponse) respObj).setStatus(HttpServletResponse.SC_OK); + HttpServletResponseWrapper respWrapper = null; + if (!(reqObj instanceof jakarta.servlet.http.HttpServletResponseWrapper)) { + respWrapper = new HttpServletResponseWrapper( + (HttpServletResponse) respObj); + respWrapper.setStatus(HttpServletResponse.SC_OK); + messageInfo.setResponseMessage(respWrapper); + } else { + messageInfo.setResponseMessage((HttpServletResponse) respObj); + } + + logger.log(Level.INFO, + "Set the responseObjects return status to OK==200"); + } else { + logger.log(Level.INFO, + "ResponseObject == null so we could NOT set response status"); + } + } else { + logger.log(Level.INFO, + "authStatus != SUCCESS so not setting response object status == 200"); + } + } catch (AuthException ex) { + logger.log(Level.INFO, "Got AuthException"); + ex.printStackTrace(); + throw ex; + } catch (Exception ex) { + logger.log(Level.INFO, "Got generic Exception"); + ex.printStackTrace(); + } + + return rval; + } + + /* + * This is used to assist with verifying assertion: JASPI:SPEC:60 This is a + * convenience method that is used to verify if the passed in messageInfo + * object (which should be from secureRequest()) matches our previously saved + * off messageInfo object (which should be from our last call to + * validateRequest() - which we saved off in a static var. + */ + public void verifyMessageInfoObjsMatch(MessageInfo messageInfo) { + String err = "FAILURE: MessageInfo object in secureRequest does not"; + err += " match the messageInfo object from validateRequest"; + + String msg = "MessageInfo object from secureRequest matches the "; + msg += " messageInfo object from validateRequest"; + + // verify the passed in messageInfo + if ((messageInfo == null) && (messageInfoFromVerifyReq == null)) { + logger.log(Level.INFO, msg); + } else if ((messageInfo == null) || (messageInfoFromVerifyReq == null)) { + logger.log(Level.INFO, err); + if (messageInfo == null) { + msg = "Failure: secureRequest had null obj but validateRequest did not"; + logger.log(Level.INFO, msg); + } else { + msg = "Failure: validateRequest had null obj but secureResponse did not"; + logger.log(Level.INFO, msg); + } + } else if (!messageInfoFromVerifyReq.equals(messageInfo)) { + logger.log(Level.INFO, err); + logger.log(Level.INFO, + "FAILURE: messageInfo objects non-null but don't match"); + } else { + logger.log(Level.INFO, msg); + } + + return; + } + + /* + * This verifies the service subject object for secureResponse() calls. Spec + * says: (re: Pt 2 in MPR) "If a non-null serviceSubject is used in this call, + * it must not be read-only and the same serviceSubject must be passed in the + * call to secureResponse for the corresponding response (if there is one)." + * + */ + public void verifySecureRespServiceSubject(Subject serviceSubject) { + String msg = ""; + String key = JASPICData.SVC_SUBJECT_KEY; + Subject value = (Subject) properties.get(key); + + if (value != null) { + msg = "got a non-null subject out of the map"; + logger.log(Level.INFO, msg); + + if (serviceSubject == null) { + msg = "FAILURE detected - SecureResponse ServiceSubjects should be the same and are not."; + } else if (value.equals(serviceSubject)) { + msg = "SecureResponse ServiceSubjects correctly matched."; + } else { + // if here, serviceSubjects dont match but should + msg = "FAILURE detected - SecureResponse ServiceSubjects should be the same and are not."; + } + logger.log(Level.INFO, msg); + + if ((serviceSubject != null) && (value.equals(serviceSubject))) { + // to help verify assertion JASPI:SPEC:313 (per spec section 2.1.5.2): + // If a non-null Subject was used to call the ServerAuthContext + // the same Subject must be passed as the serviceSubject in this + // call. If a non-null serviceSubject is used in this call, it + // must not be read-only + if (serviceSubject.isReadOnly()) { + // should not get here. + msg = "FAILURE detected - SecureResponse ServiceSubjects should not be read-only."; + logger.log(Level.INFO, msg); + } else { + msg = "Valid SecureResponse ServiceSubjects - it was not read-only."; + logger.log(Level.INFO, msg); + } + } + } + + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logger.log(Level.INFO, "TSServerAuthContext.cleanSubject called"); + serverAuthModule.cleanSubject(messageInfo, subject); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/provider-configuration.xsd b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/provider-configuration.xsd new file mode 100644 index 0000000..9a9f0ad --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/config/provider-configuration.xsd @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/build.xml new file mode 100644 index 0000000..22278e1 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/build.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSClientAuthModule.java new file mode 100644 index 0000000..c126e68 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSClientAuthModule.java @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.servlet; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * This is a placeholder file that should not end up getting used by the servlet + * profile. Ideally we should be able to search the log file for strings from + * this class and we should not see any of those entries getting logged. + * + * @author Sun Microsystems + */ +public class TSClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private TSLogger logger = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSClientAuthModule() { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + logMsg("TSClientAuthModule() constructor called."); + } + + public TSClientAuthModule(TSLogger log) { + if (log != null) { + logger = log; + } else { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + } + logMsg("TSClientAuthModule(TSLogger) constructor called."); + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy requestPolicy, + MessagePolicy responsePolicy, CallbackHandler handler, Map options) + throws AuthException { + + if ((options != null) && (options.get("TSLogger") != null)) { + logger = (TSLogger) options.get("TSLogger"); + } + + logMsg("TSClientAuthModule.initialize() called."); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSClientAuthModule.getSupportedMessageTypes() called."); + Class[] classarray = { jakarta.servlet.http.HttpServletRequest.class, + jakarta.servlet.http.HttpServletResponse.class }; + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + logMsg("TSClientAuthModule.secureRequest() called."); + return AuthStatus.SUCCESS; + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + logMsg("TSClientAuthModule.validateResponse() called."); + return AuthStatus.SUCCESS; + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + + logMsg("TSClientAuthModule.cleanSubject() called."); + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSRequestWrapper.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSRequestWrapper.java new file mode 100644 index 0000000..9285aed --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSRequestWrapper.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.servlet; + +import java.io.IOException; +import java.util.Map; +import java.util.logging.Level; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; + +public class TSRequestWrapper extends HttpServletRequestWrapper { + private TSLogger logger = null; + + Map optionsMap = null; + + public TSRequestWrapper(HttpServletRequest request) { + super(request); + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + logMsg("TSRequestWrapper constructor called"); + } + + @Override + public Object getAttribute(String name) { + + if ("isRequestWrapped".equals(name)) { + return Boolean.TRUE; + } + + return super.getAttribute(name); + } + + @Override + public boolean authenticate(HttpServletResponse response) + throws IOException, ServletException { + + boolean bval = super.authenticate(response); + + debug("made it into TSRequestWrapper.authenticate()"); + + // + // NOTE: + // It is not clear that flow will make it into this method. So we will + // write out possible errors messages below and then check for occurances + // of those error messages from within the tests in spi/servlet. + // + + // do some checks and validation relates to JASPIC 1.1 spec + // section 3.8.4 (para 1) per assertion JASPIC:SPEC:322 + if (bval) { + String msg = ""; + // "Both cases, must also ensure that the value returned by calling + // getAuthType on the HttpServletRequest is consistent in terms of + // being null or non-null with the value returned by getUserPrincipal." + if ((super.getAuthType() != null) && super.getRemoteUser() != null) { + // This is good - both non-null so this is okay + msg = "HttpServletRequest authentication results match with getAuthType() and getRemoteUser()"; + } else if ((super.getAuthType() == null) + && super.getRemoteUser() == null) { + // This is good - both null, so this is okay too + msg = "HttpServletRequest authentication results match with getAuthType() and getRemoteUser()"; + } else { + // This is bad - must be mismatch between getAuthType() and + // getRemoteUser() + msg = "ERROR - HttpServletRequest authentication result mis-match with getAuthType() and getRemoteUser()"; + } + logger.log(Level.INFO, msg); + } + + // test for assertion: JASPIC:SPEC:323 from spec section 3.8.4, para 2: + // check if getAuthType() != null, and if not null, then check if + // MessageInfo Map + // sets/users key=jakarta.servlet.http.authType. If so, getAuthType should be + // set + // set to value of key. getAuthType should not be null on successful authN. + if (bval) { + String msg = ""; + + if ((super.getAuthType() != null) && (optionsMap != null)) { + // see if key=jakarta.servlet.http.authType exists and if so, make + // sure it matches the getAuthType() value + if (optionsMap.get("jakarta.servlet.http.authType") != null) { + // if here, then we need to make sure the value specified for + // getAuthType matches this value. + String val = (String) optionsMap.get("jakarta.servlet.http.authType"); + if (val == null) { + // spec violation - cant be null if key exists!!! + msg = "ERROR - invalid setting for jakarta.servlet.http.authType = null"; + } else if (!val.equalsIgnoreCase(super.getAuthType())) { + // spec violation - these have to match!! + msg = "ERROR - mismatch value set for jakarta.servlet.http.authType and getAuthType()"; + } else { + // we are good if here. + msg = "getAuthType() matches value for jakarta.servlet.http.authType"; + } + logger.log(Level.INFO, msg); + debug(msg); + debug("authenticate(): getAuthType() = " + super.getAuthType()); + debug("authenticate(): jakarta.servlet.http.authType = " + val); + } + } + + } + + return bval; + } + + public void setOptionsMap(Map options) { + optionsMap = options; + } + + public Map getOptionsMap() { + return optionsMap; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public void debug(String str) { + System.out.println("TSRequestWrapper: " + str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSResponseWrapper.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSResponseWrapper.java new file mode 100644 index 0000000..9ef3f02 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSResponseWrapper.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.servlet; + +import java.util.logging.Level; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; + +public class TSResponseWrapper extends HttpServletResponseWrapper { + private TSLogger logger = null; + + public TSResponseWrapper(HttpServletResponse response) { + super(response); + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + logMsg("TSResponseWrapper constructor called"); + } + + @Override + public String getHeader(String name) { + + if ("isResponseWrapped".equals(name)) { + return "true"; + } + + return super.getHeader(name); + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServerAuthModule.java new file mode 100644 index 0000000..c59f498 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServerAuthModule.java @@ -0,0 +1,871 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.servlet; + +import java.security.Principal; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.CommonCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ServerCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; + +/** + * + * @author Sun Microsystems + */ +public class TSServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private TSLogger logger = null; + + private static MessagePolicy requestPolicy = null; + + private static MessagePolicy responsePolicy = null; + + private static CallbackHandler callbackHandler = null; + + private static Map options = null; + + /** + * Creates a new instance of TSServerAuthModule + */ + public TSServerAuthModule() { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + logMsg("TSServerAuthModule() constructor called"); + } + + public TSServerAuthModule(TSLogger log) { + if (log != null) { + logger = log; + } else { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + } + logMsg("TSServerAuthModule(TSLogger) constructor called"); + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy requestPolicy, + MessagePolicy responsePolicy, CallbackHandler handler, Map options) + throws AuthException { + + if ((options != null) && (options.get("TSLogger") != null)) { + logger = (TSLogger) options.get("TSLogger"); + } + + this.requestPolicy = requestPolicy; + this.responsePolicy = responsePolicy; + callbackHandler = handler; + this.options = options; + + // perform some checking to support assertion JASPI:SPEC:87 + verifyRequestPolicy(requestPolicy); + + logger.log(Level.INFO, + "CBH for HttpServlet supports type: " + handler.getClass().getName()); + } + + /* + * This is a convenience method that will do some verification on the request + * policy to see if it complies with assertion JASPI:SPEC:87. If there are any + * problems found, appropriate log statements will be made and searched for + * later on in the Client code. + */ + private void verifyRequestPolicy(MessagePolicy requestPolicy) { + + String errStr = "Layer=" + JASPICData.LAYER_SERVLET; + errStr += " requestPolicy=invalid in TSServerAuthModule.initialize()"; + + if (requestPolicy == null) { + // we should never have a null requestpolicy here + logger.log(Level.SEVERE, errStr); + } else { + MessagePolicy.TargetPolicy[] tp = requestPolicy.getTargetPolicies(); + if (tp.length < 1) { + // must return an array containing at least one TargetPolicy + logger.log(Level.INFO, errStr); + } else { + for (int ii = 0; ii < tp.length; ii++) { + MessagePolicy.ProtectionPolicy pp = tp[ii].getProtectionPolicy(); + if ((pp != null) && (!isProtectionPolicyIDValid(pp.getID()))) { + String str = "Layer=" + JASPICData.LAYER_SERVLET; + str += " Invalid ProtectionPolicy.getID()"; + logger.log(Level.INFO, str); + } + } + } + } + } + + /* + * (spec section 3.7.4) For servlet profile, calling the getID() method on the + * ProtectionPolicy must return one of the following values: + * ProtectionPolicy.AUTHENTICATE_SENDER ProtectionPolicy.AUTHENTICATE_CONTENT + */ + public boolean isProtectionPolicyIDValid(String strId) { + boolean bval = false; + + if ((strId.equals(MessagePolicy.ProtectionPolicy.AUTHENTICATE_CONTENT)) + || (strId.equals(MessagePolicy.ProtectionPolicy.AUTHENTICATE_SENDER))) { + bval = true; + } + return bval; + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.servlet.http.HttpServletRequest.class, + jakarta.servlet.http.HttpServletResponse.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + String servletPath = request.getContextPath() + request.getServletPath(); + + String msg = "HttpServlet profile: "; + + if (clientSubject != null) { + msg += "TSServerAuthModule.validateRequest called with non-null client Subject"; + // msg += " principal=" + getPrincipalNameFromSubject(clientSubject); + } else { + msg += "TSServerAuthModule.validateRequest called with null client Subject"; + } + logMsg(msg); + + // lets ensure we are not pre-logged in + doCheckForPreLogin(messageInfo, clientSubject, serviceSubject); + + if (serviceSubject != null) { + msg = msg + " with serviceSubject :" + + getPrincipalNameFromSubject(serviceSubject); + } else { + msg = msg + " with null serviceSubject"; + } + logMsg(msg); + + // verify any profile keys + logMessageTypes(messageInfo, "validateRequest"); + dumpServletProfileKeys(messageInfo, "validateRequest"); + + // this is used to help us verify part of JASPI:SPEC:98 + // if auth is optional then we should be able to have a null + // principal. If auth is mandatory, then we need to set a + // principal object with some valid creds. + boolean bIsMandatory = isAuthMandatory(messageInfo); + + /* + * // XXXX: bug fix for bug: 12880835 if (bIsMandatory) { Principal + * principal = new SimplePrincipal("j2ee", "j2ee"); + * //clientSubject.getPrincipals().add(principal); } + */ + // support to test validateRequest is called regardless of whether authN + // is required (including when isMandatory is false) + logMsg("validateRequest() called for " + servletPath + ", isMandatory() = " + + bIsMandatory); + + // Check Callback Handler support for server runtime + logMsg("Dispatching to request for servletPath: " + servletPath); + CommonCallbackSupport commonCallbacks = new CommonCallbackSupport(logger, + callbackHandler, JASPICData.LAYER_SERVLET, "ServerRuntime"); + commonCallbacks.verify(); + + doServerCallbackChecks(messageInfo, clientSubject, serviceSubject); + + // determine return status based on pre-canned context ids + AuthStatus rval = getReturnStatus(messageInfo, clientSubject); + + setSpecialRequestAttribute(messageInfo, "validateReqCalled", "true"); + + return rval; + } + + /* + * This method checks if a user is pre-logged in for a servlet that required + * no authen. In such a case, we should NOT see any pre-authenticated status. + * This method should be called before any callback handler invocations occur. + */ + private boolean doCheckForPreLogin(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) { + + boolean rval = true; + String theServlet = "OpenToAllServlet"; + + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + String servletPath = request.getContextPath() + request.getServletPath(); + + if (servletPath.contains(theServlet)) { + // we found our request for the servlet that should have + // open perms and thus NOT require any authentication. + Principal pp = request.getUserPrincipal(); + + if (pp == null) { + // if here, we are good since we are not logged in (based on the + // premise that if logged in, calling getUserPrincipal() would + // have returned a non-null value.) + logMsg("Validated we are not prelogged in for " + theServlet); + } else { + // ERROR - something was non-null which indicates that we are + // pre-logged in (e.g. pre-authenticated) for a scenario that does + // not require authentication. Either that or we are (correctly) + // not logged in *but* are incorrectly getting back non-null values + // when not logged in nor authenticated. + logMsg("Failed validation check for being pre-logged in."); + logMsg("doCheckForPreLogin(): request.getUserPrincipal() = null"); + rval = false; + } + } + + return rval; + } + + private void doServerCallbackChecks(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) { + + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + String servletPath = request.getContextPath() + request.getServletPath(); + String msg = ""; + + ServerCallbackSupport serverCallbacks = new ServerCallbackSupport(logger, + callbackHandler, JASPICData.LAYER_SERVLET, messageInfo, clientSubject, + serviceSubject); + + // instead of calling all callbacks in one method, lets call them + // all individually so ithat we can check return values of each. + // serverCallbacks.verify(); + + if (serverCallbacks.verifyCPCCallback()) { + msg = "TSServerAuthModule.validateRequest(): verifyCPCCallback returned true"; + } else { + msg = "TSServerAuthModule.validateRequest(): verifyCPCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + if (serverCallbacks.verifyGPCCallback()) { + msg = "TSServerAuthModule.validateRequest(): verifyGPCCallback returned true"; + } else { + msg = "TSServerAuthModule.validateRequest(): verifyGPCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + if (serverCallbacks.verifyPVCCallback()) { + msg = "TSServerAuthModule.validateRequest(): verifyPVCCallback returned true"; + } else { + msg = "TSServerAuthModule.validateRequest(): verifyPVCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + return; + } + + private String getRequestURI(MessageInfo messageInfo) { + String requestURI = null; + Object reqObj = messageInfo.getRequestMessage(); + if ((reqObj != null) + && (reqObj instanceof jakarta.servlet.http.HttpServletRequest)) { + requestURI = ((HttpServletRequest) reqObj).getRequestURI(); + } + return requestURI; + } + + /* + * This method will have some pre-canned status responses built into based on + * what the user name is. We will return status codes based on the passed in + * context info. + * + * One goal of this method is to cause a Callbackhandler to be invoked such + * that the Callbackhandler will return an AuthStatus code that matches our + * pre-canned (returned) AuthStatus. + */ + private AuthStatus getReturnStatus(MessageInfo msgInfo, Subject subject) + throws AuthException { + AuthStatus rval = AuthStatus.SUCCESS; + String strStatus = "AuthStatus.SUCCESS"; + String msg; + int statusCode = 200; + + // get request object + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + // get name of servlet(servletPath) and not the app (eg context path) + String servletName = request.getServletPath(); + + msg = "HttpServlet profile with servletName=" + servletName; + String respMsg = ""; + if (servletName.contains(JASPICData.AUTHSTAT_SENDFAILURE_ND)) { + rval = AuthStatus.SEND_FAILURE; + strStatus = "AuthStatus.SEND_FAILURE"; + statusCode = 500; + + } else if (servletName.contains(JASPICData.AUTHSTAT_SENDCONT_ND)) { + rval = AuthStatus.SEND_CONTINUE; + strStatus = "AuthStatus.SEND_CONTINUE"; + statusCode = 401; + + } else if (servletName.contains(JASPICData.AUTHSTAT_SENDSUCCESS_ND)) { + rval = AuthStatus.SEND_SUCCESS; + strStatus = "AuthStatus.SEND_SUCCESS"; + statusCode = 200; + + } else if (servletName.contains(JASPICData.AUTHSTAT_FAILURE_ND)) { + rval = AuthStatus.FAILURE; + strStatus = "AuthStatus.FAILURE"; + statusCode = 500; + + } else if (servletName.contains(JASPICData.AUTHSTAT_THROW_EX_ND)) { + msg += " returning AuthStatus=AuthException"; + logger.log(Level.INFO, msg); + throw new AuthException(msg); + + } else if (servletName.contains(JASPICData.AUTHSTAT_SUCCESS_ND) + || servletName.contains(JASPICData.AUTHSTAT_OPT_SUCCESS) + || servletName.contains(JASPICData.AUTHSTAT_MAND_SUCCESS)) { + rval = AuthStatus.SUCCESS; + strStatus = "AuthStatus.SUCCESS"; + } + + msg += " returning AuthStatus=" + strStatus; + logger.log(Level.INFO, msg); + + // lets get our response message in case we need to do something... + Object respObj = msgInfo.getResponseMessage(); + HttpServletResponseWrapper response = null; + if (respObj != null) { + if (respObj instanceof jakarta.servlet.http.HttpServletResponseWrapper) { + if (response != null) { + response.setStatus(statusCode); + msgInfo.setResponseMessage(response); + } + } else if (respObj instanceof jakarta.servlet.http.HttpServletResponse) { + response = new HttpServletResponseWrapper( + (HttpServletResponse) respObj); + response.setStatus(statusCode); + msgInfo.setResponseMessage(response); + } else { + msg = "WARNING: we have some unidentified response object."; + logger.log(Level.INFO, msg); + } + } + + return (AuthStatus) rval; + } + + /* + * This is a convenience method that will likely only be called once. + * Currently there is only one key to dump from the map, but his may change in + * the future. + */ + private void dumpServletProfileKeys(MessageInfo msgInfo, + String callerMethod) { + + Map map = msgInfo.getMap(); + + // lets pull out some context info that we can use to help uniquely + // identify the source of this request + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + String servletName = request.getServletPath(); + + /* + * // see assertion JASPI:SPEC:306 for details on this // jsr-196 states the + * following key must exist for servlet profile String strKey = + * "jakarta.security.auth.message.MessagePolicy.isMandatory"; if (map != null) + * { String keyVal = (String)map.get(strKey); String msg = + * "dumpServletProfileKeys() called with attrs: "; msg += " layer=" + + * JASPICData.LAYER_SERVLET; msg += " servletName=" + servletName; msg += + * " callerMethod=" + callerMethod; msg += " key=" + strKey; + * + * if (keyVal == null) { msg += " value=NULL"; } else if + * (Boolean.valueOf(keyVal).booleanValue() == true) { msg += " value=Valid"; + * } else { msg += " value=Invalid value of: " + keyVal; } + * logger.log(Level.INFO, msg); } + */ + + // see assertion JASPI:SPEC:306 for details on this + // jsr-196 states the following key must exist for servlet profile + if (map != null) { + Set keys = map.keySet(); + Iterator iterator = keys.iterator(); + while (iterator.hasNext()) { + Object oKey = (Object) iterator.next(); + if (oKey instanceof String) { + String key = (String) oKey; + if (key != null) { + Object obj = map.get(key); + if (obj instanceof String) { + String keyVal = (String) map.get(key); + String msg = "dumpServletProfileKeys() called with attrs: "; + msg += " layer=" + JASPICData.LAYER_SERVLET; + msg += " servletName=" + servletName; + msg += " callerMethod=" + callerMethod; + msg += " key=" + key; + + if (keyVal == null) { + msg += " value=NULL"; + } else if (Boolean.valueOf(keyVal).booleanValue() == true) { + msg += " value=Valid"; + } else { + msg += " value=Invalid value of: " + keyVal; + } + logger.log(Level.INFO, msg); + } else { + logger.log(Level.INFO, + "Map key is of type :" + obj.getClass().getName()); + } + } + } + } + } + + } + + private boolean isAuthMandatory(MessageInfo msgInfo) { + boolean bval = false; + Map map = msgInfo.getMap(); + + // lets pull out some context info that we can use to help uniquely + // identify the source of this request + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + String servletName = request.getServletPath(); + + // see assertion JASPI:SPEC:306 for details on this + // jsr-196 states the following key must exist for servlet profile + String strKey = "jakarta.security.auth.message.MessagePolicy.isMandatory"; + String msg; + if (map != null) { + String keyVal = (String) map.get(strKey); + msg = "isAuthMandatory() called with attrs: "; + msg += " layer=" + JASPICData.LAYER_SERVLET; + msg += " servletName=" + servletName; + msg += " key=" + strKey; + + if (keyVal == null) { + msg += " value=NULL"; + bval = false; // assume false if we cant determine + } else if (Boolean.valueOf(keyVal).booleanValue() == true) { + msg += " value=Valid"; + bval = true; + } else { + // assume false + msg += " value=false"; + bval = false; + } + logger.log(Level.FINE, msg); + } else { + msg = "FAILURE: No map in MessageInfo thus no key=" + strKey; + logger.log(Level.SEVERE, msg); + } + + return bval; + } + + /* + * Convenience method to dump messageInfo logging out. + */ + private void logMessageTypes(MessageInfo messageInfo, String methodName) { + String msg; + + String requestURI = ""; + + if (messageInfo != null) { + Object reqObj = messageInfo.getRequestMessage(); + if (reqObj != null) { + // if here, we want to see if our reqObj is type HttpServletRequest + // and if so print out a log msg stating so. (jsr-196 expects the + // reqObj to be type HttpServletRequest) + msg = methodName + ": MessageInfo.getRequestMessage() is of type "; + if (reqObj instanceof jakarta.servlet.http.HttpServletRequest) { + msg = msg + "jakarta.servlet.http.HttpServletRequest"; + requestURI = ((HttpServletRequest) reqObj).getRequestURI(); + + // related to assertion JASPI:SPEC:95 , this block of code + // may be needed if we need to identify which servlet invoked this + if (requestURI != null) { + // we want to know which servlet/jsp/html page generated + // this action and we want to include that in the log so we + // can check if the log gets generated for both servlets and + // for static html - which is a jsr-196 requirement. + String msg2 = msg + " for requestURI=" + requestURI; + logMsg(msg2); + } + } else { + msg = msg + messageInfo.getClass().getName(); + } + logMsg(msg); + } + + Object respObj = messageInfo.getResponseMessage(); + if (respObj != null) { + // if here, we want to see if our respObj is type HttpServletResponse + // and if so print out a log msg stating so. (jsr-196 expects the + // respObj to be type HttpServletResponse) + msg = methodName + ": MessageInfo.getResponseMessage() is of type "; + if (respObj instanceof jakarta.servlet.http.HttpServletResponse) { + msg = msg + "jakarta.servlet.http.HttpServletResponse"; + /* + * if (requestURI != null) { // this should have been obtained from + * the requestObj above msg = msg +" for requestURI=" + requestURI; } + */ + } else { + msg = msg + messageInfo.getClass().getName(); + } + logMsg(msg); + } + + } else { + msg = "TSServerAuthModule." + methodName + + " called with null MessageInfo object."; + logMsg(msg); + } + + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + + logMsg("Enterred secureResponse"); + + String msg = ""; + if (serviceSubject != null) { + msg = "TSServerAuthModule.secureResponse called with serviceSubject :" + + getPrincipalNameFromSubject(serviceSubject); + } else { + msg = "TSServerAuthModule.secureResponse called with null service Subject"; + } + logMsg(msg); + + logMessageTypes(messageInfo, "secureResponse"); + dumpServletProfileKeys(messageInfo, "secureResponse"); + + // verify that our context was not one that should have avoided a + // dispatch to service and thus should not have called secureResponse() + verifySecureResponseShouldHaveBeenCalled(messageInfo); + + // help verify assertion: JASPIC:SPEC:108 + setSpecialRequestAttribute(messageInfo, "secureRespCalled", "true"); + + return AuthStatus.SEND_SUCCESS; + } + + /* + * This is a specialized method used to set a request attribute that will be + * checked during the servlet/service invocation the idea is that + * secureResponse should not be called before the servlet/service invocation. + */ + public void setSpecialRequestAttribute(MessageInfo msgInfo, String key, + String value) { + boolean bval = true; + String msg; + + logMsg("TSServerAuthModule() setSpecialRequestAttribute called"); + + try { + // get request object + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + // we want the servletpath here (not the context path) as this + // will give us a better idea which servlet was invoked + String servletName = request.getServletPath(); + + if ((servletName.contains(JASPICData.AUTHSTAT_MAND_SUCCESS))) { + // lets set our cts proprietary request attr indicating + // flow was in secureResponse + logMsg( + "setSpecialRequestAttribute() called for servlet: " + servletName); + + request.setAttribute(key, value); + msgInfo.setRequestMessage(request); + logMsg( + "setSpecialRequestAttribute(): setAttribute() set for secureRespCalled=true"); + } + } catch (Exception ex) { + // should not get here but in case, dump the ex and return true + msg = "Got Unexpected Exception!"; + msg += " Exception message was: " + ex.toString(); + logMsg(msg + ""); + ex.printStackTrace(); + } + + } + + public void verifySecureResponseShouldHaveBeenCalled(MessageInfo msgInfo) { + boolean bval = true; + String msg; + + try { + // get request object + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + // we want the servletpath here (not the context path) as this + // will give us a better idea which servlet was invoked + String servletName = request.getServletPath(); + + if ((servletName.contains(JASPICData.AUTHSTAT_SENDFAILURE_ND)) + || (servletName.contains(JASPICData.AUTHSTAT_SENDSUCCESS_ND)) + || (servletName.contains(JASPICData.AUTHSTAT_FAILURE_ND)) + || (servletName.contains(JASPICData.AUTHSTAT_THROW_EX_ND)) + || (servletName.contains(JASPICData.AUTHSTAT_SUCCESS_ND))) { + // we have a specific context indicating we should NOT have been + // dispatched to a service (ie should not be in secureResponse) + msg = "FAILURE: should not have been dispatched to secureResponse"; + logger.log(Level.INFO, msg); + } + } catch (Exception ex) { + // should not get here but in case, dump the ex and return true + msg = "Got Unexpected Exception!"; + msg += " Exception message was: " + ex.getMessage(); + logger.log(Level.INFO, msg); + ex.printStackTrace(); + } + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + + logMsg("TSServerAuthModule.cleanSubject called"); + subject = null; + // subject = new Subject(); + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public String getPrincipalNameFromSubject(Subject sub) { + Principal principal = null; + String concatPrincipalName = ""; + Set principalSet = sub.getPrincipals(); + + Iterator iterator = principalSet.iterator(); + while (iterator.hasNext()) { + principal = (Principal) iterator.next(); + concatPrincipalName += principal.getName(); + } + + return concatPrincipalName; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServletWrapperSAM.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServletWrapperSAM.java new file mode 100644 index 0000000..0219071 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/servlet/TSServletWrapperSAM.java @@ -0,0 +1,402 @@ +/* + * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.servlet; + +import java.security.Principal; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.JASPICData; +import com.sun.ts.tests.jaspic.tssv.util.ServerCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +public class TSServletWrapperSAM + implements jakarta.security.auth.message.module.ServerAuthModule { + private TSLogger logger = null; + + private static MessagePolicy requestPolicy = null; + + private static MessagePolicy responsePolicy = null; + + private static CallbackHandler callbackHandler = null; + + private static Map options = null; + + private CallbackHandler handler; + + private Class[] supportedMessageTypes = new Class[] { + HttpServletRequest.class, HttpServletResponse.class }; + + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + doServerCallbackChecks(messageInfo, clientSubject, serviceSubject); + + // Wrap the request - the resource to be invoked should get to see this + TSRequestWrapper tswrap = new TSRequestWrapper( + (HttpServletRequest) messageInfo.getRequestMessage()); + tswrap.setOptionsMap(messageInfo.getMap()); + messageInfo.setRequestMessage(tswrap); + + // Wrap the response - the resource to be invoked should get to see this + messageInfo.setResponseMessage(new TSResponseWrapper( + (HttpServletResponse) messageInfo.getResponseMessage())); + + return AuthStatus.SUCCESS; + } + + @Override + public Class[] getSupportedMessageTypes() { + return supportedMessageTypes; + } + + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + + // Unwrap the request + if (request instanceof TSRequestWrapper) { + messageInfo.setRequestMessage(((TSRequestWrapper) request).getRequest()); + } else { + logMsg("Incorrect request type : " + request.getClass().getName()); + } + + HttpServletResponse response = (HttpServletResponse) messageInfo + .getResponseMessage(); + + if (response instanceof TSResponseWrapper) { + messageInfo + .setResponseMessage(((TSResponseWrapper) response).getResponse()); + } else { + logMsg("Incorrect response type : " + response.getClass().getName()); + } + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Creates a new instance of TSServletWrapperSAM + */ + public TSServletWrapperSAM() { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + logMsg("TSServletWrapperSAM() constructor called"); + } + + public TSServletWrapperSAM(TSLogger log) { + if (log != null) { + logger = log; + } else { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + } + logMsg("TSServletWrapperSAM(TSLogger) constructor called"); + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy requestPolicy, + MessagePolicy responsePolicy, CallbackHandler handler, Map options) + throws AuthException { + + if ((options != null) && (options.get("TSLogger") != null)) { + logger = (TSLogger) options.get("TSLogger"); + } + + this.requestPolicy = requestPolicy; + this.responsePolicy = responsePolicy; + callbackHandler = handler; + this.options = options; + + // perform some checking to support assertion JASPI:SPEC:87 + verifyRequestPolicy(requestPolicy); + + logger.log(Level.INFO, + "CBH for HttpServlet supports type: " + handler.getClass().getName()); + } + + /* + * This is a convenience method that will do some verification on the request + * policy to see if it complies with assertion JASPI:SPEC:87. If there are any + * problems found, appropriate log statements will be made and searched for + * later on in the Client code. + */ + private void verifyRequestPolicy(MessagePolicy requestPolicy) { + + String errStr = "Layer=" + JASPICData.LAYER_SERVLET; + errStr += " requestPolicy=invalid in TSServletWrapperSAM.initialize()"; + + if (requestPolicy == null) { + // we should never have a null requestpolicy here + logger.log(Level.SEVERE, errStr); + } else { + MessagePolicy.TargetPolicy[] tp = requestPolicy.getTargetPolicies(); + if (tp.length < 1) { + // must return an array containing at least one TargetPolicy + logger.log(Level.INFO, errStr); + } else { + for (int ii = 0; ii < tp.length; ii++) { + MessagePolicy.ProtectionPolicy pp = tp[ii].getProtectionPolicy(); + if ((pp != null) && (!isProtectionPolicyIDValid(pp.getID()))) { + String str = "Layer=" + JASPICData.LAYER_SERVLET; + str += " Invalid ProtectionPolicy.getID()"; + logger.log(Level.INFO, str); + } + } + } + } + } + + /* + * (spec section 3.7.4) For servlet profile, calling the getID() method on the + * ProtectionPolicy must return one of the following values: + * ProtectionPolicy.AUTHENTICATE_SENDER ProtectionPolicy.AUTHENTICATE_CONTENT + */ + public boolean isProtectionPolicyIDValid(String strId) { + boolean bval = false; + + if ((strId.equals(MessagePolicy.ProtectionPolicy.AUTHENTICATE_CONTENT)) + || (strId.equals(MessagePolicy.ProtectionPolicy.AUTHENTICATE_SENDER))) { + bval = true; + } + return bval; + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + /* + * @Override public Class[] getSupportedMessageTypes() { + * logMsg("TSServletWrapperSAM.getSupportedMessageTypes called"); Class[] + * classarray = { + * com.sun.ts.tests.jaspic.tssv.module.servlet.TSRequestWrapper.class, + * com.sun.ts.tests.jaspic.tssv.module.servlet.TSResponseWrapper.class }; + * return classarray; } + */ + + private String getRequestURI(MessageInfo messageInfo) { + String requestURI = null; + Object reqObj = messageInfo.getRequestMessage(); + if ((reqObj != null) + && (reqObj instanceof jakarta.servlet.http.HttpServletRequest)) { + requestURI = ((HttpServletRequest) reqObj).getRequestURI(); + } + return requestURI; + } + + /* + * Convenience method to dump messageInfo logging out. + */ + private void logMessageTypes(MessageInfo messageInfo, String methodName) { + String msg; + + String requestURI = ""; + + if (messageInfo != null) { + Object reqObj = messageInfo.getRequestMessage(); + if (reqObj != null) { + // if here, we want to see if our reqObj is type + // HttpServletRequest + // and if so print out a log msg stating so. (jsr-196 expects + // the + // reqObj to be type HttpServletRequest) + msg = methodName + ": MessageInfo.getRequestMessage() is of type "; + if (reqObj instanceof jakarta.servlet.http.HttpServletRequest) { + msg = msg + "jakarta.servlet.http.HttpServletRequest"; + requestURI = ((HttpServletRequest) reqObj).getRequestURI(); + + // related to assertion JASPI:SPEC:95 , this block of code + // may be needed if we need to identify which servlet + // invoked this + if (requestURI != null) { + // we want to know which servlet/jsp/html page generated + // this action and we want to include that in the log so + // we + // can check if the log gets generated for both servlets + // and + // for static html - which is a jsr-196 requirement. + String msg2 = msg + " for requestURI=" + requestURI; + logMsg(msg2); + } + } else { + msg = msg + messageInfo.getClass().getName(); + } + logMsg(msg); + } + + Object respObj = messageInfo.getResponseMessage(); + if (respObj != null) { + // if here, we want to see if our respObj is type + // HttpServletResponse + // and if so print out a log msg stating so. (jsr-196 expects + // the + // respObj to be type HttpServletResponse) + msg = methodName + ": MessageInfo.getResponseMessage() is of type "; + if (respObj instanceof jakarta.servlet.http.HttpServletResponse) { + msg = msg + "jakarta.servlet.http.HttpServletResponse"; + /* + * if (requestURI != null) { // this should have been obtained from + * the requestObj above msg = msg +" for requestURI=" + requestURI; } + */ + } else { + msg = msg + messageInfo.getClass().getName(); + } + logMsg(msg); + } + + } else { + msg = "TSServletWrapperSAM." + methodName + + " called with null MessageInfo object."; + logMsg(msg); + } + + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + + logMsg("TSServletWrapperSAM.cleanSubject called"); + subject = null; + // subject = new Subject(); + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public String getPrincipalNameFromSubject(Subject sub) { + Principal principal = null; + String concatPrincipalName = ""; + Set principalSet = sub.getPrincipals(); + + Iterator iterator = principalSet.iterator(); + while (iterator.hasNext()) { + principal = (Principal) iterator.next(); + concatPrincipalName += principal.getName(); + } + + return concatPrincipalName; + } + + private void doServerCallbackChecks(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) { + + HttpServletRequest request = (HttpServletRequest) messageInfo + .getRequestMessage(); + String servletPath = request.getContextPath() + request.getServletPath(); + String msg = ""; + + ServerCallbackSupport serverCallbacks = new ServerCallbackSupport(logger, + callbackHandler, JASPICData.LAYER_SERVLET, messageInfo, clientSubject, + serviceSubject); + + // instead of calling all callbacks in one method, lets call them + // all individually so ithat we can check return values of each. + // serverCallbacks.verify(); + + if (serverCallbacks.verifyCPCCallback()) { + msg = "TSServletWrapperSAM.validateRequest(): verifyCPCCallback returned true"; + } else { + msg = "TSServletWrapperSAM.validateRequest(): verifyCPCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + if (serverCallbacks.verifyGPCCallback()) { + msg = "TSServletWrapperSAM.validateRequest(): verifyGPCCallback returned true"; + } else { + msg = "TSServletWrapperSAM.validateRequest(): verifyGPCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + if (serverCallbacks.verifyPVCCallback()) { + msg = "TSServletWrapperSAM.validateRequest(): verifyPVCCallback returned true"; + } else { + msg = "TSServletWrapperSAM.validateRequest(): verifyPVCCallback returned false"; + } + msg += " for servletPath = " + servletPath; + logMsg(msg); + + return; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionClientAuthModule.java new file mode 100644 index 0000000..3323ce2 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionClientAuthModule.java @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSAuthExceptionClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSAuthExceptionClientAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + logMsg("TSAuthExceptionClientAuthModule.getSupportedMessageTypes called"); + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + String msg = "TSAuthExceptionClientAuthModule.secureRequest called"; + logMsg(msg); + throw new AuthException( + "TSAuthExceptionClientAuthModule.secureRequest throws AuthException"); + + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + String msg = "TSAuthExceptionClientAuthModule.validateResponse called"; + logMsg(msg); + + throw new AuthException( + "TSAuthExceptionClientAuthModule.validateResponse throws AuthException"); + + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSAuthExceptionClientAuthModule.cleanSubject called"); + + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + /* + * + * SOAPPart soap = smsg.getSOAPPart(); if (soap != null) { try { SOAPEnvelope + * envelope = soap.getEnvelope(); if (envelope != null) { SOAPBody body = + * envelope.getBody(); if (body != null) { QName qname = new QName("Client"); + * body.addFault(qname, "Error in Client"); } } } catch (SOAPException se) { + * logger.log(Level.INFO, "Error adding SOAP Fault", se); + * + * } } } + */ + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionServerAuthModule.java new file mode 100644 index 0000000..0a40f32 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSAuthExceptionServerAuthModule.java @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSAuthExceptionServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of TSAuthExceptionServerAuthModule + */ + public TSAuthExceptionServerAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSAuthExceptionServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + String msg = "TSAuthExceptionServerAuthModule.validateRequest called"; + logMsg(msg); + + return AuthStatus.SUCCESS; + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + String msg = "TSAuthExceptionServerAuthModule.secureResponse called"; + logMsg(msg); + return AuthStatus.SEND_SUCCESS; + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSAuthExceptionServerAuthModule.cleanSubject called"); + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSClientAuthModule.java new file mode 100644 index 0000000..652356d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSClientAuthModule.java @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.security.Principal; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; +import javax.xml.namespace.QName; + +import com.sun.ts.tests.jaspic.tssv.util.ClientCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.CommonCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private static TSLogger logger = null; + + private static CallbackHandler callbackHandler = null; + + private static Map options = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSClientAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + callbackHandler = handler; + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + logMsg("TSClientAuthModule.getSupportedMessageTypes called"); + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + String msg = ""; + if (clientSubject != null) { + msg = "TSClientAuthModule.secureRequest called with client Subject :" + + getPrincipalNameFromSubject(clientSubject); + } else + msg = "TSClientAuthModule.secureRequest called with null client Subject"; + + logMsg(msg); + logMessageTypes(messageInfo, "secureRequest"); + + // Check Callback Handler support for SOAP Client runtime + ClientCallbackSupport clientCallbackSupport = new ClientCallbackSupport( + logger, callbackHandler, "SOAP"); + + clientCallbackSupport.verify(); + + // Check CommonCallbacks support for SOAP client runtime + CommonCallbackSupport commonCallbacks = new CommonCallbackSupport(logger, + callbackHandler, "SOAP", "ClientRuntime"); + + commonCallbacks.verify(); + + // Log the value for key jakarta.xml.ws.wsdl.service in messageInfoMap + Map messageInfoMap = messageInfo.getMap(); + + QName qName = (QName) messageInfoMap.get("jakarta.xml.ws.wsdl.service"); + + if (qName != null) { + String qNameToString = qName.toString(); + + msg = "TSClientAuthModule.secureRequest messageInfo :" + + "jakarta.xml.ws.wsdl.service=" + qNameToString; + } else { + msg = "TSClientAuthModule.secureRequest messageInfo :" + + "** ERROR ** No value found for key jakarta.xml.ws.wsdl.service in MessageInfoMap" + + " : Expected a QName"; + + } + logMsg(msg); + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + String msg = ""; + if (clientSubject != null) { + msg = "TSClientAuthModule.validateResponse called with client Subject :" + + getPrincipalNameFromSubject(clientSubject); + } else + msg = "TSClientAuthModule.validateResponse called with null client Subject"; + + if (serviceSubject != null) { + msg = msg + " with serviceSubject :" + + getPrincipalNameFromSubject(serviceSubject); + } else + msg = msg + " with null serviceSubject"; + + logMsg(msg); + logMessageTypes(messageInfo, "validateResponse"); + + // Log the value for key jakarta.xml.ws.wsdl.service in messageInfoMap + Map messageInfoMap = messageInfo.getMap(); + + QName qName = (QName) messageInfoMap.get("jakarta.xml.ws.wsdl.service"); + + if (qName != null) { + String qNameToString = qName.toString(); + + msg = "TSClientAuthModule.validateResponse messageInfo :" + + "jakarta.xml.ws.wsdl.service=" + qNameToString; + } else { + msg = "TSClientAuthModule.validateResponse messageInfo :" + + "** ERROR ** No value found for key jakarta.xml.ws.wsdl.service in MessageInfoMap" + + " : Expected a QName "; + + } + logMsg(msg); + + return AuthStatus.SUCCESS; + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSClientAuthModule.cleanSubject called"); + + // remove the contents of the subject and return an empty subject + subject = null; + + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public String getPrincipalNameFromSubject(Subject sub) { + Principal principal = null; + String concatPrincipalName = ""; + Set principalSet = sub.getPrincipals(); + + Iterator iterator = principalSet.iterator(); + while (iterator.hasNext()) { + principal = (Principal) iterator.next(); + concatPrincipalName += principal.getName(); + } + + return concatPrincipalName; + } + + private void logMessageTypes(MessageInfo messageInfo, String methodName) { + String msg = null; + + Object requestMessage = messageInfo.getRequestMessage(); + Object responseMessage = messageInfo.getResponseMessage(); + + if (requestMessage != null) { + if (requestMessage instanceof jakarta.xml.soap.SOAPMessage) { + msg = methodName + + " : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage"; + logMsg(msg); + } else { + msg = methodName + " : MessageInfo.getRequestMessage() is of type " + + requestMessage.getClass().getName(); + logMsg(msg); + + } + } + + if (responseMessage != null) { + if (responseMessage instanceof jakarta.xml.soap.SOAPMessage) { + msg = methodName + + " : MessageInfo.getResponseMessage() is of type jakarta.xml.soap.SOAPMessage"; + logMsg(msg); + } else { + msg = methodName + " : MessageInfo.getResponseMessage() is of type " + + responseMessage.getClass().getName(); + logMsg(msg); + + } + } + + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureClientAuthModule.java new file mode 100644 index 0000000..583196d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureClientAuthModule.java @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; +import javax.xml.namespace.QName; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +/** + * + * @author Raja Perumal + */ +public class TSFailureClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSFailureClientAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + logMsg("TSFailureClientAuthModule.getSupportedMessageTypes called"); + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + String msg = "TSFailureClientAuthModule.secureRequest called"; + logMsg(msg); + SOAPMessage smsg = null; + + try { + + MessageFactory mf = MessageFactory.newInstance(); + smsg = mf.createMessage(); + if (smsg != null) { + setSOAPFault(smsg); + } + + } catch (SOAPException ex) { + ex.printStackTrace(); + } + + // set the response message with SOAP Fault + messageInfo.setResponseMessage(smsg); + + return AuthStatus.FAILURE; + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + String msg = "TSFailureClientAuthModule.validateResponse called"; + logMsg(msg); + + SOAPMessage smsg = (SOAPMessage) messageInfo.getResponseMessage(); + if (smsg != null) { + setSOAPFault(smsg); + } + + return AuthStatus.FAILURE; + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSFailureClientAuthModule.cleanSubject called"); + + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + private void setSOAPFault(SOAPMessage smsg) { + SOAPPart soap = smsg.getSOAPPart(); + if (soap != null) { + try { + SOAPEnvelope envelope = soap.getEnvelope(); + if (envelope != null) { + SOAPBody body = envelope.getBody(); + if (body != null) { + QName qname = new QName("Client"); + body.addFault(qname, "Error in Client"); + } + } + } catch (SOAPException se) { + logger.log(Level.INFO, "Error adding SOAP Fault", se); + + } + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureServerAuthModule.java new file mode 100644 index 0000000..ad31b82 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSFailureServerAuthModule.java @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSFailureServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of TSFailureServerAuthModule + */ + public TSFailureServerAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSFailureServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + String msg = "TSFailureServerAuthModule.validateRequest called"; + logMsg(msg); + + return AuthStatus.SUCCESS; + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + String msg = "TSFailureServerAuthModule.secureResponse called"; + logMsg(msg); + return AuthStatus.SEND_SUCCESS; + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSFailureServerAuthModule.cleanSubject called"); + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureClientAuthModule.java new file mode 100644 index 0000000..61ed2a7 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureClientAuthModule.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPFault; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +/** + * + * @author Raja Perumal + */ +public class TSSendFailureClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSSendFailureClientAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + logMsg("TSSendFailureClientAuthModule.getSupportedMessageTypes called"); + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + String msg = "TSSendFailureClientAuthModule.secureRequest called"; + logMsg(msg); + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + String msg = "TSSendFailureClientAuthModule.validateResponse called"; + logMsg(msg); + + SOAPMessage smsg = (SOAPMessage) messageInfo.getResponseMessage(); + String faultString = getSOAPFaultString(smsg); + if (faultString != null) { + msg = "TSSendFailureClientAuthModule.validateResponse received SOAPFault :" + + faultString; + logMsg(msg); + } + return AuthStatus.SUCCESS; + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSSendFailureClientAuthModule.cleanSubject called"); + + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + private String getSOAPFaultString(SOAPMessage smsg) { + String faultString = null; + SOAPPart soap = smsg.getSOAPPart(); + if (soap != null) { + try { + SOAPEnvelope envelope = soap.getEnvelope(); + if (envelope != null) { + SOAPBody body = envelope.getBody(); + if (body != null) { + if (body.hasFault()) { + SOAPFault sf = body.getFault(); + faultString = sf.getFaultString(); + } + } + } + } catch (SOAPException se) { + logger.log(Level.INFO, "Error adding SOAP Fault", se); + + } + } + return faultString; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureServerAuthModule.java new file mode 100644 index 0000000..02f454e --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendFailureServerAuthModule.java @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; +import javax.xml.namespace.QName; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +/** + * + * @author Raja Perumal + */ +public class TSSendFailureServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of TSSendFailureServerAuthModule + */ + public TSSendFailureServerAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSSendFailureServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + String msg = "TSSendFailureServerAuthModule.validateRequest called"; + logMsg(msg); + + SOAPMessage smsg = null; + + try { + + MessageFactory mf = MessageFactory.newInstance(); + smsg = mf.createMessage(); + if (smsg != null) { + setSOAPFault(smsg); + } + + } catch (SOAPException ex) { + ex.printStackTrace(); + } + + // set the response message with SOAP Fault + messageInfo.setResponseMessage(smsg); + + return AuthStatus.SEND_FAILURE; + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + String msg = "TSSendFailureServerAuthModule.secureResponse called"; + logMsg(msg); + + SOAPMessage smsg = null; + + try { + + MessageFactory mf = MessageFactory.newInstance(); + smsg = mf.createMessage(); + if (smsg != null) { + setSOAPFault(smsg); + } + + } catch (SOAPException ex) { + ex.printStackTrace(); + } + + // set the response message with SOAP Fault + messageInfo.setResponseMessage(smsg); + + return AuthStatus.SEND_FAILURE; + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSSendFailureServerAuthModule.cleanSubject called"); + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + private void setSOAPFault(SOAPMessage smsg) { + SOAPPart soap = smsg.getSOAPPart(); + if (soap != null) { + try { + SOAPEnvelope envelope = soap.getEnvelope(); + if (envelope != null) { + SOAPBody body = envelope.getBody(); + if (body != null) { + QName qname = new QName("Server"); + body.addFault(qname, "Error in Server"); + + } + } + } catch (SOAPException se) { + logger.log(Level.INFO, "Error adding SOAP Fault", se); + + } + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessClientAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessClientAuthModule.java new file mode 100644 index 0000000..6399b41 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessClientAuthModule.java @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSSendSuccessClientAuthModule + implements jakarta.security.auth.message.module.ClientAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of ClientAuthModuleImpl + */ + public TSSendSuccessClientAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects where each element defines a message type + * supported by the module. A module should return an array containing + * at least one element. An empty array indicates that the module will + * attempt to support any message type. This method never returns + * null. + */ + @Override + public Class[] getSupportedMessageTypes() { + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + logMsg("TSSendSuccessClientAuthModule.getSupportedMessageTypes called"); + return classarray; + } + + /** + * Secure a service request message before sending it to the service. + *

+ * This method is called to transform the request message acquired by calling + * getRequestMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to secure the request. If the + * Subject is not null, the method implementation may add additional + * Principals or credentials (pertaining to the source of the service + * request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully secured. The secured request message may be obtained + * by calling by getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * request message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response from the + * peer security system. This status value also indicates that the + * application message has not yet been secured. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange after having + * received the security-specific response elicited by sending the + * security message. + * + * When this status value is returned, the corresponding invocation of + * validateResponse must be able to obtain the original + * application request message. + * + *
  • AuthStatus.FAILURE to indicate that a failure occured while + * securing the request message, and that an appropriate failure + * response message is available by calling getResponseMessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureRequest(MessageInfo messageInfo, + Subject clientSubject) throws AuthException { + + String msg = "TSSendSuccessClientAuthModule.secureRequest called"; + logMsg(msg); + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Validate a received service response. + *

+ * This method is called to transform the mechanism specific response message + * acquired by calling getResponseMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the response message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into the next + * mechanism specific request message to be sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the recipient of the service response, + * or null. It may be used by the method implementation as the source + * of Principals or credentials to be used to validate the response. + * If the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. If the Subject is not null, the method implementation may + * add additional Principals or credentials (pertaining to the source + * of the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + *

    + *
  • AuthStatus.SUCCESS when the application response message was + * successfully validated. The validated message is available by + * calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that response validation + * is incomplete, and that a continuation request was returned as the + * request message within messageInfo. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by conducting at + * least one additional request/response exchange. + * + *
  • AuthStatus.FAILURE to indicate that validation of the response + * failed, and that a failure response message has been established in + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateResponse(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + String msg = "TSSendSuccessClientAuthModule.validateResponse called"; + logMsg(msg); + + return AuthStatus.SUCCESS; + } + + /** + * Remove implementation specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSSendSuccessClientAuthModule.cleanSubject called"); + + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessServerAuthModule.java new file mode 100644 index 0000000..1a867ee --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSSendSuccessServerAuthModule.java @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.util.Map; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSSendSuccessServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private static TSLogger logger = null; + + private static Map options = null; + + /** + * Creates a new instance of TSSendSuccessServerAuthModule + */ + public TSSendSuccessServerAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSSendSuccessServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + String msg = "TSSendSuccessServerAuthModule.validateRequest called"; + logMsg(msg); + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + String msg = "TSSendSuccessServerAuthModule.secureResponse called"; + logMsg(msg); + return AuthStatus.SEND_SUCCESS; + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSSendSuccessServerAuthModule.cleanSubject called"); + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSServerAuthModule.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSServerAuthModule.java new file mode 100644 index 0000000..105855f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/module/soap/TSServerAuthModule.java @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.module.soap; + +import java.security.Principal; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.util.CommonCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.ServerCallbackSupport; +import com.sun.ts.tests.jaspic.tssv.util.TSLogger; + +import jakarta.security.auth.message.AuthException; +import jakarta.security.auth.message.AuthStatus; +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.MessagePolicy; + +/** + * + * @author Raja Perumal + */ +public class TSServerAuthModule + implements jakarta.security.auth.message.module.ServerAuthModule { + private static TSLogger logger = null; + + private static CallbackHandler callbackHandler = null; + + private static Map options = null; + + /** + * Creates a new instance of TSServerAuthModule + */ + public TSServerAuthModule() { + } + + /** + * Initialize this module with request and response message policies to + * enforce, a CallbackHandler, and any module-specific configuration + * properties. + * + *

+ * The request policy and the response policy must not both be null. + * + * @param requestPolicy + * the request policy this module must enforce, or null. + * + * @param responsePolicy + * the response policy this module must enforce, or null. + * + * @param handler + * CallbackHandler used to request information. + * + * @param options + * a Map of module-specific configuration properties. + * + * @exception AuthException + * if module initialization fails, including for the case where + * the options argument contains elements that are not supported + * by the module. + */ + @Override + public void initialize(MessagePolicy reqPolicy, MessagePolicy resPolicy, + CallbackHandler handler, Map optns) throws AuthException { + callbackHandler = handler; + options = optns; + + // Get the reference to TSLogger from the Map "options" + if (options.get("TSLogger") != null) + logger = (TSLogger) options.get("TSLogger"); + + } + + /** + * Get the one or more Class objects representing the message types supported + * by the module. + * + * @return an array of Class objects, with at least one element defining a + * message type supported by the module. + */ + @Override + public Class[] getSupportedMessageTypes() { + logMsg("TSServerAuthModule.getSupportedMessageTypes called"); + Class[] classarray = { jakarta.xml.soap.SOAPMessage.class }; + return classarray; + } + + /** + * Authenticate a received service request. + * + * This method is called to transform the mechanism specific request message + * acquired by calling getRequestMessage (on messageInfo) into the validated + * application message to be returned to the message processing runtime. If + * the received message is a (mechanism specific) meta-message, the method + * implementation must attempt to transform the meta-message into a + * corresponding mechanism specific response message, or to the validated + * application request message. The runtime will bind a validated application + * message into the the corresponding service invocation. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param clientSubject + * a Subject that represents the source of the service request. It is + * used by the method implementation to store Principals and + * credentials validated in the request. + * + * @param serviceSubject + * a Subject that represents the recipient of the service request, or + * null. It may be used by the method implementation as the source of + * Principals or credentials to be used to validate the request. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the recipient + * of the service request) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SUCCESS when the application request message was + * successfully validated. The validated request message is available + * by calling getRequestMessage on messageInfo. + * + *
  • AuthStatus.SEND_SUCCESS to indicate that validation/processing + * of the request message successfully produced the secured + * application response message (in messageInfo). The secured response + * message is available by calling getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that message validation is + * incomplete, and that a preliminary response was returned as the + * response message in messageInfo. + * + * When this status value is returned to challenge an application + * request message, the challenged request must be saved by the + * authentication module such that it can be recovered when the + * module's validateRequest message is called to process the request + * returned for the challenge. + * + *
  • AuthStatus.SEND_FAILURE to indicate that message validation + * failed and that an appropriate failure response message is + * available by calling getResponseMessage on messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus validateRequest(MessageInfo messageInfo, + Subject clientSubject, Subject serviceSubject) throws AuthException { + + String msg = ""; + if (clientSubject != null) { + msg = "TSServerAuthModule.validateRequest called with client Subject :" + + getPrincipalNameFromSubject(clientSubject); + } else + msg = "TSClientAuthModule.validateRequest called with null client Subject"; + + if (serviceSubject != null) { + msg = msg + " with serviceSubject :" + + getPrincipalNameFromSubject(serviceSubject); + } else + msg = msg + " with null serviceSubject"; + + logMsg(msg); + logMessageTypes(messageInfo, "validateRequest"); + + // Check Callback Handler support for Server runtime + ServerCallbackSupport serverCallbackSupport = new ServerCallbackSupport( + logger, callbackHandler, "SOAP"); + + serverCallbackSupport.verify(); + + // Check common Callback support for SOAP server runtime + CommonCallbackSupport commonCallbacks = new CommonCallbackSupport(logger, + callbackHandler, "SOAP", "ServerRuntime"); + + commonCallbacks.verify(); + + return AuthStatus.SUCCESS; + } + + /** + * Secure a service response before sending it to the client. + * + * This method is called to transform the response message acquired by calling + * getResponseMessage (on messageInfo) into the mechanism specific form to be + * sent by the runtime. + *

+ * This method conveys the outcome of its message processing either by + * returning an AuthStatus value or by throwing an AuthException. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param serviceSubject + * a Subject that represents the source of the service response, or + * null. It may be used by the method implementation to retrieve + * Principals and credentials necessary to secure the response. If + * the Subject is not null, the method implementation may add + * additional Principals or credentials (pertaining to the source of + * the service response) to the Subject. + * + * @return an AuthStatus object representing the completion status of the + * processing performed by the method. The AuthStatus values that may + * be returned by this method are defined as follows: + * + *

    + *
  • AuthStatus.SEND_SUCCESS when the application response message + * was successfully secured. The secured response message may be + * obtained by calling by getResponseMessage on messageInfo. + * + *
  • AuthStatus.SEND_CONTINUE to indicate that the application + * response message (within messageInfo) was replaced with a security + * message that should elicit a security-specific response (in the + * form of a request) from the peer. + * + * This status value serves to inform the calling runtime that (in + * order to successfully complete the message exchange) it will need + * to be capable of continuing the message dialog by processing at + * least one additional request/response exchange (after having sent + * the response message returned in messageInfo). + * + * When this status value is returned, the application response must + * be saved by the authentication module such that it can be recovered + * when the module's validateRequest message is called to process the + * elicited response. + * + *
  • AuthStatus.SEND_FAILURE to indicate that a failure occured + * while securing the response message and that an appropriate failure + * response message is available by calling getResponseMeessage on + * messageInfo. + *
+ * + * @exception AuthException + * when the message processing failed without establishing a + * failure response message (in messageInfo). + */ + @Override + public AuthStatus secureResponse(MessageInfo messageInfo, + Subject serviceSubject) throws AuthException { + String msg = ""; + if (serviceSubject != null) { + msg = "TSServerAuthModule.secureResponse called with serviceSubject :" + + getPrincipalNameFromSubject(serviceSubject); + } else + msg = "TSServerAuthModule.secureResponse called with null service Subject"; + + logMsg(msg); + logMessageTypes(messageInfo, "secureResponse"); + + return AuthStatus.SEND_SUCCESS; + } + + /** + * Remove method specific principals and credentials from the subject. + * + * @param messageInfo + * a contextual object that encapsulates the client request and + * server response objects, and that may be used to save state across + * a sequence of calls made to the methods of this interface for the + * purpose of completing a secure message exchange. + * + * @param subject + * the Subject instance from which the Principals and credentials are + * to be removed. + * + * @exception AuthException + * if an error occurs during the Subject processing. + */ + + @Override + public void cleanSubject(MessageInfo messageInfo, Subject subject) + throws AuthException { + logMsg("TSServerAuthModule.cleanSubject called"); + // remove the contents of the subject and return an empty subject + subject = null; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public String getPrincipalNameFromSubject(Subject sub) { + Principal principal = null; + String concatPrincipalName = ""; + Set principalSet = sub.getPrincipals(); + + Iterator iterator = principalSet.iterator(); + while (iterator.hasNext()) { + principal = (Principal) iterator.next(); + concatPrincipalName += principal.getName(); + } + + return concatPrincipalName; + } + + private void logMessageTypes(MessageInfo messageInfo, String methodName) { + String msg = null; + + Object requestMessage = messageInfo.getRequestMessage(); + Object responseMessage = messageInfo.getResponseMessage(); + + if (requestMessage != null) { + if (requestMessage instanceof jakarta.xml.soap.SOAPMessage) { + msg = methodName + + " : MessageInfo.getRequestMessage() is of type jakarta.xml.soap.SOAPMessage"; + logMsg(msg); + } else { + msg = methodName + " : MessageInfo.getRequestMessage() is of type " + + requestMessage.getClass().getName(); + logMsg(msg); + + } + } + + if (responseMessage != null) { + if (responseMessage instanceof jakarta.xml.soap.SOAPMessage) { + msg = methodName + + " : MessageInfo.getResponseMessage() is of type jakarta.xml.soap.SOAPMessage"; + logMsg(msg); + } else { + msg = methodName + " : MessageInfo.getResponseMessage() is of type " + + responseMessage.getClass().getName(); + logMsg(msg); + + } + } + + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/AuthDataCallbackHandler.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/AuthDataCallbackHandler.java new file mode 100644 index 0000000..0e2c28d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/AuthDataCallbackHandler.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; + +/** + * + * @author Raja Perumal + */ +public class AuthDataCallbackHandler implements CallbackHandler { + + private String user; + + private String password; + + // Default constructor gets the user and password from the environment + // using system property j2eelogin.name and j2eelogin.password + public AuthDataCallbackHandler() { + user = System.getProperty("j2eelogin.name"); + password = System.getProperty("j2eelogin.password"); + } + + public AuthDataCallbackHandler(String usr, String pwd) { + user = usr; + password = pwd; + + } + + public void handle(Callback[] callbacks) { + for (Callback cb : callbacks) { + if (cb instanceof NameCallback) { + NameCallback nc = (NameCallback) cb; + nc.setName(user); + } else if (cb instanceof PasswordCallback) { + PasswordCallback pc = (PasswordCallback) cb; + if (password != null) { + pc.setPassword(password.toCharArray()); + } else { + pc.setPassword(null); + } + } + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ClientCallbackSupport.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ClientCallbackSupport.java new file mode 100644 index 0000000..6bebd15 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ClientCallbackSupport.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.IOException; +import java.util.logging.Level; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; + +/** + * + * @author Raja Perumal + */ +public class ClientCallbackSupport { + private static TSLogger logger = null; + + private static CallbackHandler callbackHandler = null; + + private static String profile = null; + + private static final String runtimeType = "ClientRuntime"; + + /** Creates a new instance of ClientCallbackSupport */ + public ClientCallbackSupport(TSLogger tsLogger, CallbackHandler cbkHandler, + String profile) { + logger = tsLogger; + callbackHandler = cbkHandler; + this.profile = profile; + } + + public boolean verify() { + try { + + NameCallbackSupport(); + PasswordCallbackSupport(); + return true; + + } catch (Exception e) { + return false; + } + } + + private void NameCallbackSupport() { + if (callbackHandler != null) { + try { + NameCallback nameCallback = new NameCallback("Please enter your name :", + "j2ee"); + nameCallback.setName("j2ee"); + + Callback[] callbacks = new Callback[] { nameCallback }; + + callbackHandler.handle(callbacks); + String returnedName = nameCallback.getName(); + + if (returnedName != null) { + logMsg("Name returned from Name Callback =" + returnedName); + } + logMsg("CallbackHandler supports NameCallback"); + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support NameCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support NameCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + + } + + } + + private void PasswordCallbackSupport() { + if (callbackHandler != null) { + try { + PasswordCallback passwordCallback = new PasswordCallback( + "Please enter your password :", false); + passwordCallback.setPassword(new char[] { 'j', '2', 'e', 'e' }); + + Callback[] callbacks = new Callback[] { passwordCallback }; + + callbackHandler.handle(callbacks); + char returnedPassword[] = passwordCallback.getPassword(); + + if (returnedPassword != null) { + logMsg("Password returned from Password Callback =" + + new String(returnedPassword)); + } + logMsg("CallbackHandler supports PasswordCallback"); + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support PasswordCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support PasswordCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + + } + + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, "In " + profile + " : " + runtimeType + " " + str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/CommonCallbackSupport.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/CommonCallbackSupport.java new file mode 100644 index 0000000..8b0a835 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/CommonCallbackSupport.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.cert.CertStore; +import java.util.logging.Level; + +import javax.crypto.SecretKey; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import jakarta.security.auth.message.callback.CertStoreCallback; +import jakarta.security.auth.message.callback.PrivateKeyCallback; +import jakarta.security.auth.message.callback.SecretKeyCallback; +import jakarta.security.auth.message.callback.TrustStoreCallback; + +/** + * + * @author Raja Perumal + */ +public class CommonCallbackSupport { + private static TSLogger logger = null; + + private static CallbackHandler callbackHandler = null; + + private static String profile = null; + + private static String runtimeType = null; + + public CommonCallbackSupport(TSLogger tsLogger, CallbackHandler cbkHandler, + String profile, String runtimeType) { + logger = tsLogger; + callbackHandler = cbkHandler; + this.profile = profile; + this.runtimeType = runtimeType; + } + + public boolean verify() { + try { + CertStoreCallbackSupport(); + PrivateKeyCallbackSupport(); + SecretKeyCallbackSupport(); + TrustStoreCallbackSupport(); + return true; + + } catch (Exception e) { + return false; + } + } + + private void CertStoreCallbackSupport() { + if (callbackHandler != null) { + try { + CertStoreCallback certStoreCallback = new CertStoreCallback(); + Callback[] callbacks = new Callback[] { certStoreCallback }; + + callbackHandler.handle(callbacks); + CertStore certStore = certStoreCallback.getCertStore(); + + if (certStore != null) { + logMsg("CertStore type =" + certStore.getType()); + } + logMsg("CallbackHandler supports CertStoreCallback"); + + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support CertStoreCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support CertStoreCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + + } + + } + + private void PrivateKeyCallbackSupport() { + if (callbackHandler != null) { + try { + + PrivateKeyCallback.AliasRequest aliasRequest = new PrivateKeyCallback.AliasRequest( + "s1as"); + + PrivateKeyCallback privateKeyCallback = new PrivateKeyCallback( + aliasRequest); + + Callback[] callbacks = new Callback[] { privateKeyCallback }; + + callbackHandler.handle(callbacks); + + PrivateKey privateKey = privateKeyCallback.getKey(); + + if (privateKey != null) { + logMsg("Private Key for s1as =" + privateKey.getAlgorithm()); + } + logMsg("CallbackHandler supports PrivateKeyCallback"); + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support PrivateKeyCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support PrivateKeyCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + + } + } + + private void SecretKeyCallbackSupport() { + if (callbackHandler != null) { + try { + + SecretKeyCallback.AliasRequest aliasRequest = new SecretKeyCallback.AliasRequest( + "s1as"); + + SecretKeyCallback secretKeyCallback = new SecretKeyCallback( + aliasRequest); + + Callback[] callbacks = new Callback[] { secretKeyCallback }; + + callbackHandler.handle(callbacks); + + SecretKey secretKey = secretKeyCallback.getKey(); + + if (secretKey != null) { + logMsg("Secret Key for s1as =" + secretKey.getAlgorithm()); + } + logMsg("CallbackHandler supports SecretKeyCallback"); + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support secretKeyCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support secretKeyCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + + } + + } + + private void TrustStoreCallbackSupport() { + if (callbackHandler != null) { + try { + TrustStoreCallback trustStoreCallback = new TrustStoreCallback(); + Callback[] callbacks = new Callback[] { trustStoreCallback }; + + callbackHandler.handle(callbacks); + KeyStore trustStore = trustStoreCallback.getTrustStore(); + + if (trustStore != null) { + logMsg("TrustStore type =" + trustStore.getType()); + } + logMsg("CallbackHandler supports TrustStoreCallback"); + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support TrustStoreCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support TrustStoreCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + } + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, "In " + profile + " : " + runtimeType + " " + str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/IdUtil.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/IdUtil.java new file mode 100644 index 0000000..0f8ea5f --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/IdUtil.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.util.Collection; +import java.util.Iterator; +import java.util.logging.Level; + +/** + * + * @author Raja Perumal + */ +public class IdUtil { + + private static ProviderConfigurationXMLFileProcessor configFileProcessor = null; + + private static TSLogger logger = null; + + public IdUtil() { + initializeTSLogger(); + } + + /* + * 1) Reads the provider configuration XML file, 2) Examines providers 3) If + * possible return a non-null ApplicationContextId for a given layer 4) If no + * suitable ApplicationContextId found it returns an empty string + */ + public static String getAppContextId(String msgLayer) { + String providerConfigFileLocation = System + .getProperty("provider.configuration.file"); + + try { + // Given the provider configuration xml file + // This reader parses the xml file and stores the configuration + // entries as a collection. + configFileProcessor = new ProviderConfigurationXMLFileProcessor( + providerConfigFileLocation); + + // Retrieve the ProviderConfigurationEntries collection + Collection providerConfigurationEntriesCollection = configFileProcessor + .getProviderConfigurationEntriesCollection(); + + ProviderConfigurationEntry pce = null; + String appContextId = null; + + Iterator iterator = providerConfigurationEntriesCollection + .iterator(); + while (iterator.hasNext()) { + // obtain each ProviderConfigurationEntry and register it + // with TSAuthConfigFactory + pce = (ProviderConfigurationEntry) iterator.next(); + + if (pce != null) { + appContextId = pce.getApplicationContextId(); + String pceMsgLayer = pce.getMessageLayer(); + + if (msgLayer.equalsIgnoreCase(pceMsgLayer) + && !appContextId.equalsIgnoreCase("null")) { + return appContextId; + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + if ((e.getMessage() != null) && (!e.getMessage().equals(""))) { + logger.log(Level.SEVERE, e.getMessage()); + } else { + logger.log(Level.SEVERE, "Error in getAppContextId()"); + } + } + + // if here, we must have had an app contextId that was null or + // unidentifyable msgLayer + return ""; + } + + private static void initializeTSLogger() { + String logFileLocation = null; + if (logger != null) { + return; + } else { + try { + logFileLocation = System.getProperty("log.file.location"); + System.out.println("logFileLocation = " + logFileLocation); + if (logFileLocation != null) { + logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); + boolean appendMode = true; + + // create a new file + TSFileHandler fileHandler = new TSFileHandler( + logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE, appendMode); + fileHandler.setFormatter(new TSXMLFormatter()); + logger.addHandler(fileHandler); + } else { + throw new RuntimeException("log.file.location not set"); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("TSLogger Initialization failed", e); + } + } + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/JASPICData.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/JASPICData.java new file mode 100644 index 0000000..72940ba --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/JASPICData.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +/** + * + * @author Sun Microsystems + */ +public class JASPICData { + + // these are the jsr-196 supported profile message-layers + public final static String LAYER_SERVLET = "HttpServlet"; + + public final static String LAYER_SOAP = "SOAP"; + + // this is a name that we will use to internally reference our logger + public final static String LOGGER_NAME = "jsr196"; + + // this log file is used on the appserver side by our cts tests + // to verify success/failures of our tests that involve a need to + // know that status of an exchange between a client and server. + public final static String DEFAULT_LOG_FILE = "TSSVLog.txt"; + + public final static String MOD_CLASS_NAME = "moduleClassKey"; + + public final static String SVC_SUBJECT_KEY = "com.sun.ts.tests.jaspic.serviceSubjectKey"; + + // define some statics for the cts AuthConfigFactory implementation and + // the RI's implementation of the AuthConfigFactory + public final static String TSSV_ACF = "com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory"; + + // definitions for Servlet Container Profile (SCP) + public final static String SCP_CONTEXT_PATH = "spitests_servlet_web"; + + public final static String AUTHSTAT_FAILURE_ND = "ModuleAuthStatusFailureNoDispatch"; + + public final static String AUTHSTAT_SENDFAILURE_ND = "ModuleAuthStatusSendFailureNoDispatch"; + + public final static String AUTHSTAT_SENDCONT_ND = "ModuleAuthStatusSendContinueNoDispatch"; + + public final static String AUTHSTAT_SENDSUCCESS_ND = "ModuleAuthStatusSendSuccessNoDispatch"; + + public final static String AUTHSTAT_SUCCESS_ND = "ModuleAuthStatusSuccessNoDispatch"; + + public final static String AUTHSTAT_THROW_EX_ND = "ModuleAuthStatusThrowExNoDispatch"; + + public final static String AUTHSTAT_OPT_SUCCESS = "AuthStatusOptionalSuccess"; + + public final static String AUTHSTAT_MAND_SUCCESS = "AuthStatusMandatorySuccess"; + + public final static String AUTHSTAT_FAILURE_D = "ModuleAuthStatusFailureDispatch"; + + public final static String AUTHSTAT_SENDFAILURE_D = "ModuleAuthStatusSendFailureDispatch"; + + public final static String AUTHSTAT_SENDCONT_D = "ModuleAuthStatusSendContinueDispatch"; + + public final static String AUTHSTAT_SENDSUCCESS_D = "ModuleAuthStatusSendSuccessDispatch"; + + public final static String AUTHSTAT_SUCCESS_D = "ModuleAuthStatusSuccessDispatch"; + + public final static String AUTHSTAT_THROW_EX_D = "ModuleAuthStatusThrowExDispatch"; + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationEntry.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationEntry.java new file mode 100644 index 0000000..f71dcca --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationEntry.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * + * @author Raja Perumal + */ +public class ProviderConfigurationEntry implements Serializable { + + private String providerClassName = null; + + private Map properties = null; + + private String messageLayer = null; + + private String applicationContextId = null; + + private String registrationDescription = null; + + /** Creates a new instance of ProviderConfigurationEntry */ + public ProviderConfigurationEntry(Node providerConfigEntryNode) + throws Exception { + Node childNode; + String nodeName; + + // make sure the nodename is provider-config-entry + if (!providerConfigEntryNode.getNodeName() + .equals("provider-config-entry")) { + throw new Exception( + "Unexpected tag :" + providerConfigEntryNode.getNodeName()); + } + NodeList nodes = providerConfigEntryNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + + childNode = nodes.item(i); + nodeName = childNode.getNodeName(); + + // Skip empty text node processing + if (nodeName.equals("#text")) + continue; + + if (nodeName.equals("provider-class")) { + providerClassName = getText(childNode); + + } else if (nodeName.equals("properties")) { + properties = loadProperties(childNode); + + } else if (nodeName.equals("message-layer")) { + messageLayer = getText(childNode); + + } else if (nodeName.equals("app-context-id")) { + applicationContextId = getText(childNode); + + } else if (nodeName.equals("reg-description")) { + registrationDescription = getText(childNode); + } + } + + } + + // This method loads a given Properties node such as the one shown below + // and stores the values into a properties object called "properties" + // + // true + // USER_NAME_PASSWORD + // + private static Map loadProperties(Node node) { + Node topLevelChildNode = null; + String topLevelNodeName; + String key = null; + String value = null; + NamedNodeMap namedNodeMap = null; + Properties nodeProperties = new Properties(); + + NodeList nodes = node.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + if (topLevelNodeName.equals("entry")) { + namedNodeMap = topLevelChildNode.getAttributes(); + Node tempKeyNode = namedNodeMap.getNamedItem("key"); + key = tempKeyNode.getNodeValue(); + value = topLevelChildNode.getFirstChild().getNodeValue(); + nodeProperties.put(key, value); + } + } + + HashMap map = new HashMap<>(); + nodeProperties.stringPropertyNames().forEach((tmpkey) -> map.put(tmpkey, nodeProperties.getProperty(tmpkey))); + return map; + } + + public String getProviderClassName() { + return providerClassName; + } + + public String getMessageLayer() { + return messageLayer; + } + + public String getApplicationContextId() { + return applicationContextId; + } + + public String getRegistrationDescription() { + return registrationDescription; + } + + public Map getProperties() { + return properties; + } + + public String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + if (result != null) + result = result.trim(); + + return result; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationXMLFileProcessor.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationXMLFileProcessor.java new file mode 100644 index 0000000..73c65fb --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ProviderConfigurationXMLFileProcessor.java @@ -0,0 +1,771 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * + * @author Raja Perumal + */ +public class ProviderConfigurationXMLFileProcessor { + + private static Collection providerConfigurationEntriesCollection = new Vector(); + + private static Document document = null; + + private static File providerConfigFile = null; + + /** Creates a new instance of ProviderConfigurationXMLFileReader */ + public ProviderConfigurationXMLFileProcessor(String fileName) + throws Exception { + + try { + providerConfigurationEntriesCollection.clear(); // XXXX: + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory + .newDocumentBuilder(); + + documentBuilder.setEntityResolver(new DTDResolver()); + + if (fileName != null) + providerConfigFile = new File(fileName); + + if (!providerConfigFile.exists()) { + throw new Exception( + "Provider Config File : " + fileName + " does not exists"); + } else { + + FileInputStream fis = new FileInputStream(providerConfigFile); + + // Parse of the content of the file into Document + document = documentBuilder.parse(fis); + + // get the root element "provider-config" + Element rootElement = document.getDocumentElement(); + + // get the childNodes inside the rootElement + // The ChildNodes are instances of "provider-config-entry" elements + NodeList nodes = rootElement.getChildNodes(); + + // For each "provider-config-entry" element load all the properties + // and add the ProviderConfigurationEntry into the collection + setProviderConfigEntryCollection(nodes); + } + + } catch (ParserConfigurationException pce) { + throw new Exception("PaserConfigurationException :" + pce.getMessage()); + } catch (SAXException se) { + throw new Exception("SAXException :" + se.getMessage()); + } catch (IOException ioe) { + throw new Exception("IOException :" + ioe.getMessage()); + + } catch (SecurityException se) { + throw new Exception("SecurityException :" + se.getMessage()); + } + } + + private void setProviderConfigEntryCollection(NodeList nodes) + throws Exception { + + Node providerConfigEntryNode; + NodeList providerConfigEntryNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first node + providerConfigEntryNode = nodes.item(i); + providerConfigEntryNodeChildren = providerConfigEntryNode.getChildNodes(); + + // Skip empty text node processing + if (providerConfigEntryNode.getNodeName().equals("#text")) + continue; + + ProviderConfigurationEntry pce = new ProviderConfigurationEntry( + providerConfigEntryNode); + providerConfigurationEntriesCollection.add(pce); + } + } + + public Collection getProviderConfigurationEntriesCollection() { + return providerConfigurationEntriesCollection; + } + + // This method creates a new provider-config-entry node and adds it to the + // root (provider-config) element. + // On successful insertion of provider-config-entry this method returns true + public static boolean addProviderConfigEntry(String className, Map props, + String messageLayer, String appContextId, String description) { + + boolean result = false; + + Node providerConfigEntry = createProviderConfigEntry(className, props, + messageLayer, appContextId, description); + + boolean alreadyExists = checkIfAlreadyPresent(providerConfigEntry); + + // If the currentNode doesn't exists in the configuration file then + // add the current node + if (!alreadyExists) { + + // get the root element "provider-config" + Element rootElement = document.getDocumentElement(); + try { + rootElement.appendChild(providerConfigEntry); + updateProviderConfigurationXMLFile(); + result = true; + } catch (DOMException dome) { + result = false; + } + } + + return result; + } + + // This method creates a new provider-config-entry node + // + public static Node createProviderConfigEntry(String className, Map props, + String messageLayer, String appContextId, String description) { + + Element providerConfigEntry = null; + + // get the root element "provider-config" + Element rootElement = document.getDocumentElement(); + + // create provider-config-entry + providerConfigEntry = (Element) document + .createElement("provider-config-entry"); + + if (className != null) { + // create provider-class + Element providerClassEntry = (Element) document + .createElement("provider-class"); + Text classNameText = document.createTextNode(className); + providerClassEntry.appendChild(classNameText); + + // Add provider-class to provider-config-entry + providerConfigEntry.appendChild(providerClassEntry); + } + + if (props != null) { + // create properties + Element propertiesNode = (Element) document.createElement("properties"); + + // Iterate through the map of properties(props) and add all the + // entries + Set entries = props.entrySet(); + Iterator iterator = entries.iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + Element entryNode = (Element) document.createElement("entry"); + entryNode.setAttribute("key", entry.getKey().toString()); + Text keyValueText = document + .createTextNode(entry.getValue().toString()); + entryNode.appendChild(keyValueText); + propertiesNode.appendChild(entryNode); + // System.out.println(entry.getKey() + " : " + // + entry.getValue()); + } + providerConfigEntry.appendChild(propertiesNode); + } + + if (messageLayer != null) { + // create message-layer + Element messageLayerEntry = (Element) document + .createElement("message-layer"); + Text messageLayerText = document.createTextNode(messageLayer); + messageLayerEntry.appendChild(messageLayerText); + + // Add message-layer to provider-config-entry + providerConfigEntry.appendChild(messageLayerEntry); + } + + if (appContextId != null) { + // create app-context-id + Element appContextIdEntry = (Element) document + .createElement("app-context-id"); + Text appContextIdText = document.createTextNode(appContextId); + appContextIdEntry.appendChild(appContextIdText); + + // Add app-context-id to provider-config-entry + providerConfigEntry.appendChild(appContextIdEntry); + } + + if (description != null) { + // create reg-description + Element regDescriptionEntry = (Element) document + .createElement("reg-description"); + Text regDescriptionText = document.createTextNode(description); + regDescriptionEntry.appendChild(regDescriptionText); + + // Add provider-class to provider-config-entry + providerConfigEntry.appendChild(regDescriptionEntry); + } + + return providerConfigEntry; + } + + // This method uses the given string (className, messageLayer, + // appContextId and description) and compares them with the contents of + // provider-config-entry nodes, if the given strings matches for a given node + // then that node will be deleted. This method return false if the given + // strings doesn't match with any of the provider-config-entry nodes. + public static boolean deleteProviderConfigEntry(String className, + String messageLayer, String appContextId, String description) { + + boolean result = false; + + Node providerConfigEntry = createProviderConfigEntry(className, null, + messageLayer, appContextId, description); + + boolean alreadyExists = checkIfAlreadyPresent(providerConfigEntry); + + // get the root element "provider-config" + Element rootElement = document.getDocumentElement(); + + if (alreadyExists) { + try { + rootElement.removeChild(providerConfigEntry); + updateProviderConfigurationXMLFile(); + result = true; + } catch (DOMException dome) { + result = false; + } + + } + + return result; + } + + // This method uses the given string (className, messageLayer, + // appContextId and description) and compares them with the contents of + // provider-config-entry nodes, if the all strings matches for a given node + // then this method returns the corresponding provider-config-entry node, + // if the given strings doesn't match with any of the provider-config-entry + // node then this method returns null + public static boolean checkIfAlreadyPresent(Node node) { + + Node topLevelChildNode = null; + String topLevelNodeName; + boolean result = false; + + // get the root element "provider-config" + Element rootElement = document.getDocumentElement(); + + NodeList nodes = rootElement.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + // Check whether the given node is same as the current + // provider-config-entry node + if (topLevelNodeName.equals("provider-config-entry")) { + topLevelChildNode.normalize(); + node.normalize(); + + // printNode(topLevelChildNode, i ); + // printNode(node, i); + + if (compareNode(topLevelChildNode, node)) { + return true; + } + } + } + + return result; + } + + private static boolean compareNode(Node source, Node target) { + + NodeList topLevelChildren; + Node childNode; + String nodeName; + + boolean classNameMatch = false; + boolean propertiesMatch = true; + boolean messageLayerMatch = false; + boolean appContextIdMatch = false; + boolean descriptionMatch = false; + + String className = null; + String messageLayer = null; + String appContextId = null; + Map properties = null; + String description = null; + + String targetClassName = null; + String targetMessageLayer = null; + String targetAppContextId = null; + String targetDescription = null; + + // get the root element "provider-config" + + // Process Source node and get className, messageLayer, + // properties, appContextId and description values + topLevelChildren = source.getChildNodes(); + for (int j = 0; j < topLevelChildren.getLength(); j++) { + + childNode = topLevelChildren.item(j); + nodeName = childNode.getNodeName(); + + // Skip empty text node processing + if (nodeName.equals("#text")) + continue; + + if (nodeName.equals("provider-class")) { + className = childNode.getFirstChild().getNodeValue().trim(); + + } + if (nodeName.equals("properties")) { + properties = getPropertiesMap(childNode); + + } else if (nodeName.equals("message-layer")) { + messageLayer = childNode.getFirstChild().getNodeValue().trim(); + + } else if (nodeName.equals("app-context-id")) { + appContextId = childNode.getFirstChild().getNodeValue().trim(); + + } else if (nodeName.equals("reg-description")) { + description = childNode.getFirstChild().getNodeValue().trim(); + } + } + + // Process target node and get className, messageLayer, + // properties, appContextId and description values + topLevelChildren = target.getChildNodes(); + for (int j = 0; j < topLevelChildren.getLength(); j++) { + + childNode = topLevelChildren.item(j); + nodeName = childNode.getNodeName(); + + // Skip empty text node processing + if (nodeName.equals("#text")) + continue; + + if (nodeName.equals("provider-class")) { + targetClassName = childNode.getFirstChild().getNodeValue().trim(); + + } + if (nodeName.equals("properties")) { + // targetProperties=getPropertiesMap(childNode); + // propertiesMatch = matchProperties(childNode, properties); + + } else if (nodeName.equals("message-layer")) { + targetMessageLayer = childNode.getFirstChild().getNodeValue().trim(); + + } else if (nodeName.equals("app-context-id")) { + targetAppContextId = childNode.getFirstChild().getNodeValue().trim(); + + } else if (nodeName.equals("reg-description")) { + targetDescription = childNode.getFirstChild().getNodeValue().trim(); + } + } + + if (stringCompare(className, targetClassName)) { + classNameMatch = true; + } + if (stringCompare(messageLayer, targetMessageLayer)) { + messageLayerMatch = true; + } + if (stringCompare(appContextId, targetAppContextId)) { + appContextIdMatch = true; + } + if (stringCompare(description, targetDescription)) { + descriptionMatch = true; + } + + if (classNameMatch && propertiesMatch && messageLayerMatch + && appContextIdMatch && descriptionMatch) { + // if both node values are same then return true; + return true; + } + + return false; + } + + private static boolean stringCompare(String source, String target) { + boolean result = false; + + if ((source == null) && (target == null)) { + result = true; + } else if ((source != null) && target != null) { + if (source.equals(target)) { + result = true; + } + } + return result; + } + + // This method reads a Properties node such as the one shown below + // and returns properties Map from its values + // + // + // true + // USER_NAME_PASSWORD + // + private static Map getPropertiesMap(Node node) { + Node topLevelChildNode = null; + String topLevelNodeName; + String key = null; + String value = null; + NamedNodeMap namedNodeMap = null; + Map nodeProperties = new Properties(); + + NodeList nodes = node.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + if (topLevelNodeName.equals("entry")) { + namedNodeMap = topLevelChildNode.getAttributes(); + Node tempKeyNode = namedNodeMap.getNamedItem("key"); + key = tempKeyNode.getNodeValue(); + value = topLevelChildNode.getFirstChild().getNodeValue(); + nodeProperties.put(key, value); + } + + } + + return nodeProperties; + } + + // This method reads a Properties node such as the one shown below + // and constructs a properties Map from its values and compares that map with + // the passed verifyProperties Map, if both are equal this + // method returns true else false + // + // + // true + // USER_NAME_PASSWORD + // + private static boolean matchProperties(Node node, Map verifyProperties) { + Node topLevelChildNode = null; + String topLevelNodeName; + String key = null; + String value = null; + NamedNodeMap namedNodeMap = null; + Map nodeProperties = new Properties(); + boolean result = false; + + NodeList nodes = node.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + if (topLevelNodeName.equals("entry")) { + namedNodeMap = topLevelChildNode.getAttributes(); + Node tempKeyNode = namedNodeMap.getNamedItem("key"); + key = tempKeyNode.getNodeValue(); + value = topLevelChildNode.getFirstChild().getNodeValue(); + nodeProperties.put(key, value); + } + + } + if (nodeProperties.equals(verifyProperties)) + result = true; + + return result; + } + + private static void updateProviderConfigurationXMLFile() { + + // Style Sheet to indent a given XML file + String styleSheet = "" + + " " + + " " + " " + + " " + " " + + " " + " " + ""; + + try { + + StreamSource styleSource = new StreamSource( + new ByteArrayInputStream(styleSheet.getBytes())); + + // Use a Transformer for output + TransformerFactory tFactory = TransformerFactory.newInstance(); + + // Apply transformation specified by the stylesheet to indent the + // generated XML file + Transformer transformer = tFactory.newTransformer(styleSource); + + // If indentation affects performance, then we can also use + // simple transformation as shown below + // Transformer transformer = tFactory.newFtransformer(); + + DOMSource source = new DOMSource(document); + + // Get the DOCTYPE + String systemValue = (new File(document.getDoctype().getSystemId())) + .getName(); + + // Delete the original ProviderConfiguration file + if (providerConfigFile.exists()) { + providerConfigFile.delete(); + providerConfigFile.createNewFile(); + } + + FileOutputStream fos = new FileOutputStream(providerConfigFile); + + // StreamResult result = new StreamResult(System.out); + StreamResult result = new StreamResult(fos); + + // Add Doctype to the output xml file + transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, systemValue); + + // Indent the XML file + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + + // set the output type as xml + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + + // Do identity transformation into the result stream + transformer.transform(source, result); + + fos.close(); + + } catch (TransformerConfigurationException tce) { + // Error generated by the parser + System.out.println("\n** Transformer Factory error"); + System.out.println(" " + tce.getMessage()); + + // Use the contained exception, if any + Throwable x = tce; + if (tce.getException() != null) + x = tce.getException(); + x.printStackTrace(); + + } catch (TransformerException te) { + // Error generated by the parser + System.out.println("\n** Transformation error"); + System.out.println(" " + te.getMessage()); + + // Use the contained exception, if any + Throwable x = te; + if (te.getException() != null) + x = te.getException(); + x.printStackTrace(); + + } catch (IOException ioe) { + // I/O error + ioe.printStackTrace(); + } + + } + + private static void printNodes(NodeList nodes) { + + Node topLevelChildNode; + String topLevelNodeName; + + int nodeCount = 1; + + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + printNode(topLevelChildNode, nodeCount++); + + } + } + + private static void printNode(Node node, int index) { + Node childNode; + String nodeName; + NodeList topLevelChildren; + + System.out.println(" "); + topLevelChildren = node.getChildNodes(); + + for (int j = 0; j < topLevelChildren.getLength(); j++) { + + childNode = topLevelChildren.item(j); + nodeName = childNode.getNodeName(); + + // Skip empty text node processing + if (nodeName.equals("#text")) + continue; + + if (nodeName.equals("provider-class")) { + System.out + .println(index + " ) " + "provider-class = " + getText(childNode)); + + } else if (nodeName.equals("properties")) { + printProperties(childNode); + + } else if (nodeName.equals("message-layer")) { + System.out + .println(index + " ) " + "message-layer = " + getText(childNode)); + + } else if (nodeName.equals("app-context-id")) { + System.out + .println(index + " ) " + "app-context-id = " + getText(childNode)); + + } else if (nodeName.equals("reg-description")) { + System.out + .println(index + " ) " + "reg-description = " + getText(childNode)); + } + } + System.out.println("-----------------"); + + } + + // This method prints a Properties node such as the one shown below + // + // + // true + // USER_NAME_PASSWORD + // + private static void printProperties(Node node) { + Node topLevelChildNode = null; + String topLevelNodeName; + String key = null; + String value = null; + NamedNodeMap namedNodeMap = null; + Properties nodeProperties = new Properties(); + + NodeList nodes = node.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + + topLevelChildNode = nodes.item(i); + topLevelNodeName = topLevelChildNode.getNodeName(); + + // Skip empty text node processing + if (topLevelNodeName.equals("#text")) + continue; + + if (topLevelNodeName.equals("entry")) { + namedNodeMap = topLevelChildNode.getAttributes(); + Node tempKeyNode = namedNodeMap.getNamedItem("key"); + key = tempKeyNode.getNodeValue(); + value = topLevelChildNode.getFirstChild().getNodeValue(); + nodeProperties.put(key, value); + } + } + + if ((nodeProperties != null) && (!nodeProperties.isEmpty())) { + nodeProperties.list(System.out); + } else { + System.out.println("No Properties to list"); + } + } + + private static String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + if (result != null) + result = result.trim(); + return result; + } + + public class DTDResolver implements EntityResolver { + public InputSource resolveEntity(String publicID, String systemId) + throws SAXException { + String providerConfigurationFile = null; + String providerConfigurationFileLocation = null; + int indexof = 0; + + // Obtain the full path for the location of ProviderConfiguration.xml file + // From this value identify the directory of this file using indexOf() + providerConfigurationFile = System + .getProperty("provider.configuration.file"); + if (providerConfigurationFile != null) { + + indexof = providerConfigurationFile + .indexOf("ProviderConfiguration.xml"); + if (indexof > 0) { + // Get the directory location of ProviderConfiguration.xml file + providerConfigurationFileLocation = providerConfigurationFile + .substring(0, indexof); + } + + if (systemId.contains("provider-configuration.xsd")) { + // location of schema is at /lib/schemas(from ts.jte) + String schemaLocation = System.getProperty("schema.file.location"); + return new InputSource( + schemaLocation + File.separator + "provider-configuration.xsd"); + } + } + // if there is no match + return null; + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ServerCallbackSupport.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ServerCallbackSupport.java new file mode 100644 index 0000000..02b5f3d --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/ServerCallbackSupport.java @@ -0,0 +1,552 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.IOException; +import java.security.Principal; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import com.sun.ts.lib.util.BASE64Decoder; + +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.callback.CallerPrincipalCallback; +import jakarta.security.auth.message.callback.GroupPrincipalCallback; +import jakarta.security.auth.message.callback.PasswordValidationCallback; +import jakarta.servlet.http.HttpServletRequest; + +/** + * + * @author Raja Perumal + */ +public class ServerCallbackSupport { + + private static TSLogger logger = null; + + private static CallbackHandler callbackHandler = null; + + private static String profile = null; + + private static final String runtimeType = "ServerRuntime"; + + private static MessageInfo messageInfo = null; + + private static Subject clientSubject = null; + + private static Subject serverSubject = null; + + // user corresponds to ts.jte user property (e.g. "j2ee") + private static String user = System.getProperty("j2eelogin.name"); + + // password corresponds to ts.jte password property (e.g. "j2ee") + private static String passwd = System.getProperty("j2eelogin.password"); + + /** Creates a new instance of ServerCallbackSupport */ + public ServerCallbackSupport(TSLogger tsLogger, CallbackHandler cbkHandler, + String profile) { + logger = tsLogger; + callbackHandler = cbkHandler; + this.profile = profile; + } + + public ServerCallbackSupport(TSLogger tsLogger, CallbackHandler cbkHandler, + String profile, MessageInfo msgInfo, Subject clientSubj, + Subject serverSubj) { + logger = tsLogger; + callbackHandler = cbkHandler; + this.profile = profile; + this.messageInfo = msgInfo; + this.clientSubject = clientSubj; + this.serverSubject = serverSubj; + } + + public boolean verify() { + try { + CallerPrincipalCallbackSupport(); + GroupPrincipalCallbackSupport(); + PasswordValidationCallbackSupport(); + return true; + } catch (Exception e) { + return false; + } + } + + public boolean verifyCPCCallback() { + boolean bval = CallerPrincipalCallbackSupport(); + logMsg("verifyCPCCallback returning " + Boolean.toString(bval)); + return bval; + } + + public boolean verifyGPCCallback() { + boolean bval = GroupPrincipalCallbackSupport(); + logMsg("verifyGPCCallback returning " + Boolean.toString(bval)); + return bval; + } + + public boolean verifyPVCCallback() { + boolean bval = PasswordValidationCallbackSupport(); + logMsg("verifyPVCCallback returning " + Boolean.toString(bval)); + return bval; + } + + private boolean CallerPrincipalCallbackSupport() { + boolean bval = false; + HttpServletRequest request = null; + + try { + request = (HttpServletRequest) messageInfo.getRequestMessage(); + } catch (Exception ex) { + } + + if (callbackHandler != null) { + try { + // note: we should be able to have a subject that has NO + // principals for the case of optional authen. Which means + // we should not have to explicitly set the principal here. + // however, for the case of mandatory authen, we will want + // to create a CPC using a username as opposed to a null principal. + + CallerPrincipalCallback callerPrincipalCallback = null; + if (profile.equals(JASPICData.LAYER_SERVLET)) { + Principal principal = null; + if (messageInfo != null) { + HttpServletRequest req = (HttpServletRequest) messageInfo + .getRequestMessage(); + String username = getServletUsername(req); + String principalName = getPrincipalNameFromSubject(clientSubject); + String nameToLog = null; + + // better to call cbh with a null principal when the policy is Not + // mandatory + // and with a legitimate principal when the policy is mandatory + // (unless testing send-failure or send-continue - which we are + // not!) + boolean bIsMandatory = isServletAuthMandatory(messageInfo); + if (bIsMandatory) { + logMsg( + "CallerPrincipalCallbackSupport() Authentication mandatory"); + if (username != null) { + logMsg( + "CallerPrincipalCallbackSupport() auth mandatory, username != null"); + callerPrincipalCallback = new CallerPrincipalCallback( + clientSubject, username); + nameToLog = username; + } else if (principalName != null) { + logMsg( + "CallerPrincipalCallbackSupport() auth mandatory, principalName != null"); + callerPrincipalCallback = new CallerPrincipalCallback( + clientSubject, principalName); + nameToLog = principalName; + } else { + logMsg( + "CallerPrincipalCallbackSupport() auth mandatory, username and principalName both == null"); + } + } else { + logMsg( + "CallerPrincipalCallbackSupport() Authentication NOT mandatory"); + callerPrincipalCallback = new CallerPrincipalCallback( + clientSubject, (Principal) null); + } + + // now for some simple invocations to ensure we can call the API's + // these lines serve no other purpose than to validate we can + // invoke the api's in order to satisfy the javadoc assertions of: + // JSR-196:JAVADOC:32, JSR-196:JAVADOC:33, JSR-196:JAVADOC:34 + String cpcbkName = callerPrincipalCallback.getName(); + Principal cpcbkPrin = callerPrincipalCallback.getPrincipal(); + Subject cpcbkSubj = callerPrincipalCallback.getSubject(); + + String msg = "CallerPrincipalCallback called for profile=" + + profile; + if (request != null) { + String servletPath = request.getContextPath() + + request.getServletPath(); + msg += " for servletPath=" + servletPath; + } else { + msg += " messageInfo contained null request"; + } + logMsg(msg); + + // this helps test JASPIC:SPEC:103 + if (clientSubject == null) { + msg += " subject=null"; + } else { + msg += " subject=non-null"; + } + msg += " principal set = " + nameToLog; + logMsg(msg); + + } else { + // uses a null principal + callerPrincipalCallback = new CallerPrincipalCallback(clientSubject, + principal); + } + } else { + // should not get into here. + logMsg( + "WARNING: ServerCallbackSupport.CallerPrincipalCallbackSupport() - profile != servlet."); + Subject subject = new Subject(); + callerPrincipalCallback = new CallerPrincipalCallback(subject, + (Principal) null); + } + + Callback[] callbacks = new Callback[] { callerPrincipalCallback }; + + callbackHandler.handle(callbacks); + + logMsg("CallbackHandler supports CallerPrincipalCallback"); + bval = true; // if here assume successful authen + + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support CallerPrincipalCallback :" + + usce.getMessage()); + usce.printStackTrace(); + + } catch (Exception ex) { + // failed CPC authentication for unknown reason + String servletPath = ""; + if (request != null) { + servletPath = request.getContextPath() + request.getServletPath(); + } else { + servletPath = "WARNING: can't determine servletpath"; + } + logMsg("CPC Exception failure for servletPath=" + servletPath); + ex.printStackTrace(); + } + + } else { + String msg = "CallerPrincipalCallback has a null callbackHandler"; + msg += " profile=" + profile; + if (profile.equals(JASPICData.LAYER_SERVLET) && (messageInfo != null)) { + // HttpServletRequest request = + // (HttpServletRequest)messageInfo.getRequestMessage(); + if (request != null) { + String servletPath = request.getContextPath() + + request.getServletPath(); + msg += " for servletPath=" + servletPath; + } else { + msg += " messageInfo contained null request"; + } + logMsg(msg); + + if (clientSubject == null) { + msg += " subject=null"; + } else { + msg += " subject=non-null"; + } + String principalConcatString = getPrincipalNameFromSubject( + clientSubject); + msg += " principal set = " + principalConcatString; + + } + logMsg(msg); + } + + return bval; + } + + /* + * This is a convenience method. It is used to help pull out the username from + * the request. This method will only pull out a username if there was a + * client side servlet request made where Basic auth was used. This will only + * succeed if: 1. We have a ServletRequest that was populated correctly 2. The + * client side used BASE64Encoder() to encode user/pwd info 3. The user/pwd + * info were encoded in a format similar to the the following: String authData + * = username+":"+password BASE64Encode.encode(authData.getBytes()) + * + * This returns just the decoded username. + * + */ + private String getServletUsername(HttpServletRequest req) { + String username = null; + String authorization = req.getHeader("authorization"); + BASE64Decoder decoder = new BASE64Decoder(); + + if ((authorization != null) && (authorization.startsWith("Basic "))) { + try { + String authStr = authorization.substring(6).trim(); + String value = new String(decoder.decodeBuffer(authStr)); + logMsg("decoded (request) authorization string of: " + value); + + // at this point value should be in the form of : + if (value != null) { + username = value.substring(0, value.indexOf(":")); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + return username; + } + + /* + * Convenience method to get our context info. (This currently only works for + * servlet profile since thats all we need it for at this point.) + * + */ + private String getServletContext(MessageInfo mInfo, String profile) { + String sContext = ""; + if (profile.equals(JASPICData.LAYER_SERVLET) && (mInfo != null)) { + HttpServletRequest req = (HttpServletRequest) mInfo.getRequestMessage(); + if (req != null) { + sContext = req.getContextPath() + req.getServletPath(); + } + } + + logger.log(Level.INFO, "getServletContext() returning " + sContext); + + return sContext; + } + + /* + * This is a convenience method that is used to determine if Authentication is + * mandatory. Based on the answer, there are certain requirements that will + * need to be met wrt setting of principals. + */ + private boolean isServletAuthMandatory(MessageInfo msgInfo) { + boolean bval = false; + Map map = msgInfo.getMap(); + + // lets pull out some context info that we can use to help uniquely + // identify the source of this request + HttpServletRequest request = (HttpServletRequest) msgInfo + .getRequestMessage(); + + String servletName = request.getServletPath(); + + // see assertion JASPI:SPEC:306 for details on this + // jsr-196 states the following key must exist for servlet profile + String strKey = "jakarta.security.auth.message.MessagePolicy.isMandatory"; + String msg; + if (map != null) { + String keyVal = (String) map.get(strKey); + msg = "isServletAuthMandatory() called with attrs: "; + msg += " layer=" + JASPICData.LAYER_SERVLET; + msg += " servletName=" + servletName; + msg += " key=" + strKey; + + if (keyVal == null) { + msg += " value=NULL"; + bval = false; // assume false if we cant determine + } else if (Boolean.valueOf(keyVal).booleanValue() == true) { + msg += " value=Valid"; + bval = true; + } else { + // assume false + msg += " value=false"; + bval = false; + } + logger.log(Level.FINE, msg); + } else { + msg = "FAILURE: No map in MessageInfo thus no key=" + strKey; + logger.log(Level.SEVERE, msg); + } + + return bval; + } + + public String getPrincipalNameFromSubject(Subject sub) { + Principal principal = null; + + if (sub == null) { + return (String) null; + } + + String concatPrincipalName = ""; + Set principalSet = sub.getPrincipals(); + + Iterator iterator = principalSet.iterator(); + while (iterator.hasNext()) { + principal = (Principal) iterator.next(); + concatPrincipalName += principal.getName(); + } + + return concatPrincipalName; + } + + private boolean GroupPrincipalCallbackSupport() { + boolean bval = false; + ; + boolean isAuthMandatory = false; + String strServletContext = ""; + String principalName = ""; + + if (callbackHandler != null) { + try { + // note: we should be able to have a subject that has NO + // principals for the case of optional authen. Which means + // we should not have to explicitly set the principal here. + // however, for the case of mandatory authen, we will want + // to create a CPC using a username as opposed to a null principal. + + Subject subject = new Subject(); + String strArray[] = { "Administrator" }; + GroupPrincipalCallback groupPrincipalCallback = new GroupPrincipalCallback( + subject, strArray); + + CallerPrincipalCallback callerPrincipalCallback = null; + if (profile.equals(JASPICData.LAYER_SERVLET)) { + if (messageInfo != null) { + HttpServletRequest req = (HttpServletRequest) messageInfo + .getRequestMessage(); + String username = getServletUsername(req); + principalName = getPrincipalNameFromSubject(clientSubject); + strServletContext = req.getServletPath(); + + // better to call cbh with a null principal when the policy is Not + // mandatory + // and with a legitimate principal when the policy is mandatory + // (unless testing send-failure or send-continue - which we are + // not!) + boolean bIsMandatory = isServletAuthMandatory(messageInfo); + if (bIsMandatory) { + isAuthMandatory = true; + debug("GroupPrincipalCallbackSupport() Authentication mandatory"); + if (username != null) { + debug( + "GroupPrincipalCallbackSupport() auth mandatory, username != null"); + callerPrincipalCallback = new CallerPrincipalCallback( + clientSubject, username); + } else if (principalName != null) { + debug( + "GroupPrincipalCallbackSupport() auth mandatory, principalName != null"); + callerPrincipalCallback = new CallerPrincipalCallback( + clientSubject, principalName); + } else { + logMsg( + "GroupPrincipalCallbackSupport() auth mandatory, username and principalName both == null"); + } + } else { + debug( + "GroupPrincipalCallbackSupport() Authentication NOT mandatory"); + callerPrincipalCallback = new CallerPrincipalCallback(subject, + (Principal) null); + } + } else { + // uses a null principal + debug( + "GroupPrincipalCallbackSupport(): messageInfo == null, using null principal"); + callerPrincipalCallback = new CallerPrincipalCallback(clientSubject, + (Principal) null); + } + } else { + // if here, we were erroneously called by non-servlet profile + debug( + "WARNING: ServerCallbackSupport.CallerPrincipalCallbackSupport() - profile != servlet."); + callerPrincipalCallback = new CallerPrincipalCallback(subject, + (Principal) null); + } + + Callback[] callbacks = new Callback[] { groupPrincipalCallback, + callerPrincipalCallback }; + callbackHandler.handle(callbacks); + + // this string will be searched for on client side + String theMessage = "GroupPrincipalCallbackSupport():"; + theMessage += " successfully called callbackHandler.handle(callbacks)"; + theMessage += " for servlet: " + strServletContext; + theMessage += " with isServletAuthMandatory = " + isAuthMandatory; + logMsg(theMessage); + + logMsg("CallbackHandler supports GroupPrincipalCallback"); + + bval = true; // if here assume successful authen + + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support GroupPrincipalCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support GroupPrincipalCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + } + + return bval; + } + + private boolean PasswordValidationCallbackSupport() { + boolean bval = false; + + if (callbackHandler != null) { + try { + Subject subject = new Subject(); + String username = user; // e.g. "j2ee"; + char[] password = passwd.toCharArray(); // e.g. {'j','2','e','e'}; + + PasswordValidationCallback passwordValidationCallback = new PasswordValidationCallback( + subject, username, password); + + CallerPrincipalCallback cpc = new CallerPrincipalCallback(subject, + (Principal) null); + + Callback[] callbacks = new Callback[] { passwordValidationCallback, + cpc }; + + callbackHandler.handle(callbacks); + Subject returnedSubject = passwordValidationCallback.getSubject(); + boolean result = passwordValidationCallback.getResult(); + String userName = passwordValidationCallback.getUsername(); + char[] returnedPassword = passwordValidationCallback.getPassword(); + passwordValidationCallback.clearPassword(); + + // logMsg("PasswordValidation callback returned subject + // ="+returnedSubject); + // logMsg("PasswordValidation callback returned password + // ="+returnedPassword); + logMsg("PasswordValidation callback returned result =" + result); + logMsg("CallbackHandler supports PasswordValidationCallback"); + + bval = result; + + } catch (UnsupportedCallbackException usce) { + logMsg("CallbackHandler failed to support PasswordValidationCallback :" + + usce.getMessage()); + usce.printStackTrace(); + } catch (IOException ioe) { + logMsg("CallbackHandler failed to support PasswordValidationCallback :" + + ioe.getMessage()); + ioe.printStackTrace(); + } + } + + return bval; + } + + public void logMsg(String str) { + if (logger != null) { + logger.log(Level.INFO, "In " + profile + " : " + runtimeType + " " + str); + } else { + System.out.println("*** TSLogger Not Initialized properly ***"); + System.out.println("*** TSSVLogMessage : ***" + str); + } + } + + public void debug(String str) { + System.out.println(str); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimplePrincipal.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimplePrincipal.java new file mode 100644 index 0000000..8cbd060 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimplePrincipal.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.security.Principal; + +/** + * + * @author Raja Perumal + */ +public class SimplePrincipal implements Principal, java.io.Serializable { + private String name; // username + + private String password; // password + + public SimplePrincipal(String val, String pwd) { + name = val; + password = pwd; + } + + // required to satisfy Principal interface + public boolean equals(Object another) { + if ((another != null) && (another instanceof SimplePrincipal) + && (((SimplePrincipal) another).getName().equals(name))) { + return true; + } else { + return false; + } + } + + // required to satisfy Principal interface + public String getName() { + return name; + } + + // required to satisfy Principal interface + public String toString() { + return name; + } + + // required to satisfy Principal interface + public int hashCode() { + return name.hashCode(); + } + + // XXXX: may want to change this later if tests call for it + // this is normally bad but for now we dont care + public String getPassword() { + return password; + } +} // end of class SimulateRuntime diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimulateRuntime.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimulateRuntime.java new file mode 100644 index 0000000..8203271 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/SimulateRuntime.java @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.security.Principal; +import java.util.HashMap; +import java.util.Map; + +import javax.security.auth.Subject; +import javax.security.auth.callback.CallbackHandler; + +import com.sun.ts.tests.jaspic.tssv.config.TSRegistrationListener; + +import jakarta.security.auth.message.MessageInfo; +import jakarta.security.auth.message.config.AuthConfigFactory; +import jakarta.security.auth.message.config.AuthConfigProvider; +import jakarta.security.auth.message.config.ClientAuthConfig; +import jakarta.security.auth.message.config.ClientAuthContext; +import jakarta.security.auth.message.config.RegistrationListener; +import jakarta.security.auth.message.config.ServerAuthConfig; +import jakarta.security.auth.message.config.ServerAuthContext; + +/** + * + * @author Raja Perumal + */ +public class SimulateRuntime { + + /** + * SimulateRuntime to load TestSuite JSR 196 AuthConfigFactory + */ + public static void main(String[] args) { + + Map properties = new HashMap(); + String logFileLocation = args[0]; + String providerConfigurationFileLocation = args[1]; + + try { + + // Set jvm option for system variable log.file.location + // Note: This is typically set in server runtime using jvm options. + System.setProperty("log.file.location", logFileLocation); + + // Set jvm option for provider.configuration.file + // Note: This is typically set in server runtime using jvm options. + System.setProperty("provider.configuration.file", + providerConfigurationFileLocation); + + // 1) Set TestSuite's AuthConfigFactory class (TSAuthConfigFactory) + // in JAVA_HOME/jre/lib/security/java.security + // authconfigprovider.factory=com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory + // + // 2) Alternate way to set TestSuite's AuhtConfigFactory in the runtime is + // AuthConfigFactory acf = new + // com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigFactory(); + // AuthConfigFactory.setFactory(acf); + // + // In this RuntimeSimulation we use the first method i.e using + // java.security file + AuthConfigFactory acf = AuthConfigFactory.getFactory(); + + // create a Registration listener + RegistrationListener rlis = new TSRegistrationListener(); + + CallbackHandler cbh = (CallbackHandler) new AuthDataCallbackHandler(); + + // Get AuthConfigProvider + AuthConfigProvider acp = acf.getConfigProvider(JASPICData.LAYER_SOAP, + "JSR196Context", rlis); + + // Get AuthConfigProvider + AuthConfigProvider acp2 = acf.getConfigProvider(JASPICData.LAYER_SOAP, + "JSR196Context-2", rlis); + + // Get ServerAuthConfig + ServerAuthConfig serverAuthConfig = acp2 + .getServerAuthConfig(JASPICData.LAYER_SOAP, "JSR196Context", cbh); + + // Get ServerAuthContext + MessageInfo msgInfo = getSOAPMessageInfo(); + Subject defaultSubject = getDefaultSubject(); + String operation = serverAuthConfig.getAuthContextID(msgInfo); + ServerAuthContext serverAuthContext = serverAuthConfig + .getAuthContext(operation, defaultSubject, properties); + + // Call validateRequest + serverAuthContext.validateRequest(msgInfo, defaultSubject, + defaultSubject); + + // Call SecureResponse + serverAuthContext.secureResponse(msgInfo, defaultSubject); + + // Get ClientAuthConfig + ClientAuthConfig clientAuthConfig = acp2 + .getClientAuthConfig(JASPICData.LAYER_SOAP, "JSR196Context", cbh); + + // Get ClientAuthContext + operation = clientAuthConfig.getAuthContextID(msgInfo); + ClientAuthContext clientAuthContext = clientAuthConfig + .getAuthContext(operation, defaultSubject, properties); + + // Call secureRequest + clientAuthContext.secureRequest(msgInfo, defaultSubject); + + // Call validateResponse + clientAuthContext.validateResponse(msgInfo, defaultSubject, + defaultSubject); + + // Get AuthConfigProviderServlet + AuthConfigProvider servletACP; + servletACP = acf.getConfigProvider(JASPICData.LAYER_SERVLET, + "/spitests_servlet_web/ModTestServlet", rlis); + + if (servletACP == null) { + String err = "SimulateRuntime: servletACP == null!"; + System.out.println(err); + throw new Exception(err); + } + + ServerAuthConfig sac; + ServerAuthContext saContext; + sac = servletACP.getServerAuthConfig(JASPICData.LAYER_SERVLET, + "/spitests_servlet_web/ModTestServlet", cbh); + operation = getServletProfileOperation(); + Subject subj = getDefaultSubject(); + if (sac == null) { + System.out.println("SimulateRuntime: sac == null!"); + } else { + saContext = sac.getAuthContext(operation, subj, properties); + } + + // Get AuthConfigProviderServlet + AuthConfigProvider servletACP2; + servletACP2 = acf.getConfigProvider(JASPICData.LAYER_SERVLET, + "/spitests_servlet_web/SecondaryTestServlet", rlis); + + } catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Simulation Over, Created Log file :" + logFileLocation + + "/" + JASPICData.DEFAULT_LOG_FILE); + } + + /* + * Acceptable Servlet profile operationID should resemble a String in the + * format of: request.getServletPath() + request.getPathInfo() + "%20" + + * request.getMethod() + * + */ + public static String getServletProfileOperation() { + String servletPath = "/ModTestServlet"; + String method = "POST"; // GET, POST, or PUT + return servletPath + "%20 " + method; + } + + public static Subject getDefaultSubject() { + Subject subject = new Subject(); + String username = "j2ee"; // XXXX: fix hardcode? + String password = "j2ee"; // XXXX: fix hardcode? + Principal principal = new SimplePrincipal(username, password); + + // add a Principal and credential to the Subject + subject.getPrincipals().add(principal); + return subject; + } + + private static MessageInfo getSOAPMessageInfo() { + Map map = new HashMap(); + map.put("jakarta.xml.ws.wsdl.service", "http://hostname.port/someuri"); + + // Create a dummy MessageInfo object with some dummy uri + return new TSSOAPMessageInfo(map); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSFileHandler.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSFileHandler.java new file mode 100644 index 0000000..69b59e6 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSFileHandler.java @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.LogRecord; +import java.util.logging.StreamHandler; + +/** + * Simple file Handler based on java.util.logging.FileHandler + * + */ + +public class TSFileHandler extends StreamHandler { + private MeteredStream meter; + + private boolean append; + + private int limit; + + private int count; + + private String pattern; + + private File files[]; + + // A metered stream is a subclass of OutputStream that + // (a) forwards all its output to a target stream + // (b) keeps track of how many bytes have been written + private class MeteredStream extends OutputStream { + OutputStream out; + + int written; + + MeteredStream(OutputStream out, int written) { + this.out = out; + this.written = written; + } + + public void write(int b) throws IOException { + out.write(b); + written++; + } + + public void write(byte buff[]) throws IOException { + out.write(buff); + written += buff.length; + } + + public void write(byte buff[], int off, int len) throws IOException { + out.write(buff, off, len); + written += len; + } + + public void flush() throws IOException { + out.flush(); + } + + public void close() throws IOException { + out.close(); + } + } + + private void open(File fname, boolean append) throws IOException { + int len = 0; + if (append) { + len = (int) fname.length(); + } + FileOutputStream fout = new FileOutputStream(fname.toString(), append); + BufferedOutputStream bout = new BufferedOutputStream(fout); + meter = new MeteredStream(bout, len); + setOutputStream(meter); + } + + // Private method to configure a FileHandler from LogManager + // properties and/or default values as specified in the class + // javadoc. + private void configure() { + LogManager manager = LogManager.getLogManager(); + + String cname = getClass().getName(); + + pattern = ""; + limit = 0; + count = 1; + append = true; + setLevel(Level.ALL); + setFilter(null); + } + + /** + * Initialize a FileHandler to write to the given filename, with + * optional append. + *

+ * The FileHandler is configured based on LogManager + * properties (or their default values) except that the given pattern argument + * is used as the filename pattern, the file limit is set to no limit, the + * file count is set to one, and the append mode is set to the given + * append argument. + *

+ * There is no limit on the amount of data that may be written, so use this + * with care. + * + * @param pattern + * the name of the output file + * @param append + * specifies append mode + * @exception IOException + * if there are IO problems opening the files. + * @exception SecurityException + * if a security manager exists and if the caller does not have + * LoggingPermission("control"). + * @exception IllegalArgumentException + * if pattern is an empty string + */ + public TSFileHandler(String pattern, boolean append) + throws IOException, SecurityException { + if (pattern.length() < 1) { + throw new IllegalArgumentException(); + } + configure(); + this.pattern = pattern; + this.limit = 0; + this.count = 1; + this.append = append; + openFiles(); + } + + // Private method to open the set of output files, based on the + // configured instance variables. + // + // Note: We don't lock files or rotate files based on size limit. + private void openFiles() throws IOException { + LogManager manager = LogManager.getLogManager(); + manager.checkAccess(); + if (count < 1) { + throw new IllegalArgumentException("file count = " + count); + } + if (limit < 0) { + limit = 0; + } + + int unique = 0; + + files = new File[count]; + for (int i = 0; i < count; i++) { + files[i] = generate(pattern, i, unique); + } + + open(files[0], true); + + } + + // Generate a filename from a pattern. + private File generate(String pattern, int generation, int unique) + throws IOException { + File file = null; + String word = ""; + int ix = 0; + boolean sawg = false; + boolean sawu = false; + while (ix < pattern.length()) { + char ch = pattern.charAt(ix); + ix++; + char ch2 = 0; + if (ix < pattern.length()) { + ch2 = Character.toLowerCase(pattern.charAt(ix)); + } + if (ch == '/') { + if (file == null) { + file = new File(word); + } else { + file = new File(file, word); + } + word = ""; + continue; + } else if (ch == '%') { + if (ch2 == 't') { + String tmpDir = System.getProperty("java.io.tmpdir"); + if (tmpDir == null) { + tmpDir = System.getProperty("user.home"); + } + file = new File(tmpDir); + ix++; + word = ""; + continue; + } else if (ch2 == 'h') { + file = new File(System.getProperty("user.home")); + if (isSetUID()) { + // Ok, we are in a set UID program. For safety's sake + // we disallow attempts to open files relative to %h. + throw new IOException("can't use %h in set UID program"); + } + ix++; + word = ""; + continue; + } else if (ch2 == 'g') { + word = word + generation; + sawg = true; + ix++; + continue; + } else if (ch2 == 'u') { + word = word + unique; + sawu = true; + ix++; + continue; + } else if (ch2 == '%') { + word = word + "%"; + ix++; + continue; + } + } + word = word + ch; + } + if (count > 1 && !sawg) { + word = word + "." + generation; + } + if (unique > 0 && !sawu) { + word = word + "." + unique; + } + if (word.length() > 0) { + if (file == null) { + file = new File(word); + } else { + file = new File(file, word); + } + } + return file; + } + + /** + * Format and publish a LogRecord. + * + * @param record + * description of the log event. A null record is silently ignored + * and is not published + */ + public synchronized void publish(LogRecord record) { + if (!isLoggable(record)) { + return; + } + super.publish(record); + super.flush(); + flush(); + } + + /** + * Close all the files. + * + * @exception SecurityException + * if a security manager exists and if the caller does not have + * LoggingPermission("control"). + */ + public synchronized void close() throws SecurityException { + super.close(); + } + + // Private native method to check if we are in a set UID program. + private static native boolean isSetUID(); + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSLogger.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSLogger.java new file mode 100644 index 0000000..af4456a --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSLogger.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.util.logging.Filter; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +/** + * + * @author Raja Perumal + */ +public class TSLogger extends Logger { + + private static TSLogger tsLogger = null; + + private int levelValue = Level.INFO.intValue(); + + private int offValue = Level.OFF.intValue(); + + private String name = null; + + private Filter filter; + + /** Creates a new instance of TSLogger */ + protected TSLogger(String name) { + super(name, null); + this.name = name; + levelValue = Level.INFO.intValue(); + } + + /** + * Find or create a logger for a named subsystem. If a logger has already been + * created with the given name it is returned. Otherwise a new logger is + * created. + *

+ * If a new logger is created its log level will be configured based on the + * LogManager configuration and it will configured to also send logging output + * to its parent's handlers. It will be registered in the LogManager global + * namespace. + * + * @param name + * A name for the logger. This should be a dot-separated name and + * should normally be based on the package name or class name of the + * subsystem, such as java.net or javax.swing + * @return a suitable Logger + */ + public static synchronized TSLogger getTSLogger(String name) { + TSLogger result = null; + + LogManager manager = LogManager.getLogManager(); + + if (tsLogger != null) { + if (tsLogger.getName().equals(name)) + result = tsLogger; + } else { + result = new TSLogger(name); + manager.addLogger(result); + } + + return result; + } + + /** + * Logs a LogRecord. + * + * @param record + * the LogRecord to be published + */ + public synchronized void log(LogRecord record) { + if (record.getLevel().intValue() < levelValue || levelValue == offValue) { + return; + } + synchronized (this) { + if (filter != null && !filter.isLoggable(record)) { + return; + } + } + + TSLogger logger = this; + while (logger != null) { + Handler targets[] = logger.getHandlers(); + + if (targets != null) { + for (int i = 0; i < targets.length; i++) { + + // Publish record only if the + // handler is of type TSFileHandler + // Do not publish to all parent handlers. + if (targets[i] instanceof TSFileHandler) + targets[i].publish(record); + } + } + + if (!logger.getUseParentHandlers()) { + break; + } + + logger = null; + } + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSSOAPMessageInfo.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSSOAPMessageInfo.java new file mode 100644 index 0000000..b9f6f4c --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSSOAPMessageInfo.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.util.Map; + +import jakarta.security.auth.message.MessageInfo; + +/** + * + * @author Raja Perumal + */ +public class TSSOAPMessageInfo implements MessageInfo { + private Map map = null; + + private Object request = null; + + private Object response = null; + + /** Creates a new instance of TSMessageInfo */ + public TSSOAPMessageInfo() { + + } + + public TSSOAPMessageInfo(Map localMap) { + map = localMap; + } + + public Map getMap() { + return map; + } + + public void setResponseMessage(Object res) { + response = res; + } + + public void setRequestMessage(Object req) { + request = req; + } + + public Object getRequestMessage() { + return request; + } + + public Object getResponseMessage() { + return response; + } +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSXMLFormatter.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSXMLFormatter.java new file mode 100644 index 0000000..79dce98 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/TSXMLFormatter.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.tssv.util; + +import java.io.File; +import java.util.logging.Handler; +import java.util.logging.XMLFormatter; + +/** + * + * @author Raja Perumal + */ +public class TSXMLFormatter extends XMLFormatter { + + /** Creates a new instance of TSXMLFormatter */ + public TSXMLFormatter() { + super(); + } + + /** + * Override getHead method of XMLFormatter. This is done to avoid specifying + * external entity such as "logger.dtd" in the generated log file. + * + * Occurance of " causes runtime + * performance hit due to dtd validation at runtime. + * + * @param h + * The target handler. + * @return header string + */ + public String getHead(Handler h) { + String logFileLocation = System.getProperty("log.file.location"); + + // Check if the log file already exists + File file = new File(logFileLocation + "/" + JASPICData.DEFAULT_LOG_FILE); + if (file.exists()) { + // if the log file exists and the file length is more than 1 byte + // then don't return any header otherwise return header info. + if (file.length() > 1) { + // Don't write any header info + return ""; + } + } + + StringBuffer sb = new StringBuffer(); + sb.append("\n"); + // sb.append("\n"); + sb.append("\n"); + return sb.toString(); + } + + /** + * Return the tail string for a set of XML formatted records. + * + * This method will be called only during the end of logger lifecycle. + * LogProcessor already has the built in logic to handle non well-formed XML + * (i.e missing element) + * + * @param h + * The target handler (can be null) + * @return a valid XML string + */ + public String getTail(Handler h) { + // return "\n"; + return ""; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/build.xml new file mode 100644 index 0000000..928f289 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/tssv/util/build.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/FetchLogs.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/FetchLogs.java new file mode 100644 index 0000000..5efe188 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/FetchLogs.java @@ -0,0 +1,704 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.util; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.SequenceInputStream; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import com.sun.ts.lib.util.TestUtil; + +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * + * @author Raja Perumal + */ + +/** + * FetchLogs servlet is used for collecting logs from the server. + * + * FetchLogs servlet gets the logfile location from its input parameters and + * locates the log file in the server, parses it and extracts a subset of logs + * based on various parameters such as "classname" or "sequenceNumber" and + * builds Collection of logs of type (LogRecordEntry) and returns the Collection + * + */ +public class FetchLogs extends HttpServlet { + + Collection recordCollection = new Vector(); + + Collection appIdRecordCollection = new Vector(); + + Collection linkRecordCollection = new Vector(); + + Collection appSpecificRecordCollection = new Vector(); + + public void init(ServletConfig config) throws ServletException { + super.init(config); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doGet(request, response); + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + File logfile = null; + + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory + .newDocumentBuilder(); + + OutputStream outStream = response.getOutputStream(); + ObjectOutputStream ostream = new ObjectOutputStream(outStream); + if (ostream == null) { + throw new Exception( + "ServletException in doGet - could not get ObjectOutputStream"); + } + + String logFileLocation = request.getParameter("LogFilePath"); + + if (logFileLocation != null) + logfile = new File(logFileLocation); + + if ((logfile != null) && !logfile.exists()) { + String header = "Log file does not exists"; + ostream.writeObject(header); + + TestUtil.logErr("Log File : " + logFileLocation + " does not exists"); + TestUtil.logErr("Check permissions for log file "); + TestUtil.logErr("See User guide for Configuring log file permissions"); + } else { + // LogRecords will be added to TSSVLog.txt as long as the server is + // up and running. Since TSSLog.txt is continuously updated with + // more record there will not be any end tag at the end of the + // log file. + // + // This will cause the SAXParser to throw fatal error message + // "XML Document structures must start and end with the + // same entity" + // + // In order to avoid this error message the FileInputStream + // should have the end tag , this can be achieved by + // creating a SequenceInputStream which includes a + // FileInputStream and a ByteArrayInputStream, where the + // ByteArrayInputStream contains the bytes for + // + String endLogTag = ""; + ByteArrayInputStream bais = new ByteArrayInputStream( + endLogTag.getBytes()); + SequenceInputStream sis = new SequenceInputStream( + new FileInputStream(logFileLocation), bais); + + Document document = documentBuilder.parse(sis); + Element rootElement = document.getDocumentElement(); + NodeList nodes = rootElement.getChildNodes(); + + String queryString = request.getParameter("LogQueryString"); + String queryParams = request.getParameter("LogQueryParams"); + // TestUtil.logMsg("LogFilePath =" + logFileLocation); + // TestUtil.logMsg("LogQueryString =" + queryString); + // TestUtil.logMsg("LogQueryParams =" + queryParams); + + // Add a header to inform the client that the following + // data is a recordCollection Object. + ostream.writeObject("RecordCollection header"); + + // Get appId records(appId records are records which identifies + // the records with application name and time stamp ). + // + // for extracting appId records, process each record and + // search whether the record starts with "appId" string. + // + // if the log records starts with "appId" + // i.e if (log records starts with "appId") then + // add the records to appIdRecordCollection + // else if (log records starts with "link") then + // add the records to linkRecordCollection + // else + // add the records to recordCollection + // + // Note: In the process of locating appId records + // the remaining records are also processed and + // stored as "linkRecordCollection" and + // "recordCollection" based on the content of the records + if (queryString.equals("getAppSpecificRecordCollection")) { + // This call populates both appIdRecordCollection and + // the rest of record collection + appIdRecordCollection = getAppIdRecordCollection("appId", nodes); + // printCollection(appIdRecordCollection); + + // write recordCollection + ostream.writeObject(recordCollection); + // printCollection(recordCollection); + + // Parse through all appId records and + // find the current application name + String applicationName = getCurrentApplicationName(); + + // Parse all link records and find all the + // applications that are linked to the current application + Vector linkedApplicationNames = getLinkedApplicationNames(); + + // Using the application names, isolate the + // application specific logs from the rest of the logs + Collection newAppSpecificRecordCollection = getAppSpecificRecordCollection( + applicationName, linkedApplicationNames); + // printCollection(newAppSpecificRecordCollection); + + // write applicaiton specific record Collection + ostream.writeObject(newAppSpecificRecordCollection); + } else { + recordCollection = processLogs(queryString, queryParams, nodes); + // write recordCollection + ostream.writeObject(recordCollection); + } + // printCollection(appIdRecordCollection); + } + ostream.flush(); + ostream.close(); + } catch (ParserConfigurationException pce) { + TestUtil.logErr("PaserConfigurationException :" + pce.getMessage()); + TestUtil.printStackTrace(pce); + throw new ServletException(pce.getMessage(), pce); + } catch (SAXException se) { + TestUtil.logErr("SAXException :" + se.getMessage()); + TestUtil.printStackTrace(se); + throw new ServletException(se.getMessage(), se); + } catch (IOException ioe) { + TestUtil.logErr("IOException :" + ioe.getMessage()); + TestUtil.printStackTrace(ioe); + ioe.printStackTrace(); + throw new ServletException("log file not found :" + ioe.getMessage(), + ioe); + } catch (SecurityException se) { + TestUtil.logErr("SecurityException :" + se.getMessage()); + TestUtil.printStackTrace(se); + se.printStackTrace(); + throw new ServletException(se.getMessage(), se); + } catch (Exception e) { + TestUtil.logErr("Exception :" + e.getMessage()); + TestUtil.printStackTrace(e); + throw new ServletException(e.getMessage(), e); + } + } + + public Collection processLogs(String queryString, String queryParams, + NodeList nodes) throws Exception { + Collection recordCollection = null; + + if (queryString.equals("findLogsBySequenceNumber")) { + recordCollection = findLogsBySequenceNumber(queryParams, nodes); + } else if (queryString.equals("findLogsBySubStringMatch")) { + recordCollection = findLogsBySubStringMatch(queryParams, nodes); + } else if (queryString.equals("findLogsByPrefix")) { + recordCollection = findLogsByPrefix(queryParams, nodes); + } else if (queryString.equals("pullAllLogRecords")) { + recordCollection = pullAllLogRecords(queryParams, nodes); + } else { + TestUtil.logErr("InCorrect query string :+queryString"); + throw new Exception("InCorrect query string :" + queryString); + } + return recordCollection; + } + + /** + * Fetches all JSR196 SPI logs from TSSVLog.txt + */ + public Collection pullAllLogRecords(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + + if (recordNode.getNodeName().equals("record")) { + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + recordCollection.add(recordEntry); + + } + } + return recordCollection; + } + + /** + * Locates the logs based on SubStringMatch + */ + public Collection findLogsBySubStringMatch(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("message")) { + nodeValue = getText(childNode); + if (nodeValue.indexOf(queryParams) > 0) { + // create a new record entry and + // add it to the collection + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + recordCollection.add(recordEntry); + } + } + } + } + return recordCollection; + } + + /** + * Locates the logs based on the given prefix string + */ + public Collection findLogsByPrefix(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("message")) { + nodeValue = getText(childNode); + if (nodeValue.startsWith(queryParams)) { + // create a new record entry that matches the + // query criteria + LogRecordEntry matchingRecordEntry = new LogRecordEntry(recordNode); + recordCollection.add(matchingRecordEntry); + } + } + } + } + return recordCollection; + } + + /** + * This method retrieves the appId records. + * + * i.e if (log records starts with "appId") then add the records to + * appIdRecordCollection else add the records to recordCollection + * + * Note: In the process of locating appId records the remaining records are + * also isolated and stored in a collection called "recordCollection" + */ + public Collection getAppIdRecordCollection(String queryParams, NodeList nodes) + throws Exception { + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("message")) { + nodeValue = getText(childNode); + if (nodeValue.startsWith(queryParams)) { + // create a new record entry that matches the + // query criteria i.e "appId" + LogRecordEntry matchingRecordEntry = new LogRecordEntry(recordNode); + this.appIdRecordCollection.add(matchingRecordEntry); + } else if (nodeValue.startsWith("link")) { + // create a new record entry for link records + LogRecordEntry linkRecordEntry = new LogRecordEntry(recordNode); + this.linkRecordCollection.add(linkRecordEntry); + } else { + // create a new record entry that do not + // match the query criteria + LogRecordEntry nonMatchingRecordEntry = new LogRecordEntry( + recordNode); + this.recordCollection.add(nonMatchingRecordEntry); + } + } + } + } + return appIdRecordCollection; + } + + /** + * Locates logs based on the given sequenceNumber + */ + public Collection findLogsBySequenceNumber(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + int sequenceNumber = (new Integer(queryParams)).intValue(); + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("sequence")) { + nodeValue = getText(childNode); + int nodeValueInInt = (new Integer(nodeValue)).intValue(); + if (nodeValueInInt == sequenceNumber) { + // create a new record entry and + // add it to the collection + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + recordCollection.add(recordEntry); + } + } + } + } + return recordCollection; + } + + public String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + return result; + } + + public void printCollection(Collection recordCollection) { + LogRecordEntry recordEntry = null; + Iterator iterator = recordCollection.iterator(); + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + printRecordEntry(recordEntry); + } + } + + public void printRecordEntry(LogRecordEntry rec) { + System.out.println("*******Log Content*******"); + System.out.println("MilliSeconds =" + rec.getMilliSeconds()); + System.out.println("seqence no =" + rec.getSequenceNumber()); + System.out.println("Message =" + rec.getMessage()); + if (rec.getClassName() != null) + System.out.println("Class name =" + rec.getClassName()); + if (rec.getMethodName() != null) + System.out.println("Method name =" + rec.getMethodName()); + if (rec.getLevel() != null) + System.out.println("Level =" + rec.getLevel()); + if (rec.getThrown() != null) + System.out.println("Thrown =" + rec.getThrown()); + System.out.println(); + + } + + // This method returns the current application name by analysing + // all the appId log records. + // + // The appId log record contains the Application name, the timeStamp in the + // appId log record is also used fo this calculation + // + // For example, let us examine the following 3 appId log records. + // + // appId :: MyApp recordTimeStamp = 1058312446598 + // appId :: App recordTimeStamp = 1058312463706 + // appId :: adminapp recordTimeStamp = 1058312480593 + // + // In the above 3 appId records + // a) the first field "appId :: " identifies this as a appId record + // b) the second field indicates the application name + // c) recordTimeStamp is the "millis" element of the log record which + // specifies the timestamp + // + // By comparing the timestamps we can locate the latest of all appId records + // and return the application name associated with it. + public String getCurrentApplicationName() { + LogRecordEntry recordEntry = null; + String temp = null; + String appName = null; + String prevAppName = null; + long prevRecordTimeStamp = 0; + long recordTimeStamp = 0; + String[] tokenArray = new String[2]; + + if (appIdRecordCollection == null) { + TestUtil.logMsg("Record collection empty : No appId records found"); + return null; + } + + Iterator iterator = appIdRecordCollection.iterator(); + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + + // Remove the string "appId :: " from the message + temp = message.substring(9, message.length()); + + // Get appName and timeStampString + tokenArray = temp.split(" , "); + appName = tokenArray[0]; + // timeStampString = tokenArray[1]; + + // Get timeStampString + recordTimeStamp = recordEntry.getMilliSeconds(); + + // now unstuff application name + appName = unStuffData(appName); + + // TestUtil.logMsg("appName ="+appName); + // TestUtil.logMsg("timeStampString ="+timeStampString); + + if (recordTimeStamp < prevRecordTimeStamp) { + recordTimeStamp = prevRecordTimeStamp; + appName = prevAppName; + } + } + return appName; + } + + // This method returns the linked application names by analysing + // all the link log records. + // + // The link log record contains the list of Application names, + // the record timeStamp is also used for this calculation + // + // For example, let us examine the following 2 link log records. + // + // link :: MyApp,SecondApp recordTimeStamp = 1058312446598 + // link :: App,SecondApp,ThirdApp recordTimeStamp = 1058312463706 + // + // In the above 3 link records + // a) the first field "link :: " identifies this as a link record + // b) the second field indicates the application names that are + // linked to. + // Note: Linked application names are idenified using + // the comma separator. + // c) the recordTimeStamp is the "millis" element in the log record + // which specifies the time at which the record was created. + // + // By comparing the timestamps we can locate the latest link records + // and return the application names linked to it. + public Vector getLinkedApplicationNames() { + LogRecordEntry recordEntry = null; + String temp = null; + String timeStampString = null; + String appNames = null; + String prevAppName = null; + long prevRecordTimeStamp = 0; + long recordTimeStamp = 0; + String[] tokenArray = new String[2]; + Vector applicationNames = new Vector(); + + if (linkRecordCollection == null) { + TestUtil.logMsg("Record collection empty : No link records found"); + return null; + } + + Iterator iterator = linkRecordCollection.iterator(); + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + + // Remove the string "link :: " from the message + temp = message.substring(8, message.length()); + + // Get appName and timeStampString + tokenArray = temp.split(" : "); + appNames = tokenArray[0]; + // timeStampString = tokenArray[1]; + + // get recordTimeStamp + recordTimeStamp = recordEntry.getMilliSeconds(); + + // now unstuff application name + appNames = unStuffData(appNames); + + if (recordTimeStamp < prevRecordTimeStamp) { + recordTimeStamp = prevRecordTimeStamp; + appNames = prevAppName; + } + } + + StringTokenizer strtoken; + + if (appNames != null) { + // create a vector with applicationNames + strtoken = new StringTokenizer(appNames, ","); + if (appNames.indexOf(",") > 0) { + // if the appNames string contains multiple applications + // add all of them to the vector applicationNames + while (strtoken.hasMoreTokens()) { + applicationNames.add(strtoken.nextToken()); + } + } else if (appNames != null) { + // if the appNames string contains only one application + // add it to the vector applicationNames + applicationNames.add(appNames); + } + } else { + // else return null + return null; + } + + return applicationNames; + } + + /* + * This method reads all non-appId records from the record collection and + * isolates current appSpecific records from the rest using the given + * applicationName and the linkedApplicationNames. + */ + public Collection getAppSpecificRecordCollection(String applicationName, + Vector linkedApplicationNames) { + LogRecordEntry recordEntry = null; + + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No records found"); + return null; + } + Iterator iterator = this.recordCollection.iterator(); + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + + // if recordEntry contains the specified applicationName + // Add the record to appSpecificRecordCollection + if (message.indexOf(applicationName) > 0) { + appSpecificRecordCollection.add(recordEntry); + } + } + + if (linkedApplicationNames != null) { + // retrieve all the records associated with + // linked applications. + for (Enumeration appEnum = linkedApplicationNames.elements(); appEnum + .hasMoreElements();) { + applicationName = (String) appEnum.nextElement(); + + iterator = this.recordCollection.iterator(); + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + + // if recordEntry contains the specified applicationName + // Add the record to appSpecificRecordCollection + if (message.indexOf(applicationName) > 0) { + appSpecificRecordCollection.add(recordEntry); + } + } + + } + } + return appSpecificRecordCollection; + } + + // This method tokenize the given string and + // return first token and the remaining + // string a string array based on the given delimeter + public static String[] getTokens(String str, String delimeter) { + String[] array = new String[2]; + StringTokenizer strtoken; + + // Get first token and the remaining string + strtoken = new StringTokenizer(str, delimeter); + if (str.indexOf(delimeter) > 0) { + array[0] = strtoken.nextToken(); + array[1] = str.substring(array[0].length() + 3, str.length()); + } + // TestUtil.logMsg("Input String ="+str); + // TestUtil.logMsg("array[0] ="+array[0]); + // TestUtil.logMsg("array[1] ="+array[1]); + return array; + } + + // This will remove the stuffed characters in the input string + // Note: The non-alphabets in the input string was already stuffed by + // the same character, this method unstuff those characters + public static String unStuffData(String inputStr) { + char[] outStr = new char[2048]; + char[] str = inputStr.toCharArray(); + for (int i = 0, j = 0; i < str.length;) { + + int a = (new Character(str[i])).getNumericValue(str[i]); + + // Don't stuff extra character if the character is an alphabet + // + // Numeric values for alphabets falls in 10 to 35, this includes + // both upper and lower cases + if ((a > 9) && (a < 36)) { + outStr[j++] = str[i++]; + } else { // unstuff the character + outStr[j++] = str[i++]; // just skip the next character + i++; + } + } + + return ((new String(outStr)).trim()); + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogFileProcessor.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogFileProcessor.java new file mode 100644 index 0000000..6131687 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogFileProcessor.java @@ -0,0 +1,662 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.util; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.SequenceInputStream; +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.sun.ts.lib.util.TestUtil; + +/** + * + * @author Raja Perumal + */ + +/** + * LogFileProcessor does the following operations + * + * 1) Fetches log records from TSSVLog.txt + * + * 2) Checks for the existance of search string in the log for example to verify + * whether server log contains a string "Java EE rocks" use the following code + * + * LogFileProcessor logProcessor = new LogFileProcessor(properties); boolean + * contains = logProcessor.verifyLogContains("Java EE rocks"); + * + * where "properties" contains the following key value pair 1) log.file.location + * + * 3) Prints the collection of log records. + * + */ +public class LogFileProcessor { + + private Properties props = null; + + private String logFileLocation = null; + + private Collection recordCollection = null; + + private Collection appIdRecordCollection = null; + + private Collection appSpecificRecordCollection = null; + + public LogFileProcessor() { + } + + public LogFileProcessor(Properties props) { + setup(props); + } + + /** + * setup method + */ + public void setup(Properties p) { + props = p; + boolean pass = true; + try { + logFileLocation = p.getProperty("log.file.location"); + if (logFileLocation == null) + pass = false; + + TestUtil.logMsg("log.file.location = " + logFileLocation); + + if (!pass) { + TestUtil.logErr("Setup Failed "); + TestUtil.logErr("Please verify the following in ts.jte"); + TestUtil.logErr("log.file.location"); + } + TestUtil.logMsg("Setup ok"); + + } catch (Exception e) { + TestUtil.logErr("Setup Failed "); + TestUtil.logErr("Please verify the following in ts.jte"); + TestUtil.logErr("log.file.location"); + } + + } + + /** + * FetchLogs pull logs from the server. + * + */ + public void fetchLogs(String accessMethod) { + + File logfile = null; + URL url = null; + + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory + .newDocumentBuilder(); + + String strFilePathAndName = ""; + if (logFileLocation.indexOf("TSSVLog.txt") <= 0) { + strFilePathAndName = logFileLocation + "/TSSVLog.txt"; + } + System.out.println("Log File = " + strFilePathAndName); + + if (strFilePathAndName != null) + logfile = new File(strFilePathAndName); + + if (!logfile.exists()) { + String header = "Log file does not exists"; + // ostream.writeObject(header); + + System.out + .println("Log File : " + logfile.getName() + " does not exists"); + System.out.println("Check permissions for log file "); + System.out + .println("See User guide for Configuring log file permissions"); + } else { + // LogRecords will be added to TSSVLog.txt as long as the server is + // up and running. Since TSSLog.txt is continuously updated with + // more record there will not be any end tag at the end of the + // log file. + // + // This will cause the SAXParser to throw fatal error message + // "XML Document structures must start and end with the + // same entity" + // + // In order to avoid this error message the FileInputStream + // should have the end tag , this can be achieved by + // creating a SequenceInputStream which includes a + // FileInputStream and a ByteArrayInputStream, where the + // ByteArrayInputStream contains the bytes for + // + String endLogTag = ""; + ByteArrayInputStream bais = new ByteArrayInputStream( + endLogTag.getBytes()); + SequenceInputStream sis = new SequenceInputStream( + new FileInputStream(strFilePathAndName), bais); + + Document document = documentBuilder.parse(sis); + Element rootElement = document.getDocumentElement(); + NodeList nodes = rootElement.getChildNodes(); + + String queryString = "pullAllRecords"; + String queryParams = "fullLog"; + + if (queryString.equals("pullAllRecords")) { + recordCollection = pullAllLogRecords(queryParams, nodes); + // printCollection(recordCollection); + } + + } + + } catch (Exception e) { + TestUtil.logErr(e.getMessage()); + TestUtil.printStackTrace(e); + e.printStackTrace(); + } + + } + + /** + * Fetches all JSR196 SPI logs from TSSVLog.txt + */ + public static Collection pullAllLogRecords(String queryParams, NodeList nodes) + throws Exception { + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + Collection recordCollection = new Vector(); + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + + if (recordNode.getNodeName().equals("record")) { + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + recordCollection.add(recordEntry); + + } + } + return recordCollection; + } + + public void setAppIdRecordCollection(Collection recordCollection) { + this.appIdRecordCollection = recordCollection; + } + + public Collection getAppIdRecordCollection() { + return this.appIdRecordCollection; + } + + public void setRecordCollection(Collection recordCollection) { + this.recordCollection = recordCollection; + } + + public Collection getRecordCollection() { + return this.recordCollection; + } + + public void setAppSpecificRecordCollection(Collection recordCollection) { + this.appSpecificRecordCollection = recordCollection; + } + + public Collection getAppSpecificRecordCollection() { + return this.appSpecificRecordCollection; + } + + /** + * Checks for the existance of search string in the log. For example to verify + * whether server log contains a string "Java EE rocks" use the following code + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContains("Java EE rocks"); + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContains(String args[]) { + return verifyLogContains(args, false); + } + + /** + * Checks for the existance of search string in the log. For example to verify + * whether server log contains a string "Java EE rocks" use the following code + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContains("Java EE rocks"); + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContains(String args[], boolean validateOrder) { + LogRecordEntry recordEntry = null; + TestUtil.logMsg("Searching log records for record :" + args[0]); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + int numberOfMatches = 0; + + boolean argsMatchIndex[] = new boolean[args.length]; + for (int i = 0; i < args.length; i++) { + // initialize all argsMatchIndex to "false" (i.e no match) + argsMatchIndex[i] = false; + + // From the given string array(args) if there is a record match + // for the search string, then the corresponding argsMatchIndex[i] + // will be set to true(to indicate a match) + // i.e argsMatchIndex[i] = true; + // + // For example if the string array contains + // String args[]={"JK", "EMERSON", "J.B.Shaw}; + // + // And if the string "JK" and "J.B.Shaw" are found in the records + // then the argsMatchIndex will be set as shown below + // argsMatchIndex[] ={true, false, true}; + // + } + + Iterator iterator = recordCollection.iterator(); + if (!validateOrder) { + // we dont care about order, just that all args were found + while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // Search only unique record matches ignore repeat occurances + if (argsMatchIndex[i] != true) { + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && message.equals(args[i])) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + + // Increment match count + numberOfMatches++; + + // Mark the matches in argsMatchIndex + argsMatchIndex[i] = true; + + continue; + } + } + } + // Return true if, we found matches for all strings + // in the given string array + if (numberOfMatches == numberOfArgs) + return true; + } + + // if here, our non-order-specific search did not find all matches... + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + if (argsMatchIndex[i] == false) { + TestUtil.logMsg(args[i]); + } + } + + } else { + // we care about order, so find args and make sure they are in + // same order as the arg[] array + int recordCnt = 0; + int argCount = 0; + + // first find how last occurance of our FIRST ITEM. Why? because + // we want to be sure that if we are searching for "a", "b", "c" within + // the TSSVLog.txt, we better find the very last and most recent entry + // for "a". For example, if logfile contain "a", "b", "c", "a", "c" due + // to multiple runs, we will erroneously pass a search for "a", "b", "c" + // UNLESS we are careful to find the last "a", then do our check. + + int occurances = 0; + while (iterator.hasNext()) { + recordCnt++; + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + if ((message != null) && message.equals(args[argCount])) { + occurances++; + TestUtil + .logMsg("verifyLogContains() found " + occurances + "occurances"); + } + } + + // reset the iterator + iterator = recordCollection.iterator(); + while (iterator.hasNext()) { + recordCnt++; + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + + if ((message != null) && (message.equals(args[0])) + && (occurances > 1)) { + // found a match but not the LAST occurance of it in TSSVLog.txt + // so keep looking + occurances--; + continue; + } + + if ((message != null) && message.equals(args[argCount])) { + // we found last occurance of first item in args[] + TestUtil.logMsg( + "Found: " + args[argCount] + " in record entry: " + recordCnt); + argCount++; + if (argCount >= args.length) { + // we are done, found all our matches in order + return true; + } + } + } + + // if here, our order-specific-search did not succeed. + TestUtil.logMsg( + "Failed to find order-specific-records search in verifyLogContains()"); + TestUtil.logMsg(" Could not find: " + args[argCount]); + } + + return false; + } + + /** + * Checks for the existance of one of the search string(from a given String + * array. + * + * For example to verify whether server log contains one of the following + * String String[] arr ={"aaa", "bbb", "ccc"}; + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContainsOneOf(arr); + * + * This method will return true if the log file contains one of the specified + * String (say "aaa" ) + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContainsOneOf(String args[]) { + LogRecordEntry recordEntry = null; + boolean result = false; + + TestUtil + .logMsg("Searching log records for the presence of one of the String" + + " from a given string array"); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + + Iterator iterator = recordCollection.iterator(); + searchLabel: while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && message.equals(args[i])) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + result = true; + + // If a match is found no need to search further + break searchLabel; + } + } + + } + + if (!result) { + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + TestUtil.logMsg(args[i]); + } + } + + return result; + } + + /** + * This method looks for the presence of the given substring (from the array + * of strings "args") in the serverlog, which starts with the given + * "srchStrPrefix" search-string-prefix. + * + * + * For example to verify whether server log contains one of the following + * Strings in a server log with appContextId as the message prefix we can + * issue the following command + * + * String[] arr ={"aaa", "bbb", "ccc"}; String srchStrPrefix ="appContextId"; + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContainsOneOf(arr); + * + * "appContextId= xxxx aaa yyyyyyyyyyyyyyyyy" "appContextId= yyyy bbb + * xxxxxxxxxxxxxxxxx" + * + * This method will return true if the log file contains one of the specified + * String (say "aaa" ) in the message log with "appContextId" as its message + * prefix. + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContainsOneOfSubString(String args[], + String srchStrPrefix) { + LogRecordEntry recordEntry = null; + boolean result = false; + + TestUtil + .logMsg("Searching log records for the presence of one of the String" + + " from a given string array"); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + + Iterator iterator = recordCollection.iterator(); + searchLabel: while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && (message.startsWith(srchStrPrefix, 0)) + && (message.indexOf(args[i]) > 0)) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + result = true; + + // If a match is found no need to search further + break searchLabel; + } + } + + } + + if (!result) { + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + TestUtil.logMsg(args[i]); + } + } + + return result; + } + + public void printCollection(Collection recordCollection) { + LogRecordEntry recordEntry = null; + Iterator iterator = recordCollection.iterator(); + + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + printRecordEntry(recordEntry); + } + } + + public void printRecordEntry(LogRecordEntry rec) { + TestUtil.logMsg("*******Log Content*******"); + + TestUtil.logMsg("Milli Seconds =" + rec.getMilliSeconds()); + TestUtil.logMsg("Seqence no =" + rec.getSequenceNumber()); + TestUtil.logMsg("Message =" + rec.getMessage()); + if (rec.getClassName() != null) + TestUtil.logMsg("Class name =" + rec.getClassName()); + if (rec.getMethodName() != null) + TestUtil.logMsg("Method name =" + rec.getMethodName()); + if (rec.getLevel() != null) + TestUtil.logMsg("Level =" + rec.getLevel()); + if (rec.getThrown() != null) + TestUtil.logMsg("Thrown =" + rec.getThrown()); + TestUtil.logMsg(""); + } + + public String extractQueryToken(String str, String ContextId) { + StringTokenizer strtok; + String DELIMETER = "|"; + String qstring = null; + String qparams = null; + + strtok = new StringTokenizer(ContextId, DELIMETER); + if (ContextId.indexOf(DELIMETER) > 0) { + qstring = strtok.nextToken(); + if (strtok.hasMoreTokens()) + qparams = strtok.nextToken(); + } + + // return query string or query params based on the content + // of the string str + if (str.equals("LogQueryString")) + return qstring; + else + return qparams; + } + + // This method tokenize the given string and + // return first token and the remaining + // string a string array based on the given delimeter + public static String[] getTokens(String str, String delimeter) { + String[] array = new String[2]; + StringTokenizer strtoken; + + // Get first token and the remaining string + strtoken = new StringTokenizer(str, delimeter); + if (str.indexOf(delimeter) > 0) { + array[0] = strtoken.nextToken(); + array[1] = str.substring(array[0].length() + 3, str.length()); + } + + // TestUtil.logMsg("Input String ="+str); + // TestUtil.logMsg("array[0] ="+array[0]); + // TestUtil.logMsg("array[1] ="+array[1]); + return array; + } + + // + // Locates the logs based on the given prefix string + // + // For example to locate all commit records i.e records such as + // + // commit :: MyApp1058312446320 , recordTimeStamp=1058312446598 + // + // Use the following method to pull all the commit records + // + // fingLogsByPrefix("commit", nodes); + public Collection findLogsByPrefix(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("message")) { + nodeValue = getText(childNode); + if (nodeValue.startsWith(queryParams)) { + // create a new record entry and + // add it to the collection + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + + recordCollection.add(recordEntry); + } + } + } + } + return recordCollection; + } + + public String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + return result; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogProcessor.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogProcessor.java new file mode 100644 index 0000000..ac8d842 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogProcessor.java @@ -0,0 +1,607 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.util; + +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.sun.ts.lib.porting.TSURL; +import com.sun.ts.lib.util.TestUtil; + +/** + * + * @author Raja Perumal + */ + +/** + * LogProcessor does the following operations + * + * 1) Fetches the server log using "FetchLogs" servlet. + * + * 2) Checks for the existance of search string in the log for example to verify + * whether server log contains a string "Java EE rocks" use the following code + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains = + * logProcessor.verifyLogContains("Java EE rocks"); + * + * where "properties" contains the following key value pair 1) log.file.location + * 2) webServerHost 3) webServerPort + * + * 3) Prints the collection of log records. + * + */ +public class LogProcessor { + + private Properties props = null; + + private TSURL tsURL = new TSURL(); + + private String webServerHost = "unknown"; + + private int webServerPort = 8000; + + private String SERVLET = "/jaspic_util_web/FetchLogs"; + + private String logFileLocation = null; + + private Collection recordCollection = null; + + private Collection appIdRecordCollection = null; + + private Collection appSpecificRecordCollection = null; + + public LogProcessor() { + } + + public LogProcessor(Properties props) { + setup(props); + } + + /** + * setup method + */ + public void setup(Properties p) { + props = p; + boolean pass = true; + try { + logFileLocation = p.getProperty("log.file.location"); + if (logFileLocation == null) + pass = false; + + webServerHost = p.getProperty("webServerHost"); + if (webServerHost == null) + pass = false; + else if (webServerHost.equals("")) + pass = false; + + try { + webServerPort = Integer.parseInt(p.getProperty("webServerPort")); + } catch (Exception e) { + pass = false; + } + + TestUtil.logMsg("webServerHost = " + webServerHost); + TestUtil.logMsg("webServerPort = " + webServerPort); + TestUtil.logMsg("log.file.location = " + logFileLocation); + + if (!pass) { + TestUtil.logErr("Setup Failed "); + TestUtil.logErr("Please verify the following in build.properties"); + TestUtil.logErr("webServerHost, webServerPort"); + TestUtil.logErr("Please verify the following in ts.jte"); + TestUtil.logErr("log.file.location"); + } + TestUtil.logMsg("Setup ok"); + + } catch (Exception e) { + TestUtil.logErr("Setup Failed "); + TestUtil.logErr("Please verify the following in build.properties"); + TestUtil.logErr("webServerHost, webServerPort"); + TestUtil.logErr("Please verify the following in ts.jte"); + TestUtil.logErr("log.file.location"); + } + + } + + /** + * FetchLogs does the following operations + * + * 1) Pulls all the logs from the server + * + * 2) It retrieves all the records specific to the current application. + * + * + */ + public void fetchLogs(String accessMethod) { + + long seqNum = 0L; + String contextId = null; + Collection recordCollection = null; + Properties props = null; + URL url = null; + String qString = null; + String qParams = null; + + try { + + url = tsURL.getURL("http", webServerHost, webServerPort, SERVLET); + + props = new Properties(); + props.put("LogFilePath", logFileLocation + "/TSSVLog.txt"); + + // obtain the QueryString and Query params from the accessMethod string + qString = extractQueryToken("LogQueryString", accessMethod); + qParams = extractQueryToken("LogQueryParams", accessMethod); + props.put("LogQueryString", qString); + props.put("LogQueryParams", qParams); + + String argString = TestUtil.toEncodedString(props); + + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setRequestProperty("CONTENT_LENGTH", "" + argString.length()); + + // get Output stream + OutputStream os = conn.getOutputStream(); + OutputStreamWriter osw = new OutputStreamWriter(os); + + TestUtil.logMsg("Posting Data to :" + url.toString()); + + // write the data to the output stream + osw.write(argString); + osw.flush(); + osw.close(); + + InputStream is = conn.getInputStream(); + ObjectInputStream ois = new ObjectInputStream(is); + + String header = (String) ois.readObject(); + + // read the header information, + // + // if the header is equal to "RecordCollection header" + // then the remaining data is a recordCollection object + // else report log file processing failure. + // + if (header.equals("RecordCollection header")) { + TestUtil.logMsg("Reading records collection from the server ..."); + + recordCollection = (Collection) ois.readObject(); + if ((recordCollection == null) || (recordCollection.isEmpty())) { + TestUtil.logErr("Logfile is empty and contains No records."); + } + setRecordCollection(recordCollection); + // printCollection(recordCollection); + + if (qString.equals("getAppSpecificRecordCollection")) { + appSpecificRecordCollection = (Collection) ois.readObject(); + setAppSpecificRecordCollection(appSpecificRecordCollection); + // printCollection(appSpecificRecordCollection); + } + } else { + TestUtil.logErr("Log File processing failed"); + TestUtil.logErr("Log file does not exists in the server" + + " or you don't have read permission for log file"); + TestUtil.logErr("Check permissions for log file "); + TestUtil.logErr("See User guide for Configuring log file permissions"); + } + ois.close(); + } catch (Exception e) { + TestUtil.logErr(e.getMessage()); + TestUtil.printStackTrace(e); + e.printStackTrace(); + } + } + + public void setAppIdRecordCollection(Collection recordCollection) { + this.appIdRecordCollection = recordCollection; + } + + public Collection getAppIdRecordCollection() { + return this.appIdRecordCollection; + } + + public void setRecordCollection(Collection recordCollection) { + this.recordCollection = recordCollection; + } + + public Collection getRecordCollection() { + return this.recordCollection; + } + + public void setAppSpecificRecordCollection(Collection recordCollection) { + this.appSpecificRecordCollection = recordCollection; + } + + public Collection getAppSpecificRecordCollection() { + return this.appSpecificRecordCollection; + } + + /** + * Checks for the existance of search string in the log. For example to verify + * whether server log contains a string "Java EE rocks" use the following code + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContains("Java EE rocks"); + * + * where "properties" contains the key value pair for 1) log.file.location 2) + * webServerHost 3) webServerPort + */ + public boolean verifyLogContains(String args[]) { + LogRecordEntry recordEntry = null; + TestUtil.logMsg("Searching log records for record :" + args[0]); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + int numberOfMatches = 0; + + boolean argsMatchIndex[] = new boolean[args.length]; + for (int i = 0; i < args.length; i++) { + // initialize all argsMatchIndex to "false" (i.e no match) + argsMatchIndex[i] = false; + + // From the given string array(args) if there is a record match + // for the search string, then the corresponding argsMatchIndex[i] + // will be set to true(to indicate a match) + // i.e argsMatchIndex[i] = true; + // + // For example if the string array contains + // String args[]={"JK", "EMERSON", "J.B.Shaw}; + // + // And if the string "JK" and "J.B.Shaw" are found in the records + // then the argsMatchIndex will be set as shown below + // argsMatchIndex[] ={true, false, true}; + // + } + + Iterator iterator = recordCollection.iterator(); + while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // Search only unique record matches ignore repeat occurances + if (argsMatchIndex[i] != true) { + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && message.equals(args[i])) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + + // Increment match count + numberOfMatches++; + + // Mark the matches in argsMatchIndex + argsMatchIndex[i] = true; + + continue; + } + } + + } + + // Return true if, we found matches for all strings + // in the given string array + if (numberOfMatches == numberOfArgs) + return true; + } + + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + if (argsMatchIndex[i] == false) { + TestUtil.logMsg(args[i]); + } + } + + return false; + } + + /** + * Checks for the existance of one of the search string(from a given String + * array. + * + * For example to verify whether server log contains one of the following + * String String[] arr ={"aaa", "bbb", "ccc"}; + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContainsOneOf(arr); + * + * This method will return true if the log file contains one of the specified + * String (say "aaa" ) + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContainsOneOf(String args[]) { + LogRecordEntry recordEntry = null; + boolean result = false; + + TestUtil + .logMsg("Searching log records for the presence of one of the String" + + " from a given string array"); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + + Iterator iterator = recordCollection.iterator(); + searchLabel: while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && message.equals(args[i])) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + result = true; + + // If a match is found no need to search further + break searchLabel; + } + } + + } + + if (!result) { + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + TestUtil.logMsg(args[i]); + } + } + + return result; + } + + /** + * This method looks for the presence of the given substring (from the array + * of strings "args") in the serverlog, which starts with the given + * "srchStrPrefix" search-string-prefix. + * + * + * For example to verify whether server log contains one of the following + * Strings in a server log with appContextId as the message prefix we can + * issue the following command + * + * String[] arr ={"aaa", "bbb", "ccc"}; String srchStrPrefix ="appContextId"; + * + * LogProcessor logProcessor = new LogProcessor(properties); boolean contains + * = logProcessor.verifyLogContainsOneOf(arr); + * + * "appContextId= xxxx aaa yyyyyyyyyyyyyyyyy" "appContextId= yyyy bbb + * xxxxxxxxxxxxxxxxx" + * + * This method will return true if the log file contains one of the specified + * String (say "aaa" ) in the message log with "appContextId" as its message + * prefix. + * + * where "properties" contains the key value pair for 1) log.file.location + */ + public boolean verifyLogContainsOneOfSubString(String args[], + String srchStrPrefix) { + LogRecordEntry recordEntry = null; + boolean result = false; + + TestUtil + .logMsg("Searching log records for the presence of one of the String" + + " from a given string array"); + if (recordCollection == null) { + TestUtil.logMsg("Record collection empty : No log records found"); + return false; + } else { + TestUtil.logMsg( + "Record collection has: " + recordCollection.size() + " records."); + } + + int numberOfArgs = args.length; + + Iterator iterator = recordCollection.iterator(); + searchLabel: while (iterator.hasNext()) { + // loop thru all message tag/entries in the log file + recordEntry = (LogRecordEntry) iterator.next(); + String message = recordEntry.getMessage(); + // loop through all arguments to search for a match + for (int i = 0; i < numberOfArgs; i++) { + + // see if one of the search argument matches with + // the logfile message entry and if so return true + if ((message != null) && (message.startsWith(srchStrPrefix, 0)) + && (message.indexOf(args[i]) > 0)) { + TestUtil.logMsg("Matching Record :"); + TestUtil.logMsg(recordEntry.getMessage()); + result = true; + + // If a match is found no need to search further + break searchLabel; + } + } + + } + + if (!result) { + // Print unmatched Strings(i.e no matches were found for these strings) + TestUtil.logMsg( + "No Matching log Record(s) found for the following String(s) :"); + for (int i = 0; i < numberOfArgs; i++) { + TestUtil.logMsg(args[i]); + } + } + + return result; + } + + public void printCollection(Collection recordCollection) { + LogRecordEntry recordEntry = null; + Iterator iterator = recordCollection.iterator(); + + while (iterator.hasNext()) { + recordEntry = (LogRecordEntry) iterator.next(); + printRecordEntry(recordEntry); + } + } + + public void printRecordEntry(LogRecordEntry rec) { + TestUtil.logMsg("*******Log Content*******"); + + TestUtil.logMsg("Milli Seconds =" + rec.getMilliSeconds()); + TestUtil.logMsg("Seqence no =" + rec.getSequenceNumber()); + TestUtil.logMsg("Message =" + rec.getMessage()); + if (rec.getClassName() != null) + TestUtil.logMsg("Class name =" + rec.getClassName()); + if (rec.getMethodName() != null) + TestUtil.logMsg("Method name =" + rec.getMethodName()); + if (rec.getLevel() != null) + TestUtil.logMsg("Level =" + rec.getLevel()); + if (rec.getThrown() != null) + TestUtil.logMsg("Thrown =" + rec.getThrown()); + TestUtil.logMsg(""); + } + + public String extractQueryToken(String str, String ContextId) { + StringTokenizer strtok; + String DELIMETER = "|"; + String qstring = null; + String qparams = null; + + strtok = new StringTokenizer(ContextId, DELIMETER); + if (ContextId.indexOf(DELIMETER) > 0) { + qstring = strtok.nextToken(); + if (strtok.hasMoreTokens()) + qparams = strtok.nextToken(); + } + + // return query string or query params based on the content + // of the string str + if (str.equals("LogQueryString")) + return qstring; + else + return qparams; + } + + // This method tokenize the given string and + // return first token and the remaining + // string a string array based on the given delimeter + public static String[] getTokens(String str, String delimeter) { + String[] array = new String[2]; + StringTokenizer strtoken; + + // Get first token and the remaining string + strtoken = new StringTokenizer(str, delimeter); + if (str.indexOf(delimeter) > 0) { + array[0] = strtoken.nextToken(); + array[1] = str.substring(array[0].length() + 3, str.length()); + } + + // TestUtil.logMsg("Input String ="+str); + // TestUtil.logMsg("array[0] ="+array[0]); + // TestUtil.logMsg("array[1] ="+array[1]); + return array; + } + + // + // Locates the logs based on the given prefix string + // + // For example to locate all commit records i.e records such as + // + // commit :: MyApp1058312446320 , recordTimeStamp=1058312446598 + // + // Use the following method to pull all the commit records + // + // fingLogsByPrefix("commit", nodes); + public Collection findLogsByPrefix(String queryParams, NodeList nodes) + throws Exception { + Collection recordCollection = new Vector(); + String nodeName; + String nodeValue; + Node childNode; + Node recordNode; + NodeList recordNodeChildren; + + for (int i = 0; i < nodes.getLength(); i++) { + // Take the first record + recordNode = nodes.item(i); + + // get all the child nodes for the first record + recordNodeChildren = recordNode.getChildNodes(); + + for (int j = 0; j < recordNodeChildren.getLength(); j++) { + childNode = recordNodeChildren.item(j); + nodeName = childNode.getNodeName(); + if (nodeName.equals("message")) { + nodeValue = getText(childNode); + if (nodeValue.startsWith(queryParams)) { + // create a new record entry and + // add it to the collection + LogRecordEntry recordEntry = new LogRecordEntry(recordNode); + + recordCollection.add(recordEntry); + } + } + } + } + return recordCollection; + } + + public String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + return result; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogRecordEntry.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogRecordEntry.java new file mode 100644 index 0000000..01bdec8 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/LogRecordEntry.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.util; + +import java.io.Serializable; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class LogRecordEntry implements Serializable { + + private long milliSeconds; + + private long sequenceNumber; + + private String level; + + private String className; + + private String methodName; + + private String message; + + private String thrown; + + public LogRecordEntry(Node recordNode) throws Exception { + if (!recordNode.getNodeName().equals("record")) { + throw new Exception("Unexpected tag :" + recordNode.getNodeName()); + } + NodeList nodes = recordNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + String childNode = node.getNodeName(); + + if (childNode.equals("millis")) { + milliSeconds = (new Long(getText(node))).longValue(); + + } else if (childNode.equals("sequence")) { + sequenceNumber = (new Long(getText(node))).longValue(); + + } else if (childNode.equals("level")) { + level = getText(node); + + } else if (childNode.equals("class")) { + className = getText(node); + + } else if (childNode.equals("method")) { + methodName = getText(node); + + } else if (childNode.equals("message")) { + message = getText(node); + + } else if (childNode.equals("exception")) { + thrown = getText(node); + + } + + } + } + + public long getMilliSeconds() { + return this.milliSeconds; + } + + public void setMilliSeconds(long milliSec) { + milliSeconds = milliSec; + } + + public long getSequenceNumber() { + return this.sequenceNumber; + } + + public void setSequenceNumber(long seqNum) { + sequenceNumber = seqNum; + } + + public String getMessage() { + return this.message; + } + + public void setMessage(String msg) { + message = msg; + } + + public String getLevel() { + return this.level; + } + + public void setLevel(String lvl) { + level = lvl; + } + + public String getClassName() { + return this.className; + } + + public void setClassName(String cName) { + className = cName; + } + + public String getMethodName() { + return this.methodName; + } + + public void setMethodName(String mName) { + methodName = mName; + } + + public String getThrown() { + return this.thrown; + } + + public void setThrown(String thrwn) { + thrown = thrwn; + } + + public String getText(Node textNode) { + String result = ""; + NodeList nodes = textNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + + if (node.getNodeType() == Node.TEXT_NODE) { + result = node.getNodeValue(); + break; + } + } + return result; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/WebServiceUtils.java b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/WebServiceUtils.java new file mode 100644 index 0000000..d136e5b --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/WebServiceUtils.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package com.sun.ts.tests.jaspic.util; + +import java.lang.reflect.Constructor; +import java.net.URL; + +import javax.xml.namespace.QName; + +import com.sun.ts.lib.util.TestUtil; + +/** + * + * @author Raja Perumal + */ +public class WebServiceUtils { + + public static Object getPort(URL wsdlurl, QName siName, Class siClass, + QName portName, Class seiClass) throws Exception { + TestUtil.logMsg("getPort(URL, QName, Class, QName, Class)"); + + jakarta.xml.ws.Service svc = (jakarta.xml.ws.Service) getService(wsdlurl, + siName, siClass); + TestUtil.logMsg("Get stub/proxy for seiClass -> " + seiClass.getName() + + ", port ->" + portName); + Object stub = null; + stub = svc.getPort(portName, seiClass); + if (stub == null) { + TestUtil.logErr( + "FATAL: getPort(URL, QName, Class, QName, Class) returned stub/proxy=null"); + } else + TestUtil.logMsg("Obtained stub/proxy=" + stub); + return stub; + } + + public static jakarta.xml.ws.Service getService(URL wsdlurl, QName siName, + Class siClass) throws Exception { + TestUtil.logMsg("getService(URL, QName, Class)"); + jakarta.xml.ws.Service service = null; + if (wsdlurl != null) + TestUtil.logMsg("URL=" + wsdlurl.toString()); + TestUtil.logMsg("siName=" + siName); + TestUtil.logMsg("siClass=" + siClass.getName()); + Constructor ctr = siClass.getConstructor(URL.class, QName.class); + service = (jakarta.xml.ws.Service) ctr.newInstance(wsdlurl, siName); + if (service == null) + TestUtil + .logErr("FATAL: getService(URL, QName, Class) returned service=null"); + return service; + } + +} diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/build.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/build.xml new file mode 100644 index 0000000..78f5b96 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/build.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/jaspic_util_web.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/jaspic_util_web.xml new file mode 100644 index 0000000..6b10483 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaspic/util/jaspic_util_web.xml @@ -0,0 +1,30 @@ + + + + + jaspic_util + + FetchLogs + com.sun.ts.tests.jaspic.util.FetchLogs + + + FetchLogs + /FetchLogs + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.jdk9.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.jdk9.xml new file mode 100644 index 0000000..56f6e92 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.jdk9.xml @@ -0,0 +1,1767 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.xml b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.xml new file mode 100644 index 0000000..7a41609 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/common.xml @@ -0,0 +1,1752 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/jakartaEE.tokens b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/jakartaEE.tokens new file mode 100644 index 0000000..2daa5b9 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/jakartaEE.tokens @@ -0,0 +1,2 @@ +WSRImport=import jakarta.jws.WebServiceRef; +WSRAnn= @WebServiceRef diff --git a/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/standalone.tokens b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/standalone.tokens new file mode 100644 index 0000000..e88b177 --- /dev/null +++ b/tck/old-tck/source/src/com/sun/ts/tests/jaxws/common/xml/standalone.tokens @@ -0,0 +1 @@ +WSRAnn= diff --git a/tck/old-tck/source/src/testsuite.jtd b/tck/old-tck/source/src/testsuite.jtd new file mode 100644 index 0000000..4bb2afe Binary files /dev/null and b/tck/old-tck/source/src/testsuite.jtd differ diff --git a/tck/old-tck/source/src/testsuite.jtt b/tck/old-tck/source/src/testsuite.jtt new file mode 100644 index 0000000..50dc1d5 --- /dev/null +++ b/tck/old-tck/source/src/testsuite.jtt @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# +name=Jakarta Authentication Compatibility Test Suite Version 2.0 +classpath=$TS_HOME/lib/tsharness.jar +testsuite=com.sun.ts.lib.harness.TS diff --git a/tck/old-tck/source/src/vehicle.properties b/tck/old-tck/source/src/vehicle.properties new file mode 100644 index 0000000..2a63419 --- /dev/null +++ b/tck/old-tck/source/src/vehicle.properties @@ -0,0 +1,51 @@ +# +# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# A properties file to determine whether a test directory is service test +# directory, and if so the vehicles in which the tests should be run. +# +# An entry key is a test directory relative to the testsutie root (i.e., +# ${TS_HOME}/src) with unix file separator (forward slash). An entry value +# is a list of vehilce names separated by a space. Althoug other reasonable +# delimiters may also work, a single space is recommended for consistency. +# Acceptable vehicle names are combinations of the following strings: +# ejb, servlet, jsp, appclient, and standalone. Each item may only appear +# once in one entry vale. +# +# For examples, some invalid entries: +# /files/ts/src/com/sun/ts/tests/samples/jdbc = ejb jsp servlet appclient +# com\sun\ts\tests\samples\jdbc = ejb jsp servlet appclient +# com\\sun\\ts\\tests\\samples\\jdbc = ejb jsp servlet appclient +# samples/jdbc = ejb jsp servlet appclient +# /com/sun/ts/tests/samples/jdbc = ejb servlet jsp appclient +# com/sun/ts/tests/samples/jdbc = ejb.servlet.jsp.appclient +# com/sun/ts/tests/samples/jdbc = ejb/servlet/jsp/appclient +# +# Entry order is insignificant. As a good practice, make the entry key +# (test directory) specific. For example, +# com/sun/ts/tests = ejb jsp servlet +# conveys to the harness that all tests under com/sun/ts/tests are service +# tests that should be run in 3 vehicles: ejb jsp servlet. +# +# This file may be modified for debugging purpose only. When testing for +# compatibility certification, the original version of this file must be +# used. Do NOT make modifications without maintaining a backup copy. +# + + + +com/sun/ts/tests/jaspic/spi/baseline = jaspicservlet +