Search in sources :

Example 21 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class DataSourceTestCase method testModifyXaDataSource.

private void testModifyXaDataSource() throws Exception {
    StringBuilder cmd = new StringBuilder("xa-data-source --name=TestXADS");
    for (String[] props : DS_PROPS) {
        cmd.append(" --");
        cmd.append(props[0]);
        cmd.append("=");
        cmd.append(props[1]);
    }
    cli.sendLine(cmd.toString());
    // check that datasource was modified
    cli.sendLine("/subsystem=datasources/xa-data-source=TestXADS:read-resource(recursive=true)");
    CLIOpResult result = cli.readAllAsOpResult();
    assertTrue(result.isIsOutcomeSuccess());
    assertTrue(result.getResult() instanceof Map);
    Map<String, Object> dsProps = (Map<String, Object>) result.getResult();
    for (String[] props : DS_PROPS) assertTrue(dsProps.get(props[0]).equals(props[1]));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Map(java.util.Map)

Example 22 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class ObjectStoreTypeTestCase method readObjectStoreType.

private String readObjectStoreType() throws IOException, MgmtOperationException {
    cli.sendLine("/subsystem=transactions/log-store=log-store:read-attribute(name=type)");
    final CLIOpResult res = cli.readAllAsOpResult();
    return (String) res.getResult();
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult)

Example 23 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class ObjectStoreTypeTestCase method testEitherJdbcOrJournalStore.

@Test
public void testEitherJdbcOrJournalStore() throws Exception {
    try {
        String objectStoreType = readObjectStoreType();
        assertEquals("default", objectStoreType);
        createDataSource();
        // set jdbc-store-datasource so that use-jdbc-store can be set to true
        cli.sendLine("/subsystem=transactions:write-attribute(name=jdbc-store-datasource, value=java:jboss/datasources/ObjectStoreTestDS)");
        CLIOpResult result = cli.readAllAsOpResult();
        assertTrue("Failed to set jdbc-store-datasource.", result.isIsOutcomeSuccess());
        // set use-jdbc-store to true
        cli.sendLine("/subsystem=transactions:write-attribute(name=use-jdbc-store, value=true)");
        result = cli.readAllAsOpResult();
        assertTrue("Failed to set use-jdbc-store to true.", result.isIsOutcomeSuccess());
        // set use-journal-store to true
        cli.sendLine("/subsystem=transactions:write-attribute(name=use-journal-store, value=true)");
        result = cli.readAllAsOpResult();
        assertTrue("Failed to set use-journal-store to true.", result.isIsOutcomeSuccess());
        // check that use-jdbc-store was automatically set to false
        cli.sendLine("/subsystem=transactions:read-attribute(name=use-jdbc-store)");
        result = cli.readAllAsOpResult();
        assertEquals("use-jdbc-store was not automatically deactivated.", "false", result.getResult());
        // set use-jdbc-store to true
        cli.sendLine("/subsystem=transactions:write-attribute(name=use-jdbc-store, value=true)");
        result = cli.readAllAsOpResult();
        assertTrue("Failed to set use-journal-store to true.", result.isIsOutcomeSuccess());
        // check that use-journal-store was automatically set to false
        cli.sendLine("/subsystem=transactions:read-attribute(name=use-journal-store)");
        result = cli.readAllAsOpResult();
        assertEquals("use-journal-store was not automatically deactivated.", "false", result.getResult());
        // set use-jdbc-store to false
        cli.sendLine("/subsystem=transactions:write-attribute(name=use-jdbc-store, value=false)");
        result = cli.readAllAsOpResult();
        assertTrue("Failed to set use-journal-store to false.", result.isIsOutcomeSuccess());
        // undefine jdbc-store-datasource
        cli.sendLine("/subsystem=transactions:undefine-attribute(name=jdbc-store-datasource)");
        result = cli.readAllAsOpResult();
        assertTrue("Failed to undefine jdbc-store-datasource.", result.isIsOutcomeSuccess());
    } finally {
        try {
            setDefaultObjectStore(true);
        } finally {
            removeDataSource();
        }
    }
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Test(org.junit.Test)

Example 24 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class ObjectStoreTypeTestCase method testJournalObjectStore.

@Test
public void testJournalObjectStore() throws IOException, MgmtOperationException {
    try {
        String objectStoreType = readObjectStoreType();
        assertEquals("default", objectStoreType);
        cli.sendLine("/subsystem=transactions:write-attribute(name=use-journal-store, value=true)");
        final CLIOpResult ret = cli.readAllAsOpResult();
        assertEquals("restart-required", (String) ((Map) ret.getFromResponse(RESPONSE_HEADERS)).get(PROCESS_STATE));
        cli.sendLine("reload");
        objectStoreType = readObjectStoreType();
        assertEquals("journal", objectStoreType);
    } finally {
        setDefaultObjectStore();
    }
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Map(java.util.Map) Test(org.junit.Test)

Example 25 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class DataSourceTestCase method testModifyDataSource.

private void testModifyDataSource(String jndiName) throws Exception {
    StringBuilder cmd = new StringBuilder("data-source --profile=" + profileNames[0] + " --name=java:jboss/datasources/TestDS_" + jndiName);
    for (String[] props : DS_PROPS) {
        cmd.append(" --");
        cmd.append(props[0]);
        cmd.append("=");
        cmd.append(props[1]);
    }
    cli.sendLine(cmd.toString());
    // check that datasource was modified
    cli.sendLine("/profile=" + profileNames[0] + "/subsystem=datasources/data-source=java\\:jboss\\/datasources\\/TestDS_" + jndiName + ":read-resource(recursive=true)");
    CLIOpResult result = cli.readAllAsOpResult();
    assertTrue(result.isIsOutcomeSuccess());
    assertTrue(result.getResult() instanceof Map);
    Map dsProps = (Map) result.getResult();
    for (String[] props : DS_PROPS) assertTrue(dsProps.get(props[0]).equals(props[1]));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Map(java.util.Map)

Aggregations

CLIOpResult (org.jboss.as.test.integration.management.util.CLIOpResult)27 Test (org.junit.Test)13 Map (java.util.Map)6 RolloutPlanBuilder (org.jboss.as.test.integration.domain.management.util.RolloutPlanBuilder)3 CLIWrapper (org.jboss.as.test.integration.management.util.CLIWrapper)3 ModelNode (org.jboss.dmr.ModelNode)2 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)2 File (java.io.File)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SocketPermission (java.net.SocketPermission)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 StandardCharsets (java.nio.charset.StandardCharsets)1 AllPermission (java.security.AllPermission)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1