Examples of ConfigurationRequest


Examples of org.apache.ambari.server.controller.ConfigurationRequest

    ClusterRequest ucr2 = updateClusterRequest2.iterator().next();
    ClusterRequest ucr3 = updateClusterRequest3.iterator().next();
    assertEquals(clusterName, ucr1.getClusterName());
    assertEquals(clusterName, ucr2.getClusterName());
    assertEquals(clusterName, ucr3.getClusterName());
    ConfigurationRequest cr1 = ucr1.getDesiredConfig();
    ConfigurationRequest cr2 = ucr2.getDesiredConfig();
    ConfigurationRequest cr3 = ucr3.getDesiredConfig();
    assertEquals("1", cr1.getVersionTag());
    assertEquals("1", cr2.getVersionTag());
    assertEquals("1", cr3.getVersionTag());
    Map<String, ConfigurationRequest> mapConfigRequests = new HashMap<String, ConfigurationRequest>();
    mapConfigRequests.put(cr1.getType(), cr1);
    mapConfigRequests.put(cr2.getType(), cr2);
    mapConfigRequests.put(cr3.getType(), cr3);
    assertEquals(3, mapConfigRequests.size());
    ConfigurationRequest globalConfigRequest = mapConfigRequests.get("global");
    assertEquals(4, globalConfigRequest.getProperties().size());
    assertEquals("hadoop", globalConfigRequest.getProperties().get("user_group"));
    assertEquals("ambari-qa", globalConfigRequest.getProperties().get("smokeuser"));
    assertEquals("default@REPLACEME.NOWHERE", globalConfigRequest.getProperties().get("nagios_contact"));
    assertEquals("oozie", globalConfigRequest.getProperties().get("oozie_user"));
    ConfigurationRequest hdfsConfigRequest = mapConfigRequests.get("hdfs-site");
    assertEquals(1, hdfsConfigRequest.getProperties().size());
    assertEquals("value2", hdfsConfigRequest.getProperties().get("property2"));
    ConfigurationRequest coreConfigRequest = mapConfigRequests.get("core-site");
    assertEquals(7, coreConfigRequest.getProperties().size());
    assertEquals("value2", coreConfigRequest.getProperties().get("property1"));
    assertEquals("value3", coreConfigRequest.getProperties().get("property3"));
    assertEquals("*", coreConfigRequest.getProperties().get("hadoop.proxyuser.oozie.hosts"));
    assertEquals("users", coreConfigRequest.getProperties().get("hadoop.proxyuser.oozie.groups"));
    assertEquals("new.property.value", coreConfigRequest.getProperties().get("new.property"));
    assertEquals("foo", coreConfigRequest.getProperties().get("my.missing.password"));
    assertEquals("foo", coreConfigRequest.getProperties().get("my.missing.password2"));
    assertNull(updateClusterPropertyMapCapture.getValue());
    assertNull(updateClusterPropertyMapCapture2.getValue());
    assertNull(updateClusterPropertyMapCapture3.getValue());

    Request serviceRequest = serviceRequestCapture.getValue();
View Full Code Here

Examples of org.apache.ambari.server.controller.ConfigurationRequest

        (String) properties.get(CLUSTER_NAME_PROPERTY_ID),
        (String) properties.get(CLUSTER_PROVISIONING_STATE_PROPERTY_ID),
        (String) properties.get(CLUSTER_VERSION_PROPERTY_ID),
        null);

    ConfigurationRequest configRequest = getConfigurationRequest("Clusters", properties);

    if (null != configRequest)
      cr.setDesiredConfig(configRequest);

    return cr;
View Full Code Here

Examples of org.apache.ambari.server.controller.ConfigurationRequest

   *    whose category is the parent and marked as a desired config.
   * @param properties  the properties on the request.
   */
  protected ConfigurationRequest getConfigurationRequest(String parentCategory, Map<String, Object> properties) {

    ConfigurationRequest config = null;

    // as a convenience, allow consumers to specify name/value overrides in this
    // call instead of forcing a cluster call to do that work
    for (Entry<String, Object> entry : properties.entrySet()) {
      String absCategory = PropertyHelper.getPropertyCategory(entry.getKey());
      String propName = PropertyHelper.getPropertyName(entry.getKey());

      if (absCategory.startsWith(parentCategory + "/desired_config")) {
        config = (null == config) ? new ConfigurationRequest() : config;

        if (propName.equals("type"))
          config.setType(entry.getValue().toString());
        else if (propName.equals("tag"))
          config.setVersionTag(entry.getValue().toString());
        else if (propName.equals("selected")) {
          config.setSelected(Boolean.parseBoolean(entry.getValue().toString()));
        }
        else if (absCategory.endsWith("/properties")) {
          config.getProperties().put(propName, entry.getValue().toString());
        }
      }
    }

    return config;
View Full Code Here

Examples of org.apache.ambari.server.controller.ConfigurationRequest

        if (propertyCategory != null && propertyCategory.equals("properties") && null != entry.getValue()) {
          configMap.put(PropertyHelper.getPropertyName(entry.getKey()), entry.getValue().toString());
        }
      }

      final ConfigurationRequest configRequest = new ConfigurationRequest(cluster, type, tag, configMap);

      createResources(new Command<Void>() {
        @Override
        public Void invoke() throws AmbariException {
          getManagementController().createConfiguration(configRequest);
View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

        if (messageOutput == null) {
            return data;
        }

        final ConfigurationRequest requestedConfiguration = messageOutput.getRequestedConfiguration();

        if (data.containsKey("configuration")) {
            final Map<String, Object> c = (Map<String, Object>) data.get("configuration");

            for (Map.Entry<String, Object> entry : c.entrySet()) {
                if (requestedConfiguration.getField(entry.getKey()).getAttributes().contains(TextField.Attribute.IS_PASSWORD.toString().toLowerCase())) {
                    c.put(entry.getKey(), "********");
                }
            }
        }

View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

    }

    @Override
    public ConfigurationRequest getRequestedConfiguration() {
        return new ConfigurationRequest();
    }
View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

        return builder.build();
    }

    @Override
    public ConfigurationRequest getRequestedConfiguration() {
        final ConfigurationRequest configurationRequest = new ConfigurationRequest();
        configurationRequest.addField(new TextField(CK_HOSTNAME, "Destination host", "", "This is the hostname of the destination", ConfigurationField.Optional.NOT_OPTIONAL));
        configurationRequest.addField(new NumberField(CK_PORT, "Destination port", 12201, "This is the port of the destination", ConfigurationField.Optional.NOT_OPTIONAL));
        final Map<String, String> protocols = ImmutableMap.of(
                "TCP", "TCP",
                "UDP", "UDP");
        configurationRequest.addField(new DropdownField(CK_PROTOCOL, "Protocol", "TCP", protocols, "The protocol used to connect", ConfigurationField.Optional.OPTIONAL));
        return configurationRequest;
    }
View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

    }

    public static class Config implements Transport.Config {
        @Override
        public ConfigurationRequest getRequestedConfiguration() {
            final ConfigurationRequest r = new ConfigurationRequest();

            r.addField(ConfigurationRequest.Templates.bindAddress(CK_BIND_ADDRESS));
            r.addField(ConfigurationRequest.Templates.portNumber(CK_PORT, 5555));
            r.addField(ConfigurationRequest.Templates.recvBufferSize(CK_RECV_BUFFER_SIZE, 1024 * 1024));

            return r;
        }
View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

        this.alertSender.initialize(configuration);
    }

    @Override
    public ConfigurationRequest getRequestedConfiguration() {
        ConfigurationRequest configurationRequest = new ConfigurationRequest();
        configurationRequest.addField(new TextField("sender",
                "Sender",
                "graylog2@example.org",
                "The sender of sent out mail alerts",
                ConfigurationField.Optional.NOT_OPTIONAL));

        configurationRequest.addField(new TextField("subject",
                "E-Mail Subject",
                "Graylog2 alert for stream: ${stream.title}",
                "The subject of sent out mail alerts",
                ConfigurationField.Optional.NOT_OPTIONAL));

        configurationRequest.addField(new TextField("body",
                "E-Mail Body",
                FormattedEmailAlertSender.bodyTemplate,
                "The template to generate the body from",
                ConfigurationField.Optional.OPTIONAL,
                TextField.Attribute.TEXTAREA));
View Full Code Here

Examples of org.graylog2.plugin.configuration.ConfigurationRequest

        }
    }

    @Override
    public ConfigurationRequest getRequestedConfiguration() {
        final ConfigurationRequest configurationRequest = new ConfigurationRequest();
        configurationRequest.addField(new TextField(CK_URL,
                "URL",
                "https://example.org/alerts",
                "The URL to POST to when an alert is triggered",
                ConfigurationField.Optional.NOT_OPTIONAL));
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.