Skip to content

Commit

Permalink
Merge pull request #9 from cunningt/fixfailures
Browse files Browse the repository at this point in the history
Fixfailures
  • Loading branch information
cunningt committed Aug 22, 2013
2 parents c55e2c8 + bdacb6c commit e4f8b4e
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,16 @@ public void testAddPolicy() throws Exception
switchYard.getSwitchYardConfig().getComposite().addComponent(noReferenceComponent);
switchYard.saveConfig();

Policy managedTransLocal = PolicyFactory.getPolicy("managedTransaction.Local");
Assert.assertEquals(TransactionPolicy.MANAGED_TRANSACTION_LOCAL, managedTransLocal);
//Assert.assertTrue(managedTransLocal.supports(PolicyType.IMPLEMENTATION));
// Add to Implementation
switchYardConfigurator.addPolicy(project, "TestComponent", managedTransLocal, "Implementation",
reference);
switchYardConfigurator.addPolicy(project, "TestComponent", PolicyFactory.getAvailableImplementationPolicies().toArray(new Policy[0])[0],
"Implementation", reference);

Policy propogatesTrans = PolicyFactory.getPolicy("propagatesTransaction");
Assert.assertEquals(TransactionPolicy.PROPAGATES_TRANSACTION, propogatesTrans);
//Assert.assertTrue(propogatesTrans.supports(PolicyType.INTERACTION));
// Add to Interaction
switchYardConfigurator.addPolicy(project, "TestComponent", propogatesTrans, "Service",
switchYardConfigurator.addPolicy(project, "TestComponent", PolicyFactory.getAvailableInteractionPolicies().toArray(new Policy[0])[0], "Service",
reference);

boolean caughtException = false;
Expand All @@ -218,12 +216,12 @@ public void testAddPolicy() throws Exception
} catch (IllegalArgumentException iae) {
caughtException = true;
}
switchYardConfigurator.addPolicy(project, "TestComponent", propogatesTrans, "Reference", reference);
switchYardConfigurator.addPolicy(project, "TestComponent", PolicyFactory.getAvailableInteractionPolicies().toArray(new Policy[0])[1], "Reference", reference);

// Verify generated policies
component = switchYard.getSwitchYardConfig().getComposite().getComponents().get(0);
Assert.assertEquals(PolicyFactory.getAvailableInteractionPolicies().toArray(new Policy[0])[0].getName(), component.getServices().get(0).getPolicyRequirements().iterator().next());
Assert.assertEquals(PolicyFactory.getAvailableImplementationPolicies().toArray(new Policy[0])[0].getName(), component.getImplementation().getPolicyRequirements().iterator().next());
Assert.assertEquals(PolicyFactory.getAvailableInteractionPolicies().toArray(new Policy[0])[0].getName(), component.getServices().get(0).getPolicyRequirements().iterator().next());
Assert.assertEquals(PolicyFactory.getAvailableInteractionPolicies().toArray(new Policy[0])[1].getName(), component.getReferences().get(0).getPolicyRequirements().iterator().next());
}

Expand Down

0 comments on commit e4f8b4e

Please sign in to comment.