Esempio n. 1
0
 public void handleNotification(Notification arg0, Object arg1) {
   // check notifications serializable.
   try {
     if (!(arg0.getSource() instanceof ObjectName)) {
       throw new ClassCastException("Doh!");
     }
     Notification copy = OddjobTestHelper.copy(arg0);
     if (!(copy.getSource() instanceof ObjectName)) {
       throw new ClassCastException("Doh!");
     }
   } catch (Exception e) {
     logger.error("Notification Listener failed.", e);
     throw new RuntimeException(e);
   }
   Pair p = new Pair(arg0, arg1);
   notifications.add(p);
 }
Esempio n. 2
-1
  public void testCreate() throws ArooaParseException {

    OurDirs dirs = new OurDirs();

    File testFile = dirs.relative("work/test.txt");

    String xml =
        "<echo name='Test' ><![CDATA[Hello]]>"
            + " <output>"
            + "  <file file='"
            + testFile.getPath()
            + "'/>"
            + " </output>"
            + "</echo>";

    ArooaDescriptor descriptor =
        new OddjobDescriptorFactory().createDescriptor(getClass().getClassLoader());

    DesignParser parser = new DesignParser(new StandardArooaSession(descriptor));
    parser.setArooaType(ArooaType.COMPONENT);

    parser.parse(new XMLConfiguration("TEST", xml));

    design = parser.getDesign();

    assertEquals(EchoDesign.class, design.getClass());

    DynaBean test =
        (DynaBean)
            OddjobTestHelper.createComponentFromConfiguration(
                design.getArooaContext().getConfigurationNode());

    assertEquals("Test", test.get("name"));
    assertEquals("Hello", test.get("text"));
  }