@Test
  public void testParseSubsystemWithBadChild() throws Exception {
    // try parsing a XML with an invalid element.
    String subsystemXml =
        "<subsystem xmlns=\""
            + JacORBSubsystemParser.Namespace.CURRENT.getUriString()
            + "\">"
            + "   <invalid/>"
            + "</subsystem>";
    try {
      super.parse(subsystemXml);
      Assert.fail("Should not have parsed bad child");
    } catch (XMLStreamException expected) {
    }

    // now try parsing a valid element in an invalid position.
    subsystemXml =
        "<subsystem xmlns=\"urn:jboss:domain:jacorb:1.0\">"
            + "    <orb name=\"JBoss\" print-version=\"off\">"
            + "        <poa/>"
            + "    </orb>"
            + "</subsystem>";
    try {
      super.parse(subsystemXml);
      Assert.fail("Should not have parsed bad child");
    } catch (XMLStreamException expected) {
    }
  }
 @Test
 public void testParseSubsystemWithBadAttribute() throws Exception {
   String subsystemXml =
       "<subsystem xmlns=\""
           + JacORBSubsystemParser.Namespace.CURRENT.getUriString()
           + "\" bad=\"very_bad\">"
           + "</subsystem>";
   try {
     super.parse(subsystemXml);
     Assert.fail("Should not have parsed bad attribute");
   } catch (XMLStreamException expected) {
   }
 }
 @Test
 public void testParseSubsystemWithBadInitializer_1_0() throws Exception {
   // try parsing a XML with an invalid element.
   String subsystemXml =
       "<subsystem xmlns=\""
           + JacORBSubsystemParser.Namespace.CURRENT.getUriString()
           + "\">"
           + "   <initializers>invalid</initializers>"
           + "</subsystem>";
   try {
     super.parse(subsystemXml);
     Assert.fail("Should not have parsed bad initializer");
   } catch (XMLStreamException expected) {
   }
 }
  @Test
  public void testDescribeHandler() throws Exception {
    // parse the subsystem xml and install into the first controller.
    String subsystemXml =
        "<subsystem xmlns=\""
            + JacORBSubsystemParser.Namespace.CURRENT.getUriString()
            + "\">"
            + "</subsystem>";

    AdditionalInitialization additionalInit =
        new AdditionalInitialization() {
          @Override
          protected void setupController(ControllerInitializer controllerInitializer) {
            controllerInitializer.addSocketBinding("jacorb", 3528);
            controllerInitializer.addSocketBinding("jacorb-ssl", 3529);
          }
        };

    KernelServices servicesA = super.installInController(additionalInit, subsystemXml);
    // get the model and the describe operations from the first controller.
    ModelNode modelA = servicesA.readWholeModel();
    ModelNode describeOp = new ModelNode();
    describeOp.get(OP).set(DESCRIBE);
    describeOp
        .get(OP_ADDR)
        .set(
            PathAddress.pathAddress(
                    PathElement.pathElement(SUBSYSTEM, JacORBExtension.SUBSYSTEM_NAME))
                .toModelNode());
    List<ModelNode> operations =
        super.checkResultAndGetContents(servicesA.executeOperation(describeOp)).asList();
    servicesA.shutdown();

    Assert.assertEquals(1, operations.size());

    // install the describe options from the first controller into a second controller.
    KernelServices servicesB = super.installInController(additionalInit, operations);
    ModelNode modelB = servicesB.readWholeModel();
    servicesB.shutdown();

    // make sure the models from the two controllers are identical.
    super.compare(modelA, modelB);
  }
 @Override
 protected void compareXml(String configId, String original, String marshalled) throws Exception {
   super.compareXml(configId, original, marshalled, true);
 }