Package org.jboss.dmr

Examples of org.jboss.dmr.ModelNode.asInt()


                            break;
                        case DOUBLE:
                            toSet.set(modelValue.asDouble());
                            break;
                        case INT:
                            toSet.set(modelValue.asInt());
                            break;
                        case LONG:
                            toSet.set(modelValue.asLong());
                            break;
                        case STRING:
View Full Code Here


    private OptionMap getChannelCreationOptions(final OperationContext context) throws OperationFailedException {
        // read the full model of the current resource
        final ModelNode fullModel = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
        final ModelNode channelCreationOptions = fullModel.get(EJB3SubsystemModel.CHANNEL_CREATION_OPTIONS);
        if (channelCreationOptions.isDefined() && channelCreationOptions.asInt() > 0) {
            final ClassLoader loader = this.getClass().getClassLoader();
            final OptionMap.Builder builder = OptionMap.builder();
            for (final Property optionProperty : channelCreationOptions.asPropertyList()) {
                final String name = optionProperty.getName();
                final ModelNode propValueModel = optionProperty.getValue();
View Full Code Here

        BackingCacheEntryStoreConfig config = service.getValue();
        config.setIdleTimeout(PassivationStoreResourceDefinition.IDLE_TIMEOUT.resolveModelAttribute(context, model).asLong());
        config.setIdleTimeoutUnit(TimeUnit.valueOf(PassivationStoreResourceDefinition.IDLE_TIMEOUT_UNIT.resolveModelAttribute(context, model).asString()));
        ModelNode maxSizeModel = MAX_SIZE_ATTR.resolveModelAttribute(context, model);
        if (maxSizeModel.isDefined()) {
            config.setMaxSize(maxSizeModel.asInt());
        }
        ServiceBuilder<?> builder = service.build(context.getServiceTarget());
        if (verificationHandler != null) {
            builder.addListener(verificationHandler);
        }
View Full Code Here

            goodHandlerLatch.countDown();

            ModelNode model = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel();
            ModelNode attr = model.get(name);
            final int current = attr.asInt();
            attr.set(operation.require(VALUE));

            context.getResult().set(current);

            if (useNonRecursive) {
View Full Code Here

    }

    protected static OptionMap getFullOptions(ModelNode fullModel) {
        OptionMap.Builder builder = OptionMap.builder();
        ModelNode properties = fullModel.get(PROPERTY);
        if (properties.isDefined() && properties.asInt() > 0) {
            addOptions(properties, builder);
        }
        if (fullModel.hasDefined(SECURITY)) {
            ModelNode security = fullModel.require(SECURITY);
            if (security.hasDefined(SASL)) {
View Full Code Here

        ModelNode result = controller.execute(read, null, null, null);
        System.out.println(result);
        result = result.get("result");

        Assert.assertEquals(4, result.asInt()); // A,B one,two

        final ModelNode describe = new ModelNode();
        describe.get(OP).set("describe");
        describe.get(OP_ADDR).set(address);
View Full Code Here

        operation.get(NAME).set("int");
        ModelNode result = executeForResult(operation);
        assertNotNull(result);
        assertEquals(ModelType.INT, result.getType());
        assertEquals(102, result.asInt());

        operation.get(NAME).set("string1");
        result = executeForResult(operation);
        assertNotNull(result);
        assertEquals(ModelType.STRING, result.getType());
View Full Code Here

        Mockito.when(ctx.getResult()).thenReturn(result);

        StartLevelHandler handler = StartLevelHandler.READ_HANDLER;
        Assert.assertFalse(result.isDefined());
        handler.execute(ctx, new ModelNode());
        Assert.assertEquals(999, result.asInt());
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
    public void testWriteHandler() throws Exception {
View Full Code Here

        for (Property property : ignoredTypes.asPropertyList()) {

            ModelNode ignored = property.getValue();

            ModelNode names = ignored.hasDefined(NAMES) ? ignored.get(NAMES) : null;
            boolean hasNames = names != null && names.asInt() > 0;
            if (hasNames) {
                writer.writeStartElement(Element.IGNORED_RESOURCE.getLocalName());
            } else {
                writer.writeEmptyElement(Element.IGNORED_RESOURCE.getLocalName());
            }
View Full Code Here

        ModelNode major = result.get("management-major-version");
        ModelNode minor = result.get("management-minor-version");
        Assert.assertEquals(ModelType.INT, major.getType());
        Assert.assertEquals(ModelType.INT, minor.getType());
        Assert.assertEquals(Version.MANAGEMENT_MAJOR_VERSION, major.asInt());
        Assert.assertEquals(Version.MANAGEMENT_MINOR_VERSION, minor.asInt());
    }

    @Test
    public void testExtensions() throws Exception {
        ModelNode op = createOpNode(null, "read-children-resources");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.