org.apache.brooklyn.util.collections.MutableMap.builder()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.brooklyn.util.collections.MutableMap.builder()方法的一些代码示例,展示了MutableMap.builder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableMap.builder()方法的具体详情如下:
包路径:org.apache.brooklyn.util.collections.MutableMap
类名称:MutableMap
方法名:builder

MutableMap.builder介绍

暂无

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Beta
public Map<String, String> loadDeserializingMapping() {
  synchronized (this) {
    if (cache == null) {
      MutableMap.Builder<String, String> builder = MutableMap.<String, String>builder();
      for (ConfigLoader loader : loaders) {
        builder.putAll(loader.load());
      }
      cache = builder.build();
      LOG.debug("Config cache loaded, size {}", cache.size());
    }
    return cache;
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-webapp

@Override
public Map<String, String> getShellEnvironment() {
  return MutableMap.<String, String>builder().putAll(super.getShellEnvironment())
      .put("PORT", Integer.toString(getHttpPort()))
      .build();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

public static Map<String,Object> getBasicAddonSubstitutions(EntityDriver driver, String addon) {
  return MutableMap.<String,Object>builder()
      .putAll(getBasicEntitySubstitutions(driver))
      .put("addon", addon)
      .build();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

/**
 * Use RMI agent to provide JMX.
 */
@Override
public Map<String, String> getShellEnvironment() {
  return MutableMap.<String, String>builder()
      .putAll(super.getShellEnvironment())
      .renameKey("JAVA_OPTS", "KAFKA_JMX_OPTS")
      .build();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

@Override
  public Map<String,String> getShellEnvironment() {
    return MutableMap.<String,String>builder()
        .putAll(super.getShellEnvironment())
        .putIfNotNull("CLASSPATH", getClasspath())
        .build();
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

@Test
public void testBasicJmxFromConfig() {
  assertJmxWithPropsHasPhrases(
      MutableMap.builder().
      put(UsesJmx.USE_JMX, true).
      build(), 
    EXPECTED_BASIC_JMX_OPTS,
    FORBIDDEN_BASIC_JMX_OPTS);
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

@Override
protected Map getCustomJavaSystemProperties() {
  return MutableMap.builder()
      .putAll(super.getCustomJavaSystemProperties())
      .putAll(getEntity().getJvmDefines())
      .build();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

protected void runTest(Map<String,?> flags) throws Exception {
  String tag = getClass().getSimpleName().toLowerCase();
  Map<String,?> allFlags = MutableMap.<String,Object>builder()
      .put("tags", ImmutableList.of(tag))
      .putAll(flags)
      .build();
  jcloudsLocation = mgmt.getLocationRegistry().getLocationManaged(PROVIDER, allFlags);
  doTest(jcloudsLocation);
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Test(expectedExceptions=IllegalArgumentException.class, expectedExceptionsMessageRegExp=".*Invalid arguments.*missing argument.*stringParam.*")
public void testPrepareArgsFromMapThrowsIfMissing() throws Exception {
  MutableMap<Object, Object> mapMissingArg = MutableMap.builder()
      .putAll(argsMap)
      .remove("stringParam")
      .build();
  EffectorUtils.prepareArgsForEffector(effector, mapMissingArg);
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base

@Override
protected Location createLocation() {
  // Image: {id=CENTOS_6_64, providerId=CENTOS_6_64, os={family=centos, version=6.5, description=CentOS / CentOS / 6.5-64 LAMP for Bare Metal, is64Bit=true}, description=CENTOS_6_64, status=AVAILABLE, loginUser=root}
  Map<String, ?> allFlags = MutableMap.<String, Object>builder()
      .put("provider", PROVIDER)
      .put("tags", ImmutableList.of(getClass().getName()))
      .put("vmNameMaxLength", 30)
      .put("imageId", "CENTOS_6_64")
      .build();
  return mgmt.getLocationRegistry().getLocationManaged(PROVIDER, allFlags);
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .put("QPID_HOME", getRunDir())
        .put("QPID_WORK", getRunDir())
        .renameKey("JAVA_OPTS", "QPID_OPTS")
        .build();
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String,String>builder()
        .putAll(super.getShellEnvironment())
        .put("ACTIVEMQ_HOME", getRunDir())
        .put("ACTIVEMQ_PIDFILE", getPidFile())
        .renameKey("JAVA_OPTS", "ACTIVEMQ_OPTS")
        .build();
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public EnricherSpec<? extends Enricher> build() {
  return super.build().configure(MutableMap.builder()
          .putIfNotNull(Propagator.PRODUCER, fromEntity)
          .putIfNotNull(Propagator.PRODUCER, fromEntitySupplier)
          .putIfNotNull(Propagator.SENSOR_MAPPING, propagating)
          .putIfNotNull(Propagator.PROPAGATING_ALL, propagatingAll)
          .putIfNotNull(Propagator.PROPAGATING_ALL_BUT, propagatingAllBut)
          .build());
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public EnricherSpec<?> build() {
  return super.build().configure(MutableMap.builder()
          .put(UpdatingMap.TARGET_SENSOR, targetSensor)
          .put(UpdatingMap.SOURCE_SENSOR, fromSensor)
          .putIfNotNull(UpdatingMap.KEY_IN_TARGET_SENSOR, key)
          .put(UpdatingMap.COMPUTING, computing)
          .putIfNotNull(UpdatingMap.REMOVING_IF_RESULT_IS_NULL, removingIfResultIsNull)
          .build());
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-webapp

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .put("JETTY_RUN", getRunDir())
        .put("JETTY_HOME", getRunDir())
        .put("JETTY_LOGS", Os.mergePathsUnix(getRunDir(), "logs"))
        .put("JETTY_PORT", getHttpPort().toString())
        .renameKey("JAVA_OPTS", "JAVA_OPTIONS")
        .build();
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public EnricherSpec<?> build() {
  return super.build().configure(MutableMap.builder()
      .put(Reducer.SOURCE_SENSORS, reducing)
      .put(Reducer.PRODUCER, fromEntity)
      .put(Reducer.TARGET_SENSOR, publishing)
      .putIfNotNull(Reducer.REDUCER_FUNCTION, computing)
      .putIfNotNull(Reducer.REDUCER_FUNCTION_TRANSFORMATION, functionName)
      .putIfNotNull(Reducer.PARAMETERS, parameters)
      .build()
  );
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Test
public void testConfigSetterOverridesConstructorValue() throws Exception {
  MyEnricher enricher = new MyEnricher(MutableMap.builder()
      .put(MyEnricher.STR_KEY, "aval")
      .build());
  enricher.config().set(MyEnricher.STR_KEY, "diffval");
  app.enrichers().add(enricher);
  
  assertEquals(enricher.getConfig(MyEnricher.STR_KEY), "diffval");
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

@Override
public Map<String, String> getShellEnvironment() {
  return MutableMap.<String, String>builder()
      .putAll(super.getShellEnvironment())
      .put("RABBITMQ_HOME", getRunDir())
      .put("RABBITMQ_LOG_BASE", getRunDir())
      .put("RABBITMQ_NODENAME", getEntity().getId())
      .put("RABBITMQ_NODE_PORT", getAmqpPort().toString())
      .put("RABBITMQ_PID_FILE", getRunDir()+"/"+getPidFile())
      .put("RABBITMQ_CONFIG_FILE", getConfigPath())
      .build();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Test
public void testEnricherSpecThrowsOnPropagatesAndPropagatesAllSet() throws Exception {
  try {
    app.enrichers().add(EnricherSpec.create(Propagator.class)
        .configure(MutableMap.builder()
            .put(Propagator.PRODUCER, entity)
            .put(Propagator.PROPAGATING, ImmutableList.of(TestEntity.NAME))
            .put(Propagator.PROPAGATING_ALL, true)
            .build()));
  } catch (Exception e) {
    IllegalStateException ise = Exceptions.getFirstThrowableOfType(e, IllegalStateException.class);
    if (ise == null) throw e;
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds

@Test(groups = "Live", dataProvider="cloudAndImageNames")
public void testCreatesWindowsVm(String locationSpec, String imageNameRegex, Map<String, ?> additionalConfig) throws Exception {
  jcloudsLocation = (JcloudsLocation) managementContext.getLocationRegistry().getLocationManaged(locationSpec);
  JcloudsWinRmMachineLocation machine = obtainWinrmMachine(MutableMap.<String,Object>builder()
      .putIfAbsent("inboundPorts", ImmutableList.of(5986, 5985, 3389))
      .put(JcloudsLocation.IMAGE_NAME_REGEX.getName(), imageNameRegex)
      .put(JcloudsLocation.USE_JCLOUDS_SSH_INIT.getName(), false)
      .put(JcloudsLocation.OS_FAMILY_OVERRIDE.getName(), OsFamily.WINDOWS)
      .putAll(additionalConfig != null ? additionalConfig : ImmutableMap.<String, Object>of())
      .build());
  assertWinrmable(machine);
}

相关文章