Package org.jboss.as.controller

Examples of org.jboss.as.controller.OperationContext


    @Test
    public void testNoChanges() throws Exception {
        final ModelNode operation = new ModelNode();
        operation.get(DOMAIN_MODEL).setEmptyList();
        final OperationContext operationContext = getOperationContext();
        handler.execute(operationContext, operation);
    }
View Full Code Here


    @Test
    public void testBooting() throws Exception {
        final ModelNode operation = new ModelNode();
        operation.get(DOMAIN_MODEL).setEmptyList();
        final OperationContext operationContext = getOperationContext(true);
        handler.execute(operationContext, operation);
    }
View Full Code Here

     */
    @Ignore("TODO: JBAS-9020: Archive deployments are not yet implemented")
    @Test
    public void testContent() throws OperationFailedException {
        final DeploymentAddHandler handler = DeploymentAddHandler.createForStandalone(contentRepository);
        final OperationContext context = Mockito.mock(OperationContext.class);
        Mockito.when(context.getResult()).thenReturn(new ModelNode());
        Mockito.when(context.readModelForUpdate(PathAddress.EMPTY_ADDRESS)).thenReturn(new ModelNode());
        Mockito.when(context.getProcessType()).thenReturn(ProcessType.STANDALONE_SERVER);
        Mockito.when(context.getRunningMode()).thenReturn(RunningMode.NORMAL);
        Mockito.when(context.isNormalServer()).thenReturn(true);
        final ModelNode operation = new ModelNode();
        //operation.get("address").setEmptyList().get(0).get("deployment").set("test.war");
        operation.get("address").get(0).setExpression("deployment", "test.war");
        operation.get("content").get(0).get("archive").set(true);
        operation.get("content").get(0).get("path").set("test.war");
View Full Code Here

    }

    @Test (expected = OperationFailedException.class)
    public void testTooMuchContent() throws OperationFailedException {
        final DeploymentAddHandler handler = DeploymentAddHandler.createForStandalone(contentRepository);
        final OperationContext context = Mockito.mock(OperationContext.class);
        final ModelNode operation = new ModelNode();
        //operation.get("address").setEmptyList().get(0).get("deployment").set("test.war");
        operation.get("address").get(0).setExpression("deployment", "test.war");
        operation.get("content").get(0).get("archive").set(true);
        operation.get("content").get(0).get("path").set("test.war");
View Full Code Here

    }

    @Test
    public void testValidator() throws OperationFailedException {
        final DeploymentAddHandler handler = DeploymentAddHandler.createForStandalone(contentRepository);
        final OperationContext context = Mockito.mock(OperationContext.class);
        final ModelNode operation = new ModelNode();
        operation.get("content").get(0).get("archive").set("wrong");
        try {
            handler.execute(context, operation);
        } catch (OperationFailedException e) {
View Full Code Here

        ServiceController sc = Mockito.mock(ServiceController.class);

        ServiceRegistry sr = Mockito.mock(ServiceRegistry.class);
        Mockito.when(sr.getRequiredService(Services.FRAMEWORK_ACTIVE)).thenReturn(sc);

        OperationContext context = Mockito.mock(OperationContext.class);
        Mockito.when(context.getServiceRegistry(false)).thenReturn(sr);

        ActivateOperationHandler.INSTANCE.executeRuntimeStep(context, activateOp);

        Mockito.verify(sc).setMode(Mode.ACTIVE);
        Mockito.verify(context).completeStep();
View Full Code Here

public class OSGiCapabilityAddRemoveTestCase extends ResourceAddRemoveTestBase {
    @Test
    public void testOSGiCapabilityAddRemove() throws Exception {
        SubsystemState stateService = new SubsystemState();
        List<OperationStepHandler> addedSteps = new ArrayList<OperationStepHandler>();
        OperationContext context = mockOperationContext(stateService, addedSteps, OperationContext.ResultAction.KEEP);

        ModelNode op = getAddOperation("org.acme.module1", 4);

        Assert.assertEquals("Precondition", 0, addedSteps.size());
        execute(OSGiCapabilityAdd.INSTANCE, context, op);
View Full Code Here

    @Test
    public void testOSGiCapabilityAddRollback() throws Exception {
        SubsystemState stateService = new SubsystemState();
        List<OperationStepHandler> addedSteps = new ArrayList<OperationStepHandler>();
        OperationContext context = mockOperationContext(stateService, addedSteps, OperationContext.ResultAction.ROLLBACK);

        ModelNode op = getAddOperation("org.acme.module1", 4);

        Assert.assertEquals("Precondition", 0, addedSteps.size());
        execute(OSGiCapabilityAdd.INSTANCE, context, op);
View Full Code Here

    @Test
    public void testOSGiPropertyAddRemove() throws Exception {
        SubsystemState stateService = new SubsystemState();
        List<OperationStepHandler> addedSteps = new ArrayList<OperationStepHandler>();
        OperationContext context = mockOperationContext(stateService, addedSteps, OperationContext.ResultAction.KEEP);

        ModelNode op = getAddOperation("PropertyX", "hi");

        Assert.assertEquals("Precondition", 0, addedSteps.size());
        execute(OSGiFrameworkPropertyAdd.INSTANCE, context, op);
View Full Code Here

    @Test
    public void testOSGiPropertyAddRollback() throws Exception {
        SubsystemState stateService = new SubsystemState();
        List<OperationStepHandler> addedSteps = new ArrayList<OperationStepHandler>();
        OperationContext context = mockOperationContext(stateService, addedSteps, OperationContext.ResultAction.ROLLBACK);

        ModelNode op = getAddOperation("PropertyX", "hi");

        Assert.assertEquals("Precondition", 0, addedSteps.size());
        execute(OSGiFrameworkPropertyAdd.INSTANCE, context, op);
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.OperationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.