Deal with a couple of cases where the order of results differs depending on whether I'm on the IBM or Oracle JDK.

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1201712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
slaws 2011-11-14 14:08:48 +00:00
parent 4bf0a7052b
commit c53c843b6f
2 changed files with 35 additions and 12 deletions

View file

@ -386,7 +386,7 @@ public class JMSBindingProcessorWriteTestCase extends TestCase {
}
// TUSCANY-3120
// Checking we don't write out values unless the use has specified them on input
// Checking we don't write out values unless the user has specified them on input
public void testDefault() throws Exception {
XMLStreamReader reader =
inputFactory.createXMLStreamReader(new StringReader(DEFAULT));
@ -397,7 +397,10 @@ public class JMSBindingProcessorWriteTestCase extends TestCase {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), context);
System.out.println(bos.toString());
String outputString = bos.toString();
System.out.println(outputString);
/* replace with slightly different test so any ordering differences in written
* XML don't fail the test
assertEquals(bos.toString(),
"<?xml version=\'1.0\' encoding=\'UTF-8\'?>" +
"<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">" +
@ -413,6 +416,24 @@ public class JMSBindingProcessorWriteTestCase extends TestCase {
"</service>" +
"</component>" +
"</composite>");
*/
assertEquals(true, outputString.contains("binding.jms"));
assertEquals(true, outputString.contains("operationProperties"));
assertEquals(true, outputString.contains("destination"));
assertEquals(true, outputString.contains("jndiName"));
assertEquals(true, outputString.contains("type"));
assertEquals(true, outputString.contains("property"));
assertEquals(true, outputString.contains("connectionFactory"));
assertEquals(true, outputString.contains("resourceAdapter"));
assertEquals(false, outputString.contains("headers"));
assertEquals(false, outputString.contains("response"));
assertEquals(false, outputString.contains("activationSpec"));
assertEquals(false, outputString.contains("messageSelection"));
assertEquals(false, outputString.contains("initialContextFactory"));
assertEquals(false, outputString.contains("correlationScheme"));
assertEquals(false, outputString.contains("wireFormat"));
assertEquals(false, outputString.contains("operationSelector"));
}
public void testOperationPropertiesName() throws Exception {

View file

@ -177,26 +177,30 @@ public class PolicyProcessorTestCase extends TestCase {
}
public void testSingleInterfaceWithRolesAllowedAtMethodLevel() throws Exception {
runProcessors(Service4.class, Service4.class.getMethods()[1], type);
Operation op = getOperationModel(Service4.class.getMethods()[1], type);
Method aMethod = Service4.class.getDeclaredMethod("method2");
runProcessors(Service4.class, aMethod, type);
Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithPermitAllAtMethodLevel() throws Exception {
runProcessors(Service4.class, Service4.class.getMethods()[2], type);
Operation op = getOperationModel(Service4.class.getMethods()[2], type);
Method aMethod = Service4.class.getDeclaredMethod("method3");
runProcessors(Service4.class, aMethod, type);
Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithDenyAllAtMethodLevel() throws Exception {
runProcessors(Service4.class, Service4.class.getMethods()[3], type);
Operation op = getOperationModel(Service4.class.getMethods()[3], type);
Method aMethod = Service4.class.getDeclaredMethod("method4");
runProcessors(Service4.class, aMethod, type);
Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithNothingAtMethodLevel() throws Exception {
runProcessors(Service4.class, Service4.class.getMethods()[0], type);
Operation op = getOperationModel(Service4.class.getMethods()[0], type);
Method aMethod = Service4.class.getDeclaredMethod("method1");
runProcessors(Service4.class, aMethod, type);
Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(0, op.getPolicySets().size());
}
@ -210,13 +214,11 @@ public class PolicyProcessorTestCase extends TestCase {
}
private Operation getOperationModel(Method method, JavaImplementation type){
for(Operation op : type.getOperations()){
if (((JavaOperation)op).getJavaMethod().equals(method)){
return op;
}
}
return null;
}
}