Ejemplo n.º 1
0
 @Test
 public void testCreateRespectsFlagInMap() {
   TestEntity entity2 =
       app.createAndManageChild(
           TestEntity.Spec.newInstance().configure(MutableMap.of("confName", "baz")));
   assertEquals(entity2.getConfig(TestEntity.CONF_NAME), "baz");
 }
Ejemplo n.º 2
0
  @Test
  public void testCanSetConfig() {
    final ExampleJavaPolicy policy =
        new ExampleJavaPolicy(MutableMap.of("displayName", "myName", "myConfig1", "myVal1"));
    entity.addPolicy(policy);

    assertEquals(policy.getName(), "myName");
    assertEquals(policy.myConfig1, "myVal1");
  }
Ejemplo n.º 3
0
  @Test
  public void testCanSetConfig() {
    entity =
        new ExampleJavaEntity(MutableMap.of("displayName", "myName", "myConfig1", "myVal1"), app);
    app.manage(entity);

    assertEquals(entity.getDisplayName(), "myName");
    assertEquals(entity.getConfig(ExampleJavaEntity.MY_CONFIG1), "myVal1");
  }
Ejemplo n.º 4
0
 public static BrooklynProperties newDefault() {
   BrooklynProperties p = new BrooklynProperties().addEnvironmentVars().addSystemProperties();
   File f =
       new File(
           p.getFirst(MutableMap.of("defaultIfNone", "/"), "user.home", "HOME")
               + File.separatorChar
               + ".brooklyn"
               + File.separatorChar
               + "brooklyn.properties");
   if (f.exists()) p.addFrom(f);
   return p;
 }
Ejemplo n.º 5
0
  /**
   * AS7 config notes and TODOs: We're using the http management interface on port managementPort
   * We're not using any JMX. - AS 7 simply doesn't boot with Sun JMX enabled
   * (https://issues.jboss.org/browse/JBAS-7427) - 7.1 onwards uses Remoting 3, which we haven't
   * configured We're completely disabling security on the management interface. - In the future we
   * probably want to use the as7/bin/add-user.sh script using config keys for user and password -
   * Or we could create our own security realm and use that. We disable the root welcome page, since
   * we can't deploy our own root otherwise We bind all interfaces to entity.hostname, rather than
   * 127.0.0.1.
   */
  @Override
  public void customize() {
    Map ports =
        MutableMap.of(
            "httpPort",
            getHttpPort(),
            "managementPort",
            getManagementPort(),
            "managementNativePort",
            getManagementNativePort());

    NetworkUtils.checkPortsValid(ports);
    String hostname = entity.getAttribute(SoftwareProcessEntity.HOSTNAME);
    Preconditions.checkNotNull(
        hostname,
        "AS 7 entity must set hostname otherwise server will only be visible on localhost");
    newScript(CUSTOMIZING)
        .body
        .append(
            format(
                "cp -r %s/jboss-as-%s/%s . || exit $!", getInstallDir(), getVersion(), SERVER_TYPE),
            format("cd %s/%s/configuration/", getRunDir(), SERVER_TYPE),
            format("cp standalone.xml %s", CONFIG_FILE),
            format("sed -i.bk 's/8080/%s/' %s", getHttpPort(), CONFIG_FILE),
            format("sed -i.bk 's/9990/%s/' %s", getManagementPort(), CONFIG_FILE),
            format("sed -i.bk 's/9999/%s/' %s", getManagementNativePort(), CONFIG_FILE),
            format(
                "sed -i.bk 's/port-offset:0/port-offset:%s/' %s", getPortIncrement(), CONFIG_FILE),
            format(
                "sed -i.bk 's/enable-welcome-root=\"true\"/enable-welcome-root=\"false\"/' %s",
                CONFIG_FILE),

            // Disable Management security (!) by deleting the security-realm attribute
            format(
                "sed -i.bk 's/http-interface security-realm=\"ManagementRealm\"/http-interface/' %s",
                CONFIG_FILE),

            // Increase deployment timeout to ten minutes
            format(
                "sed -i.bk 's/\\(path=\"deployments\"\\)/\\1 deployment-timeout=\"600\"/' %s",
                CONFIG_FILE),

            // Bind interfaces to entity hostname
            format(
                "sed -i.bk 's/\\(inet-address value=.*\\)127.0.0.1/\\1%s/' %s",
                getHostname(), CONFIG_FILE))
        .execute();

    ((JBoss7Server) entity).deployInitialWars();
  }
Ejemplo n.º 6
0
  @Override
  public void customize() {
    NetworkUtils.checkPortsValid(MutableMap.of("jmxPort", getJmxPort(), "amqpPort", getAmqpPort()));
    newScript(CUSTOMIZING)
        .body
        .append(format("cp -R %s/{bin,etc,lib} .", getExpandedInstallDir()), "mkdir lib/opt")
        .execute();

    Map runtimeFiles = entity.getConfig(QpidBroker.RUNTIME_FILES);
    copyResources(runtimeFiles);

    Map runtimeTemplates = entity.getConfig(QpidBroker.RUNTIME_TEMPLATES);
    copyTemplates(runtimeTemplates);
  }
Ejemplo n.º 7
0
 @Override
 public void launch() {
   Map flags = MutableMap.of("usePidFile", false);
   newScript(flags, LAUNCHING)
       .body
       .append(
           "export LAUNCH_JBOSS_IN_BACKGROUND=true",
           format("export JBOSS_HOME=%s/jboss-as-%s", getInstallDir(), getVersion()),
           format("export JBOSS_PIDFILE=%s/%s", getRunDir(), PID_FILENAME),
           format("%s/jboss-as-%s/bin/%s.sh ", getInstallDir(), getVersion(), SERVER_TYPE)
               + format("--server-config %s ", CONFIG_FILE)
               + format("-Djboss.server.base.dir=%s/%s ", getRunDir(), SERVER_TYPE)
               + format("\"-Djboss.server.base.url=file://%s/%s\" ", getRunDir(), SERVER_TYPE)
               + "-Djava.net.preferIPv4Stack=true "
               + "-Djava.net.preferIPv6Addresses=false "
               + format(" >> %s/console 2>&1 </dev/null &", getRunDir()))
       .execute();
 }
Ejemplo n.º 8
0
 @Test
 public void testCanSetId() {
   final ExampleJavaPolicy policy = new ExampleJavaPolicy(MutableMap.of("id", "myid"));
   entity.addPolicy(policy);
   assertEquals(policy.getId(), "myid");
 }
Ejemplo n.º 9
0
 /**
  * returns the value of the first key which is defined
  *
  * <p>takes the following flags: 'warnIfNone', 'failIfNone' (both taking a boolean (to use default
  * message) or a string (which is the message)); and 'defaultIfNone' (a default value to return if
  * there is no such property); defaults to no warning and null response
  */
 @Override
 public String getFirst(String... keys) {
   return getFirst(MutableMap.of(), keys);
 }
Ejemplo n.º 10
0
 public Map<String, Object> getProvisioningFlags(Collection<String> tags) {
   return MutableMap.<String, Object>of();
 }
Ejemplo n.º 11
0
 public SimulatedLocation() {
   this(MutableMap.<String, Object>of());
 }
 public ActiveMQDestination(Entity parent) {
   this(MutableMap.of(), parent);
 }
 public ActiveMQDestination() {
   this(MutableMap.of(), null);
 }
Ejemplo n.º 14
0
 @Override
 public void kill() {
   Map flags = MutableMap.of("usePidFile", true);
   newScript(flags, KILLING).execute();
 }
Ejemplo n.º 15
0
 @Override
 public void stop() {
   Map flags = MutableMap.of("usePidFile", true);
   newScript(flags, STOPPING).execute();
 }
Ejemplo n.º 16
0
 @Override
 public boolean isRunning() {
   Map flags = MutableMap.of("usePidFile", true);
   return newScript(flags, CHECK_RUNNING).execute() == 0;
 }