コード例 #1
0
  @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);
  }