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]));
}
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();
}
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();
}
}
}
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();
}
}
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]));
}
Aggregations