Java Code Examples for org.jboss.as.subsystem.test.KernelServices#getPersistedSubsystemXml()

The following examples show how to use org.jboss.as.subsystem.test.KernelServices#getPersistedSubsystemXml() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 *  Parses and marshall the given subsystemXmlFile into one controller, then reads the model into second one.
 *  Compares the models afterwards.
 * @param subsystemXmlFile the name of the subsystem xml file
 * @throws Exception
 */
protected void parseAndMarshalSubsystemModelFromFile(String subsystemXmlFile) throws Exception {
  String subsystemXml = FileUtils.readFile(subsystemXmlFile);
  // Parse the subsystem xml and install into the first controller
  KernelServices servicesA = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
  // Get the model and the persisted xml from the first controller
  ModelNode modelA = servicesA.readWholeModel();
  String marshalled = servicesA.getPersistedSubsystemXml();

  // Make sure the xml is the same
  compareXml(null, subsystemXml, marshalled);

  // Install the persisted xml from the first controller into a second controller
  KernelServices servicesB = createKernelServicesBuilder(null).setSubsystemXml(marshalled).build();
  ModelNode modelB = servicesB.readWholeModel();

  // Make sure the models from the two controllers are identical
  compare(modelA, modelB);
}
 
Example 2
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testParseAndMarshalModelWithRemoteConnectorRef1_1() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_1.getUriString() + "\">" +
            "<remoting-connector/> " +
            "</subsystem>";


    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 3
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemXmlWithEnginesAndJobExecutor() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_AND_JOB_EXECUTOR);

  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();
  ServiceContainer container = services.getContainer();

  commonSubsystemServicesAreInstalled(container);
  assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));
  assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));

  String persistedSubsystemXml = services.getPersistedSubsystemXml();
  compareXml(null, subsystemXml, persistedSubsystemXml);
}
 
Example 4
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemWithSingleEngineXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_SINGLE_ENGINE);

  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();
  ServiceContainer container = services.getContainer();

  assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
  assertNotNull("process engine service should be bound in JNDI", container.getService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));

  assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));

  String persistedSubsystemXml = services.getPersistedSubsystemXml();
  compareXml(null, subsystemXml, persistedSubsystemXml);
}
 
Example 5
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
  public void testInstallSubsystemXmlWithEnginesAndJobExecutor() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_AND_JOB_EXECUTOR);
//    System.out.println(normalizeXML(subsystemXml));
    KernelServices services = createKernelServicesBuilder(null)
        .setSubsystemXml(subsystemXml)
        .build();
    ServiceContainer container = services.getContainer();
//    container.dumpServices();

    assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
    assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

    assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));
    assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));


    String persistedSubsystemXml = services.getPersistedSubsystemXml();
//    System.out.println(persistedSubsystemXml);
    compareXml(null, subsystemXml, persistedSubsystemXml);
  }
 
Example 6
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemWithSingleEngineXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_SINGLE_ENGINE);

  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();
  ServiceContainer container = services.getContainer();

  assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
  assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

  assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));

  String persistedSubsystemXml = services.getPersistedSubsystemXml();
  compareXml(null, subsystemXml, persistedSubsystemXml);
}
 
Example 7
Source File: SimpleSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Tests that we can trigger output of the model, i.e. that outputModel() works as it should
 */
@Test
public void testOutputModel() throws Exception {
    String subsystemXml =
            "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
            "</subsystem>";

    ModelNode testModel = new ModelNode();
    testModel.get(SUBSYSTEM).get(SimpleSubsystemExtension.SUBSYSTEM_NAME).setEmptyObject();
    String triggered = outputModel(testModel);

    KernelServices services = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT)
            .setSubsystemXml(subsystemXml)
            .build();
    //Get the model and the persisted xml from the controller
    services.readWholeModel();
    String marshalled = services.getPersistedSubsystemXml();

    Assert.assertEquals(marshalled, triggered);
    Assert.assertEquals(normalizeXML(marshalled), normalizeXML(triggered));
}
 
Example 8
Source File: SimpleSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Starts a controller with a given subsystem xml and then checks that a second
 * controller started with the xml marshalled from the first one results in the same model
 */
@Test
public void testParseAndMarshalModel() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
            "</subsystem>";
    KernelServices servicesA = createKernelServicesBuilder(null)
            .setSubsystemXml(subsystemXml)
            .build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(null)
            .setSubsystemXml(marshalled)
            .build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 9
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshallModelWithAuditLogAndHandlerReferences() throws Exception {
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\" proper-property-format=\"false\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "   <audit-log log-boot=\"true\" log-read-only=\"false\" enabled=\"false\">" +
            "       <handlers>" +
            "               <handler name=\"test\"/>" +
            "       </handlers>" +
            "   </audit-log>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new AuditLogInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    Assert.assertTrue(servicesA.isSuccessfulBoot());
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    Assert.assertTrue(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED).hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT));
    Assert.assertFalse(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED, CommonAttributes.PROPER_PROPERTY_FORMAT).asBoolean());
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 10
Source File: ExtraSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Starts a controller with a given subsystem xml and then checks that a second
 * controller started with the xml marshalled from the first one results in the same model
 */
@Test
public void testParseAndMarshalModel() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + DependencySubsystemExtension.NAMESPACE + "\">" +
            "</subsystem>" +
            "<subsystem xmlns=\"" + MainSubsystemExtension.NAMESPACE + "\">" +
            "</subsystem>";
    KernelServices servicesA = createKernelServicesBuilder(new DependencyAdditionalInitialization())
            .setSubsystemXml(subsystemXml)
            .build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    marshalled = "<subsystem xmlns=\"" + DependencySubsystemExtension.NAMESPACE + "\">" +
            "</subsystem>" + marshalled;

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(new DependencyAdditionalInitialization())
            .setSubsystemXml(marshalled)
            .build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 11
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_0() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_0.getUriString() + "\">" +
            "    <jmx-connector registry-binding=\"registry1\" server-binding=\"server1\" />" +
            "</subsystem>";
    String finishedSubsystemXml =
                    "<subsystem xmlns=\"" + Namespace.JMX_1_0.getUriString() + "\"/>";
    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));

    compareXml(null, finishedSubsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 12
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshallModelWithAuditLogButNoHandlerReferences() throws Exception {
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\" proper-property-format=\"false\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "   <audit-log log-boot=\"true\" log-read-only=\"false\" enabled=\"false\"/>" +
            "   <sensitivity non-core-mbeans=\"true\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    Assert.assertTrue(servicesA.isSuccessfulBoot());
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    Assert.assertTrue(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED).hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT));
    Assert.assertFalse(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED, CommonAttributes.PROPER_PROPERTY_FORMAT).asBoolean());
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 13
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_3WithShowModelsAndOldPropertyFormat() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_3.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\" proper-property-format=\"false\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "   <sensitivity non-core-mbeans=\"true\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    Assert.assertTrue(servicesA.isSuccessfulBoot());
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    Assert.assertTrue(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED).hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT));
    Assert.assertFalse(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED, CommonAttributes.PROPER_PROPERTY_FORMAT).asBoolean());
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 14
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_3WithShowModels() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_3.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 15
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_2WithShowModelsAndOldPropertyFormat() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_2.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\" proper-property-format=\"false\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    Assert.assertTrue(servicesA.isSuccessfulBoot());
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    Assert.assertTrue(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED).hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT));
    Assert.assertFalse(modelA.get(SUBSYSTEM, "jmx", CommonAttributes.EXPOSE_MODEL, CommonAttributes.RESOLVED, CommonAttributes.PROPER_PROPERTY_FORMAT).asBoolean());
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 16
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_2WithShowModels() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_2.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.RESOLVED\"/>" +
            "   <expose-expression-model domain-name=\"jboss.EXPRESSION\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, subsystemXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 17
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_1() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_1.getUriString() + "\">" +
            "<show-model value=\"true\"/>" +
            "<remoting-connector/>" +
            "</subsystem>";

    String finishedXml =
            "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" +
            "    <expose-resolved-model proper-property-format=\"false\"/>" +
            "    <remoting-connector/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, finishedXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 18
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParseAndMarshalModel1_1WithShowModel() throws Exception {
    //Parse the subsystem xml and install into the first controller
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.JMX_1_1.getUriString() + "\">" +
            "<show-model value=\"true\"/>" +
            "</subsystem>";

    String finishedXml =
            "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" +
            "    <expose-resolved-model proper-property-format=\"false\"/>" +
            "</subsystem>";

    AdditionalInitialization additionalInit = new BaseAdditionalInitialization();

    KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
    //Get the model and the persisted xml from the first controller
    ModelNode modelA = servicesA.readWholeModel();
    String marshalled = servicesA.getPersistedSubsystemXml();
    servicesA.shutdown();

    Assert.assertTrue(marshalled.contains(Namespace.CURRENT.getUriString()));
    compareXml(null, finishedXml, marshalled, true);

    //Install the persisted xml from the first controller into a second controller
    KernelServices servicesB = createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
    ModelNode modelB = servicesB.readWholeModel();

    //Make sure the models from the two controllers are identical
    super.compare(modelA, modelB);
}
 
Example 19
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void testInstallSubsystemXmlWithEnginePropertiesPluginsAndJobExecutorWithExpressions() throws Exception {
  System.getProperties().putAll(EXPRESSION_PROPERTIES);
  try {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_PROPERTIES_PLUGINS_AND_JOB_EXECUTOR_WITH_EXPRESSIONS);
    KernelServices services = createKernelServicesBuilder(null)
        .setSubsystemXml(subsystemXml)
        .build();
    ServiceContainer container = services.getContainer();

    assertNotNull("platform service should be installed", container.getRequiredService(PLATFORM_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getRequiredService(processEngineServiceBindingServiceName));

    ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__test"));

    assertNotNull("process engine controller for engine __test is installed ", defaultEngineService);

    ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
    Map<String, String> configurationProperties = metadata.getConfigurationProperties();
    assertEquals("default", configurationProperties.get("job-acquisition-name"));

    Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
    assertTrue(foxLegacyProperties.isEmpty());

    assertNotNull("process engine controller for engine __test is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")));

    // check we have parsed the plugin configurations
    List<ProcessEnginePluginXml> pluginConfigurations = metadata.getPluginConfigurations();
    
    assertEquals(1, pluginConfigurations.size());

    ProcessEnginePluginXml processEnginePluginXml = pluginConfigurations.get(0);
    assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.getPluginClass());
    Map<String, String> processEnginePluginXmlProperties = processEnginePluginXml.getProperties();
    assertEquals("abc", processEnginePluginXmlProperties.get("test"));
    assertEquals("123", processEnginePluginXmlProperties.get("number"));
    assertEquals("true", processEnginePluginXmlProperties.get("bool"));
    
    String persistedSubsystemXml = services.getPersistedSubsystemXml();
    compareXml(null, subsystemXml, persistedSubsystemXml);
    
  } finally {
    for (String key : EXPRESSION_PROPERTIES.keySet()) {
      System.clearProperty(key);
    }
  }
}