Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2014, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.test.deployment.trivial;
 
 import java.io.File;
 import java.util.Map;
 import java.util.Set;
 
Utilities for using ServiceActivatorDeployment.

Author(s):
Brian Stansberry (c) 2014 Red Hat Inc.
 
 
     private static final Map<StringStringDEFAULT_MAP = Collections.singletonMap(.,
 
     public static final PathAddress RESOURCE_ADDRESS = PathAddress.pathAddress(
             PathElement.pathElement("core-service""platform-mbean"),
             PathElement.pathElement(."runtime")
     );
 
     public static void createServiceActivatorDeployment(File destinationthrows IOException {
         createServiceActivatorDeployment(destinationnull);
     }
 
     public static void createServiceActivatorDeployment(File destinationMap<StringStringpropertiesthrows IOException {
         createServiceActivatorDeploymentArchive(destination.getName(), properties).as(ZipExporter.class).exportTo(destination);
     }
 
     public static JavaArchive createServiceActivatorDeploymentArchive(String nameMap<StringStringpropertiesthrows IOException {
         final JavaArchive archive = ShrinkWrap.create(JavaArchive.classname);
         archive.addClass(ServiceActivatorDeployment.class);
         archive.addAsServiceProvider(ServiceActivator.classServiceActivatorDeployment.class);
         if (properties != null && properties.size() > 0) {
             StringBuilder sb = new StringBuilder();
             for (Map.Entry<StringStringprop : properties.entrySet()) {
                 sb.append(prop.getKey());
                 sb.append('=');
                 sb.append(prop.getValue());
                 sb.append("\n");
             }
             archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc\n"), "MANIFEST.MF");
             archive.addAsResource(new StringAsset(sb.toString()), .);
         }
         return archive;
     }
 
     public static void validateProperties(ModelControllerClient clientthrows IOExceptionMgmtOperationException {
     }
 
     public static void validateProperties(ModelControllerClient clientMap<StringString>  propertiesthrows IOExceptionMgmtOperationException {
         validateProperties(client.properties);
     }
 
     public static void validateProperties(ModelControllerClient clientPathAddress baseAddressthrows IOExceptionMgmtOperationException {
         validateProperties(clientbaseAddress);
     }
 
     public static void validateProperties(ModelControllerClient clientPathAddress baseAddressMap<StringString>  propertiesthrows IOExceptionMgmtOperationException {
        for (Map.Entry<StringStringentry : properties.entrySet()) {
            ModelNode value = getPropertyValue(clientbaseAddressentry.getKey());
            Assert.assertTrue(entry.getKey() + " is not defined: " + valuevalue.isDefined());
            Assert.assertEquals(entry.getKey() + " has the wrong value"entry.getValue(), value.asString());
        }
    }
    public static void validateNoProperties(ModelControllerClient clientthrows IOExceptionMgmtOperationException {
    }
    public static void validateNoProperties(ModelControllerClient clientSet<Stringpropertiesthrows IOExceptionMgmtOperationException {
        validateNoProperties(client.properties);
    }
    public static void validateNoProperties(ModelControllerClient clientPathAddress baseAddressthrows IOExceptionMgmtOperationException {
        validateNoProperties(clientbaseAddress.keySet());
    }
    public static void validateNoProperties(ModelControllerClient clientPathAddress baseAddressSet<String>  propertiesthrows IOExceptionMgmtOperationException {
        for (String prop : properties) {
            ModelNode value = getPropertyValue(clientbaseAddressprop);
            Assert.assertFalse(prop + " is defined: " + valuevalue.isDefined());
        }
    }
    private static ModelNode getPropertyValue(ModelControllerClient clientPathAddress baseAddressString propertyNamethrows IOExceptionMgmtOperationException {
        op.get(.).set("system-properties");
        ModelNode result = ManagementOperations.executeOperation(clientop);
        return result.get(propertyName);
    }
    private ServiceActivatorDeploymentUtil() {
        // prevent instantiation
    }
New to GrepCode? Check out our FAQ X