|
106 | 106 | </fileset>
|
107 | 107 | </javadoc>
|
108 | 108 | </target>
|
109 |
| - |
| 109 | + |
| 110 | + <target name="detect-ssl"> |
| 111 | + <property environment="env"/> |
| 112 | + <property name="SSL_CERTS_DIR" value="${env.SSL_CERTS_DIR}"/> |
| 113 | + <available property="SSL_AVAILABLE" file="${SSL_CERTS_DIR}/client"/> |
| 114 | + <property name="CLIENT_KEYSTORE_PHRASE" value="bunnies"/> |
| 115 | + <property environment="env"/> |
| 116 | + <property name="SSL_P12_PASSWORD" value="${env.PASSWORD}"/> |
| 117 | + </target> |
| 118 | + |
| 119 | + <target name="make-client-keystore" if="SSL_AVAILABLE" depends="detect-ssl"> |
| 120 | + <exec executable="mktemp" outputproperty="CLIENT_KEYSTORE" failonerror="true" osfamily="unix"> |
| 121 | + <arg value="-u"/> |
| 122 | + </exec> |
| 123 | + <exec executable="keytool" failonerror="true" osfamily="unix"> |
| 124 | + <arg line="-import"/> |
| 125 | + <arg value="-alias"/> |
| 126 | + <arg value="server1"/> |
| 127 | + <arg value="-file"/> |
| 128 | + <arg value="${SSL_CERTS_DIR}/testca/cacert.pem"/> |
| 129 | + <arg value="-keystore"/> |
| 130 | + <arg value="${CLIENT_KEYSTORE}"/> |
| 131 | + <arg value="-noprompt"/> |
| 132 | + <arg value="-storepass"/> |
| 133 | + <arg value="${CLIENT_KEYSTORE_PHRASE}"/> |
| 134 | + </exec> |
| 135 | + <exec executable="mktemp" outputproperty="CLIENT_KEYSTORE_EMPTY" failonerror="true" osfamily="unix"> |
| 136 | + <arg value="-u"/> |
| 137 | + </exec> |
| 138 | + <!-- can't create an empty keystore, so add cert in and then delete it! --> |
| 139 | + <exec executable="keytool" failonerror="true" osfamily="unix"> |
| 140 | + <arg line="-import"/> |
| 141 | + <arg value="-alias"/> |
| 142 | + <arg value="server1"/> |
| 143 | + <arg value="-file"/> |
| 144 | + <arg value="${SSL_CERTS_DIR}/testca/cacert.pem"/> |
| 145 | + <arg value="-keystore"/> |
| 146 | + <arg value="${CLIENT_KEYSTORE_EMPTY}"/> |
| 147 | + <arg value="-noprompt"/> |
| 148 | + <arg value="-storepass"/> |
| 149 | + <arg value="${CLIENT_KEYSTORE_PHRASE}"/> |
| 150 | + </exec> |
| 151 | + <exec executable="keytool" failonerror="true" osfamily="unix"> |
| 152 | + <arg line="-delete"/> |
| 153 | + <arg value="-alias"/> |
| 154 | + <arg value="server1"/> |
| 155 | + <arg value="-keystore"/> |
| 156 | + <arg value="${CLIENT_KEYSTORE_EMPTY}"/> |
| 157 | + <arg value="-storepass"/> |
| 158 | + <arg value="${CLIENT_KEYSTORE_PHRASE}"/> |
| 159 | + </exec> |
| 160 | + </target> |
| 161 | + |
| 162 | + <target name="remove-client-keystore" if="SSL_AVAILABLE"> |
| 163 | + <delete file="${CLIENT_KEYSTORE}" failonerror="false"/> |
| 164 | + <delete file="${CLIENT_KEYSTORE_EMPTY}" failonerror="false"/> |
| 165 | + </target> |
| 166 | + |
110 | 167 | <target name="test-prepare">
|
111 | 168 | <property name="haltOnFailureJunit" value="yes" />
|
112 | 169 | <property name="haltOnFailureJava" value="true" />
|
|
261 | 318 | </fail>
|
262 | 319 | </target>
|
263 | 320 |
|
264 |
| - <target name="test-suite-run" depends="test, test-persister-restart, test-functional, test-main-silent"/> |
| 321 | + <target name="test-suite-run" depends="test, test-ssl, test-persister-restart, test-functional, test-main-silent"/> |
265 | 322 |
|
266 | 323 | <target name="test" depends="test-build">
|
267 | 324 | <junit printSummary="withOutAndErr"
|
|
276 | 333 | </junit>
|
277 | 334 | </target>
|
278 | 335 |
|
| 336 | + <target name="test-ssl" depends="test-build, make-client-keystore" if="SSL_AVAILABLE"> |
| 337 | + <junit printSummary="withOutAndErr" |
| 338 | + haltOnFailure="${haltOnFailureJunit}" |
| 339 | + failureproperty="test.failure" |
| 340 | + fork="yes"> |
| 341 | + <classpath refid="test.classpath"/> |
| 342 | + <jvmarg value="-Dkeystore.path=${CLIENT_KEYSTORE}"/> |
| 343 | + <jvmarg value="-Dkeystore.empty.path=${CLIENT_KEYSTORE_EMPTY}"/> |
| 344 | + <jvmarg value="-Dkeystore.passwd=${CLIENT_KEYSTORE_PHRASE}"/> |
| 345 | + |
| 346 | + <jvmarg value="-Dp12.path=${SSL_CERTS_DIR}/client/keycert.p12"/> |
| 347 | + <jvmarg value="-Dp12.passwd=${SSL_P12_PASSWORD}"/> |
| 348 | + |
| 349 | + <formatter type="plain"/> |
| 350 | + <formatter type="xml"/> |
| 351 | + <test todir="${build.out}" name="com.rabbitmq.client.test.ssl.SSLTests"/> |
| 352 | + </junit> |
| 353 | + <antcall target="remove-client-keystore"/> |
| 354 | + </target> |
| 355 | + |
279 | 356 | <target name="test-functional" depends="test-build">
|
280 | 357 | <junit printSummary="withOutAndErr"
|
281 | 358 | haltOnFailure="${haltOnFailureJunit}"
|
|
0 commit comments