/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
/*
To actually run this test, comment-out the <skipTests>true</skipTests> property in the pom.xml and run
mvn -Dtest=CreateSoapSTSDeploymentTest verify
from the command-line (other tests in the test-suite don't run successfully - hence the skipTests property.)
*/
public class CreateSoapSTSDeploymentTest {
private static final String SOAP_PROPERTY_FILE_AM_SESSION_COOKIE_NAME_KEY = "am_session_cookie_name";
private static final String SOAP_PROPERTY_FILE_SOAP_STS_AGENT_USERNAME_KEY = "soap_sts_agent_username";
private static final String SOAP_PROPERTY_FILE_JAR_ENTRY_NAME = "WEB-INF/classes/config.properties";
private static final boolean WITH_KEYSTORE_FILE = true;
private static final boolean WITH_CUSTOM_WSDL = true;
@Rule
inputWarFilePath = Paths.get("/com", "sun", "identity", "workflow", "slim-openam-soap-sts-server.war");
temporaryFolder = new TemporaryFolder();
}
@Test
}
@Test
public void testCustomJarFileGenerationWithKeystoreAndCustomWsdl() throws WorkflowException, IOException {
}
private void verifyGeneratedWarCorrectness(boolean withKeystoreFile, boolean withCustomWsdl) throws IOException {
try (JarInputStream jarInputStream = new JarInputStream(getClass().getResourceAsStream(inputWarFilePath.toString()))) {
assertEquals(getJarInputStreamEntryNames(jarInputStream), getNonAddedOutputWarFileEntryNames(outputWar));
if (withKeystoreFile) {
}
if (withCustomWsdl) {
}
}
}
}
}
InputStream fromWarInputStream = outputWar.getInputStream(outputWar.getJarEntry(WEB_INF_CLASSES + WSDL_FILE_NAMES_PARAM_VALUE))) {
}
}
return stringWriter.toString();
}
while (entryEnumeration.hasMoreElements()) {
/*
As we are testing for equality with the input .war, don't add the added keystore or custom wsdl files.
*/
continue;
}
}
return entryNames;
}
}
}
return entryNames;
}
/*
Load the config.properties file in the generated .war file and insure that its values match those passed into the
workflow task (which are in turn, harvested from the ViewBean)
*/
try (InputStream outputWarPropertiesFileInputStream = outputWar.getInputStream(outputWar.getJarEntry(SOAP_PROPERTY_FILE_JAR_ENTRY_NAME))) {
assertEquals(warProperties.getProperty(SOAP_PROPERTY_FILE_AM_DEPLOYMENT_URL_KEY), OPENAM_URL_PARAM_VALUE);
assertEquals(warProperties.getProperty(SOAP_PROPERTY_FILE_AM_SESSION_COOKIE_NAME_KEY), AM_SESSION_COOKIE_NAME);
assertEquals(warProperties.getProperty(SOAP_PROPERTY_FILE_SOAP_STS_AGENT_USERNAME_KEY), SOAP_AGENT_NAME_PARAM_VALUE);
}
}
@SuppressWarnings("unchecked")
if (withKeystoreFile) {
}
if (withCustomWsdl) {
}
return paramMap;
}
/*
Subclass of the CreateSoapSTSDeployment which will provide the Jar Input/Output stream, and the getAMSessionIdCookieNameForDeployment
values. The former is necessary to test generated war file correctness, and the latter is necessary because the test context
does not have an initialized SystemPropertiesManager.
*/
try {
} catch (IOException e) {
throw new WorkflowException("error opening test resource .war file: " + e);
}
}
protected JarOutputStream getJarOutputStream(Path outputWarFilePath, Manifest inputWarManifest) throws WorkflowException {
try {
return new JarOutputStream(Files.newOutputStream(outputWarFilePath, StandardOpenOption.WRITE), inputWarManifest);
} catch (IOException e) {
throw new WorkflowException("could not create output .war file: " + e);
}
}
return outputWarFile.toPath();
}
return "bobo";
}
return AM_SESSION_COOKIE_NAME;
}
protected InputStream getInputStreamForKeystoreFileOrCustomWsdlFile(String fileName) throws IOException {
}
throw new IllegalStateException("Unexpected fileName parameter in " +
"MyCreateSoapSTSDeployment#getInputStreamForKeystoreFileOrCustomWsdlFile: " + fileName);
}
}
}