The manual solution is to edit the java.security file in $JAVA_HOME/jre/lib/security/java.security to contain the providers list in the order expected by Sun, however this may not be an option on your system (perhaps all java configuration files are locked down to read only permissions). In the case that you can't modify the java.security file directly you'll have to specify an alternate properties file for the JVM to use. This is as simple as passing the following JVM parameter to your test case launcher "-Djava.security.properties==
${path.to.ibm.jdk.security}", where ibm.jdk.security is your updated java.security file.
So how would one incorporate this into a maven based testing harness?
The below maven entry sets up a profile for IBM JDK and instructs the surefire test harness to use a provided java.security properties file. Please note that only when an IBM JDK is detected will the new java.security file be used.
<profiles>
<profile>
<id>ibmjdk</id>
<activation>
<property>
<name>java.vendor</name>
<value>IBM Corporation</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test*</include>
</includes>
<forkMode>pertest</forkMode>
<argLine>
-Djava.security.properties==
${path.to.test.resources}/ibm.jdk.security
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
You may have noticed something a little strange about the JVM parameter, the use of the double equality is intentional - if you use a single equals (=) then it appends your specified property file to the default property file, the double equality forces your specified configuration to be used.
Cheers,
No comments:
Post a Comment