diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java b/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java index 5fdbd57338..15f3bcca6e 100644 --- a/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java @@ -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(), "" + "" + @@ -413,6 +416,24 @@ public class JMSBindingProcessorWriteTestCase extends TestCase { "" + "" + ""); + */ + 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 { diff --git a/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java b/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java index b6bd00e345..de8e0ccacf 100644 --- a/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java +++ b/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java @@ -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; } }