org.jboss.as.controller.client.helpers.Operations Java Examples
The following examples show how to use
org.jboss.as.controller.client.helpers.Operations.
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: AuditLogBootingSyslogTest.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@After public void afterTest() throws Exception { final ModelControllerClient client = container.getClient().getControllerClient(); SYSLOG_SETUP.tearDown(container.getClient()); final Operations.CompositeOperationBuilder compositeOp = Operations.CompositeOperationBuilder.create(); compositeOp.addStep(Util.getWriteAttributeOperation(auditLogConfigAddress, AuditLogLoggerResourceDefinition.ENABLED.getName(), ModelNode.FALSE)); resetElytron(compositeOp); resetServerName(compositeOp); try { executeForSuccess(client, compositeOp.build()); } finally { try { // Stop the container container.stop(); } finally { IoUtils.safeClose(client); } } }
Example #2
Source File: SocketHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void setup(final ManagementClient managementClient) throws Exception { // Describe the current subsystem to restore in the tearDown final ModelNode describeOp = Operations.createOperation("describe", SUBSYSTEM_ADDRESS.toModelNode()); describeResult = executeOperation(managementClient, describeOp); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(); final ModelNode outboundSocketBindingAddress = Operations.createAddress("socket-binding-group", "standard-sockets", "remote-destination-outbound-socket-binding", SOCKET_BINDING_NAME); ModelNode op = Operations.createAddOperation(outboundSocketBindingAddress); op.get("host").set(HOSTNAME); op.get("port").set(PORT); builder.addStep(op); final ModelNode formatterAddress = SUBSYSTEM_ADDRESS.append("json-formatter", FORMATTER_NAME).toModelNode(); builder.addStep(Operations.createAddOperation(formatterAddress)); builder.addStep(Operations.createAddOperation(LOGGER_ADDRESS)); executeOperation(managementClient, builder.build()); }
Example #3
Source File: DefaultDeploymentManager.java From wildfly-maven-plugin with GNU Lesser General Public License v2.1 | 6 votes |
private DeploymentDescription getServerGroupDeployment(final String name) throws IOException { final Set<String> serverGroups = new LinkedHashSet<>(); final ModelNode address = createAddress(SERVER_GROUP, "*", DEPLOYMENT, name); final ModelNode result = client.execute(Operations.createReadResourceOperation(address)); if (Operations.isSuccessfulOutcome(result)) { // Load the server groups for (ModelNode r : Operations.readResult(result).asList()) { final List<Property> resultAddress = Operations.getOperationAddress(r).asPropertyList(); String foundServerGroup = null; for (Property property : resultAddress) { if (SERVER_GROUP.equals(property.getName())) { foundServerGroup = property.getValue().asString(); } } // Add the server-group to the map of deployments serverGroups.add(foundServerGroup); } return SimpleDeploymentDescription.of(name, serverGroups); } throw new RuntimeException("Failed to get listing of deployments. Reason: " + Operations.getFailureDescription(result).asString()); }
Example #4
Source File: AuditLogBootingSyslogTest.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
void configureElytron(final CompositeOperationBuilder compositeOp) throws IOException { ModelNode op = Operations.createOperation("map-remove", userAuthAddress); op.get("name").set("properties"); op.get("key").set(DEFAULT_USER_KEY); compositeOp.addStep(op.clone()); op = Operations.createOperation("map-put", userAuthAddress); op.get("name").set("properties"); op.get("key").set(DEFAULT_USER_KEY); op.get("value").set("IAmAdmin"); compositeOp.addStep(op.clone()); compositeOp.addStep(Operations.createWriteAttributeOperation(userIdentRealmAddress, "identity", "IAmAdmin")); op = Operations.createAddOperation(PathAddress.parseCLIStyleAddress("/subsystem=elytron/credential-store=test").toModelNode()); op.get("relative-to").set("jboss.server.data.dir"); op.get("location").set("test.store"); op.get("create").set(true); ModelNode credRef = new ModelNode(); credRef.get("clear-text").set("password"); op.get("credential-reference").set(credRef); compositeOp.addStep(op.clone()); }
Example #5
Source File: LoggingDependenciesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@After public void stopContainer() throws Exception { // No need to undeploy the deployment should be in error, but check the deployments and undeploy if necessary, // for example if the test failed final ModelNode op = Operations.createReadResourceOperation(PathAddress.pathAddress("deployment", "*").toModelNode()); final List<ModelNode> result = Operations.readResult(executeOperation(op)).asList(); if (!result.isEmpty()) { try { undeploy(); } catch (ServerDeploymentException e) { log.warn("Error undeploying", e); } } executeOperation(Operations.createWriteAttributeOperation(createAddress(), API_DEPENDENCIES, true)); container.stop(); }
Example #6
Source File: CustomHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void setup(final ManagementClient managementClient) throws Exception { logFile = getAbsoluteLogFilePath(FILE_NAME); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(); // Create the custom handler ModelNode op = Operations.createAddOperation(CUSTOM_HANDLER_ADDRESS); op.get("class").set(FileHandler.class.getName()); op.get("module").set("org.jboss.logmanager"); ModelNode opProperties = op.get("properties").setEmptyObject(); opProperties.get("fileName").set(logFile.normalize().toString()); opProperties.get("autoFlush").set(true); builder.addStep(op); // Add the handler to the root-logger op = Operations.createOperation("add-handler", createRootLoggerAddress()); op.get(ModelDescriptionConstants.NAME).set(CUSTOM_HANDLER_NAME); builder.addStep(op); executeOperation(builder.build()); }
Example #7
Source File: AuditLogBootingSyslogTest.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Before public void beforeTest() throws Exception { container.startInAdminMode(); final ModelControllerClient client = container.getClient().getControllerClient(); Operations.CompositeOperationBuilder compositeOp = Operations.CompositeOperationBuilder.create(); configureServerName(compositeOp); configureElytron(compositeOp); executeForSuccess(client, compositeOp.build()); SYSLOG_SETUP.setup(container.getClient()); compositeOp = Operations.CompositeOperationBuilder.create(); configureAliases(compositeOp); compositeOp.addStep(Util.getWriteAttributeOperation(auditLogConfigAddress, AuditLogLoggerResourceDefinition.LOG_BOOT.getName(), ModelNode.TRUE)); compositeOp.addStep(Util.getWriteAttributeOperation(auditLogConfigAddress, AuditLogLoggerResourceDefinition.ENABLED.getName(), ModelNode.TRUE)); executeForSuccess(client, compositeOp.build()); final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue(); queue.clear(); container.stop(); }
Example #8
Source File: SyslogHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void tearDown(final ManagementClient managementClient) throws Exception { // stop syslog server LOGGER.info("stopping syslog server"); SyslogServer.shutdown(); LOGGER.info("syslog server stopped"); // remove syslog-profile final ModelNode op = Operations.createRemoveOperation(SYSLOG_PROFILE_ADDR); op.get(OPERATION_HEADERS, ROLLBACK_ON_RUNTIME_FAILURE).set(false); op.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true); executeOperation(op); LOGGER.info("syslog server logging profile removed"); super.tearDown(managementClient); }
Example #9
Source File: HttpDeploymentUploadUnitTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private static ModelNode validateStatus(final HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final InputStream in = response.getEntity().getContent(); final byte[] buffer = new byte[64]; int len; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } fail(out.toString()); } final HttpEntity entity = response.getEntity(); final ModelNode result = ModelNode.fromJSONStream(entity.getContent()); assertNotNull(result); assertTrue(Operations.isSuccessfulOutcome(result)); return result; }
Example #10
Source File: ExplodedDeploymentTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
public void browseContent(String path, List<String> expectedContents) throws IOException { ModelNode operation = Operations.createOperation(DEPLOYMENT_BROWSE_CONTENT_OPERATION, PathAddress.pathAddress(DEPLOYMENT_PATH).toModelNode()); if (path != null && !path.isEmpty()) { operation.get(PATH).set(path); } AsyncFuture<ModelNode> future = masterClient.executeAsync(operation, null); ModelNode response = awaitSimpleOperationExecution(future); assertTrue(Operations.isSuccessfulOutcome(response)); List<ModelNode> contents = Operations.readResult(response).asList(); for (ModelNode content : contents) { Assert.assertTrue(content.hasDefined("path")); String contentPath = content.get("path").asString(); Assert.assertTrue(content.asString() + " isn't expected", expectedContents.contains(contentPath)); Assert.assertTrue(content.hasDefined("directory")); if (!content.get("directory").asBoolean()) { Assert.assertTrue(content.hasDefined("file-size")); } expectedContents.remove(contentPath); } Assert.assertTrue(expectedContents.isEmpty()); }
Example #11
Source File: SocketHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testTlsSocket() throws Exception { final KeyStore clientTrustStore = loadKeyStore(); final KeyStore serverKeyStore = loadKeyStore(); createKeyStoreTrustStore(serverKeyStore, clientTrustStore); final Path clientTrustFile = createTemporaryKeyStoreFile(clientTrustStore, "client-trust-store.jks"); final Path serverCertFile = createTemporaryKeyStoreFile(serverKeyStore, "server-cert-store.jks"); // Create a TCP server and start it try (JsonLogServer server = JsonLogServer.createTlsServer(PORT, serverCertFile, TEST_PASSWORD)) { server.start(DFT_TIMEOUT); // Add the socket handler and test all levels final ModelNode socketHandlerAddress = addSocketHandler("test-log-server", null, "SSL_TCP", clientTrustFile); checkLevelsLogged(server, EnumSet.allOf(Logger.Level.class), "Test SSL_TCP all levels."); // Change to only allowing INFO and higher messages executeOperation(Operations.createWriteAttributeOperation(socketHandlerAddress, "level", "INFO")); checkLevelsLogged(server, EnumSet.of(Logger.Level.INFO, Logger.Level.WARN, Logger.Level.ERROR, Logger.Level.FATAL), "Test SSL_TCP INFO and higher."); } }
Example #12
Source File: AbstractLoggingTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
public static String resolveRelativePath(final String relativePath) { final ModelNode address = PathAddress.pathAddress( PathElement.pathElement(ModelDescriptionConstants.PATH, relativePath) ).toModelNode(); final ModelNode result; try { final ModelNode op = Operations.createReadAttributeOperation(address, ModelDescriptionConstants.PATH); result = client.execute(op); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result).asString(); } } catch (IOException e) { throw new RuntimeException(e); } throw new RuntimeException(Operations.getFailureDescription(result).asString()); }
Example #13
Source File: AbstractLoggingTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
public static String resolveRelativePath(final String relativePath) { final ModelNode address = PathAddress.pathAddress( PathElement.pathElement(ModelDescriptionConstants.PATH, relativePath) ).toModelNode(); final ModelNode result; try { final ModelNode op = Operations.createReadAttributeOperation(address, ModelDescriptionConstants.PATH); result = client.getControllerClient().execute(op); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result).asString(); } } catch (IOException e) { throw new RuntimeException(e); } throw new RuntimeException(Operations.getFailureDescription(result).asString()); }
Example #14
Source File: AbstractTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public Boolean apply(final EmbeddedManagedProcess server) { try { final ModelControllerClient client = server.getModelControllerClient(); final ModelNode hostAddress = determineHostAddress(client); final ModelNode op = Operations.createReadAttributeOperation(hostAddress, "host-state"); final ModelNode result = client.execute(op); if (Operations.isSuccessfulOutcome(result) && ClientConstants.CONTROLLER_PROCESS_STATE_RUNNING.equals(Operations.readResult(result).asString())) { return true; } } catch (IllegalStateException | IOException ignore) { } return false; }
Example #15
Source File: CliScriptTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override void testScript(final ScriptProcess script) throws InterruptedException, TimeoutException, IOException { // Read an attribute script.start(MAVEN_JAVA_OPTS, "--commands=embed-server,:read-attribute(name=server-state),exit"); Assert.assertNotNull("The process is null and may have failed to start.", script); Assert.assertTrue("The process is not running and should be", script.isAlive()); validateProcess(script); // Read the output lines which should be valid DMR try (InputStream in = Files.newInputStream(script.getStdout())) { final ModelNode result = ModelNode.fromStream(in); if (!Operations.isSuccessfulOutcome(result)) { Assert.fail(result.asString()); } Assert.assertEquals(ClientConstants.CONTROLLER_PROCESS_STATE_RUNNING, Operations.readResult(result).asString()); } }
Example #16
Source File: AffectedDeploymentOverlay.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * It will look for all the deployments under the deploymentsRootAddress with a runtimeName in the specified list of * runtime names and then transform the operation so that every server having those deployments will redeploy the * affected deployments. * * @see #transformOperation * @param removeOperation * @param context * @param deploymentsRootAddress * @param runtimeNames * @throws OperationFailedException */ public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException { Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames); Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create(); if (deploymentNames.isEmpty()) { for (String s : runtimeNames) { ServerLogger.ROOT_LOGGER.debugf("We haven't found any deployment for %s in server-group %s", s, deploymentsRootAddress.getLastElement().getValue()); } } if(removeOperation != null) { opBuilder.addStep(removeOperation); } for (String deploymentName : deploymentNames) { opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName))); } List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS); if (transformers == null) { context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); } final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress())); }
Example #17
Source File: CliCapabilityCompletionTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testDynamicRequirements() throws Exception { ModelNode req = new ModelNode(); req.get(Util.OPERATION).set("read-resource-description"); req.get(Util.ADDRESS).set(PathAddress.pathAddress(PathElement.pathElement("socket-binding-group", "standard-sockets"), PathElement.pathElement("socket-binding", "test")).toModelNode()); ModelNode result = Operations.readResult(ctx.execute(req, "")); assertTrue(result.require("capabilities").asList().size() == 1); ModelNode capability = result.require("capabilities").asList().get(0); assertEquals("We should have a socket-binding capability provided", "org.wildfly.network.socket-binding", capability.require("name").asString()); assertTrue("We should have a dynamic capability provided", capability.require("dynamic").asBoolean()); List<ModelNode> dynamicElts = capability.require("dynamic-elements").asList(); assertEquals(1, dynamicElts.size()); assertEquals("We should have a socket-binding capability provided", "socket-binding", dynamicElts.get(0).asString()); assertEquals("We should have an interface capability requirement", "org.wildfly.network.interface", result.require("attributes").require("interface").require("capability-reference").asString()); }
Example #18
Source File: DomainScriptTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override void testScript(final ScriptProcess script) throws InterruptedException, TimeoutException, IOException { script.start(ServerHelper.DEFAULT_SERVER_JAVA_OPTS); Assert.assertNotNull("The process is null and may have failed to start.", script); Assert.assertTrue("The process is not running and should be", script.isAlive()); // Shutdown the server @SuppressWarnings("Convert2Lambda") final Callable<ModelNode> callable = new Callable<ModelNode>() { @Override public ModelNode call() throws Exception { try (ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient()) { return executeOperation(client, Operations.createOperation("shutdown", ServerHelper.determineHostAddress(client))); } } }; execute(callable); validateProcess(script); }
Example #19
Source File: JsonFormatterTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testStructuredException() throws Exception { configure(Collections.emptyMap(), Collections.emptyMap(), false); // Change the exception-output-type executeOperation(Operations.createWriteAttributeOperation(FORMATTER_ADDRESS, "exception-output-type", "detailed")); final String msg = "Logging test: JsonFormatterTestCase.testNoExceptions"; int statusCode = getResponse(msg, Collections.singletonMap(LoggingServiceActivator.LOG_EXCEPTION_KEY, "true")); Assert.assertTrue("Invalid response statusCode: " + statusCode, statusCode == HttpStatus.SC_OK); final List<String> expectedKeys = createDefaultKeys(); expectedKeys.add("exception"); for (String s : Files.readAllLines(logFile, StandardCharsets.UTF_8)) { if (s.trim().isEmpty()) continue; try (JsonReader reader = Json.createReader(new StringReader(s))) { final JsonObject json = reader.readObject(); validateDefault(json, expectedKeys, msg); validateStackTrace(json, false, true); } } }
Example #20
Source File: FilterCapabilityTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testRemoveAttachedLoggerFilter() throws Exception { CompositeOperationBuilder builder = CompositeOperationBuilder.create(); final ModelNode filterAddress = createSubsystemAddress("filter", "testFilter"); ModelNode op = Operations.createAddOperation(filterAddress); op.get("class").set(TestFilter.class.getName()); op.get("module").set(MODULE_NAME); builder.addStep(op); // Add the filter to the root logger final ModelNode rootLoggerAddress = createSubsystemAddress("root-logger", "ROOT"); builder.addStep(Operations.createWriteAttributeOperation(rootLoggerAddress, "filter-spec", "testFilter")); executeOperation(builder.build()); // Now attempt to remove the filter which should fail executeOperationForFailure(Operations.createRemoveOperation(filterAddress), CANNOT_REMOVE); // Now properly tear down the filter builder = CompositeOperationBuilder.create(); builder.addStep(Operations.createUndefineAttributeOperation(rootLoggerAddress, "filter-spec")); builder.addStep(Operations.createRemoveOperation(filterAddress)); executeOperation(builder.build()); }
Example #21
Source File: DeploymentResourceTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testPerDeploymentDefaultName() throws Exception { final JavaArchive deployment = createDeployment() .addAsResource(DeploymentBaseTestCase.class.getPackage(), "logging.properties", "META-INF/logging.properties"); deploy(deployment, DEPLOYMENT_NAME); final ModelNode loggingConfiguration = readDeploymentResource(DEPLOYMENT_NAME); // The address should have logging.properties final LinkedList<Property> resultAddress = new LinkedList<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList()); Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties")); final ModelNode handler = loggingConfiguration.get("handler", "FILE"); Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined()); Assert.assertTrue("The attribute properties was not found on the file handler", handler.hasDefined("properties")); String fileName = null; // Find the fileName property for (Property property : handler.get("properties").asPropertyList()) { if ("fileName".equals(property.getName())) { fileName = property.getValue().asString(); break; } } Assert.assertNotNull("fileName property not found", fileName); Assert.assertTrue(String.format("Expected the file name to end in %s but was %s", PER_DEPLOY_LOG_NAME, fileName), fileName.endsWith(PER_DEPLOY_LOG_NAME)); }
Example #22
Source File: RemoveManagementRealmTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Before public void beforeTest() throws Exception { container.start(); String jbossDist = TestSuiteEnvironment.getSystemProperty("jboss.dist"); source = Paths.get(jbossDist, "standalone", "configuration", "standalone.xml"); target = Paths.get(temporaryUserHome.getRoot().getAbsolutePath(), "standalone.xml"); Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING); // Determine the command to use final ModelControllerClient client = container.getClient().getControllerClient(); ModelNode op = Operations.createReadResourceOperation(Operations.createAddress("core-service", "management", "management-interface", "http-interface")); ModelNode result = client.execute(op); if (Operations.isSuccessfulOutcome(result)) { result = Operations.readResult(result); if (result.hasDefined("http-upgrade")) { final ModelNode httpUpgrade = result.get("http-upgrade"); if (httpUpgrade.hasDefined("sasl-authentication-factory")) { // We could query this further to get the actual name of the configurable-sasl-server-factory. Since this // is a test we're making some assumptions to limit the number of query calls made to the server. removeLocalAuthCommand = "/subsystem=elytron/configurable-sasl-server-factory=configured:map-remove(name=properties, key=wildfly.sasl.local-user.default-user)"; } } } else { fail(Operations.getFailureDescription(result).asString()); } }
Example #23
Source File: LoggingPreferencesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@After public void stopContainer() throws Exception { // Remove the servlet undeploy(); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(); // Set use-deployment-logging-config to true builder.addStep(Operations.createWriteAttributeOperation(createAddress(), PER_DEPLOY_ATTRIBUTE, true)); // Remove the logging profile builder.addStep(Operations.createRemoveOperation(PROFILE_ADDRESS)); executeOperation(builder.build()); // Stop the container container.stop(); clearLogFiles(); }
Example #24
Source File: Log4jXmlTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testDeploymentConfigurationResource() throws Exception { final ModelNode loggingConfiguration = readDeploymentResource(DEPLOYMENT_NAME); // The address should have jboss-log4j.xml final LinkedList<Property> resultAddress = new LinkedList<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList()); Assert.assertTrue("The configuration path did not include log4j.xml", resultAddress.getLast().getValue().asString().contains("log4j.xml")); Assert.assertTrue(loggingConfiguration.has("handler")); // A log4j configuration cannot be defined in the model Assert.assertFalse("No handlers should be defined", loggingConfiguration.get("handler").isDefined()); }
Example #25
Source File: DeploymentOverlayTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private ModelNode readDeploymentResource(PathAddress address) { ModelNode operation = Operations.createReadResourceOperation(address.toModelNode()); operation.get(INCLUDE_RUNTIME).set(true); operation.get(INCLUDE_DEFAULTS).set(true); AsyncFuture<ModelNode> future = masterClient.executeAsync(operation, null); ModelNode result = awaitSimpleOperationExecution(future); assertTrue(Operations.isSuccessfulOutcome(result)); return Operations.readResult(result); }
Example #26
Source File: AbstractGitRepositoryTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected void publish(String location) throws UnsuccessfulOperationException { ModelNode op = Operations.createOperation("publish-configuration"); if (location != null) { op.get("location").set(location); } container.getClient().executeForResult(op); }
Example #27
Source File: AbstractDeploymentManagerTest.java From wildfly-maven-plugin with GNU Lesser General Public License v2.1 | 5 votes |
ModelNode executeOp(final ModelNode op) throws IOException { final ModelNode result = getClient().execute(op); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result); } Assert.fail(String.format("Operation %s failed: %s", op, Operations.getFailureDescription(result))); // Should never be reached return new ModelNode(); }
Example #28
Source File: DeploymentOverlayTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void executeAsyncForDomainFailure(DomainClient client, ModelNode op, String failureDescription) { AsyncFuture<ModelNode> future = client.executeAsync(op, null); ModelNode response = awaitSimpleOperationExecution(future); assertFalse(response.toJSONString(true), Operations.isSuccessfulOutcome(response)); assertTrue(response.toJSONString(true), Operations.getFailureDescription(response).hasDefined("domain-failure-description")); assertTrue(Operations.getFailureDescription(response).get("domain-failure-description").asString() + " doesn't contain " + failureDescription, Operations.getFailureDescription(response).get("domain-failure-description").asString().contains(failureDescription)); }
Example #29
Source File: SyslogHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Tests that messages on all levels are logged, when level="TRACE" in syslog handler. */ @Test public void testAllLevelLogs() throws Exception { final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue(); executeOperation(Operations.createWriteAttributeOperation(SYSLOG_HANDLER_ADDR, "level", "TRACE")); queue.clear(); makeLogs(); for (Level level : LoggingServiceActivator.LOG_LEVELS) { testLog(queue, level); } Assert.assertTrue("No other message was expected in syslog.", queue.isEmpty()); }
Example #30
Source File: ProcessStateListenerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static void cleanupAfterReloadRequired() throws UnsuccessfulOperationException { ModelNode op = Operations .createOperation("list-clear", PathAddress.pathAddress(SUBSYSTEM, "security-manager") .append("deployment-permissions", "default") .toModelNode()); op.get("name").set("minimum-permissions"); controller.getClient().executeForResult(op); }