コード例 #1
0
 /**
  * Verify that injecting non existing exceptions is flagged with an exception.
  *
  * @throws Exception
  */
 public void testInjectingNonExistingComponent() throws Exception {
   Map<String, Object> attributes = Maps.newHashMap();
   Appendable out = new StringBuffer();
   Integration integration = service.createIntegration("", Mode.UTEST, true, null);
   try {
     integration.injectComponent("foo:bared", attributes, "", "", out);
     fail(
         "Instantiating component through integration service should have failed because of missing component def.");
   } catch (DefinitionNotFoundException expected) {
     // Expected exception
     assertTrue(expected.getMessage().contains("No COMPONENT named markup://foo:bared found"));
   }
 }
コード例 #2
0
 /** Verify that only component defs can be injected. */
 public void testInjectingApplications() throws Exception {
   String validApp = "test:laxSecurity";
   Map<String, Object> attributes = Maps.newHashMap();
   Appendable out = new StringBuffer();
   Integration integration = service.createIntegration("", Mode.UTEST, true, null);
   try {
     integration.injectComponent(validApp, attributes, "", "", out);
     fail("Injecting an application through integration service should have failed.");
   } catch (DefinitionNotFoundException expected) {
     // TODO: Maybe a better error message?
     assertTrue(
         expected.getMessage().contains("No COMPONENT named markup://test:laxSecurity found"));
   }
 }