Example usage for java.util Collections emptyMap

List of usage examples for java.util Collections emptyMap

Introduction

In this page you can find the example usage for java.util Collections emptyMap.

Prototype

@SuppressWarnings("unchecked")
public static final <K, V> Map<K, V> emptyMap() 

Source Link

Document

Returns an empty map (immutable).

Usage

From source file:io.cloudslang.lang.systemtests.BindingScopeTest.java

@Test
public void testStepPublishValues() throws Exception {
    URL resource = getClass().getResource("/yaml/binding_scope_flow.sl");
    URI operation = getClass().getResource("/yaml/binding_scope_op.sl").toURI();
    Set<SlangSource> path = Sets.newHashSet(SlangSource.fromFile(operation));
    CompilationArtifact compilationArtifact = slang.compile(SlangSource.fromFile(resource.toURI()), path);

    Map<String, Value> userInputs = Collections.emptyMap();
    Set<SystemProperty> systemProperties = Collections.emptySet();

    // trigger ExecutionPlan
    RuntimeInformation runtimeInformation = triggerWithData(compilationArtifact, userInputs, systemProperties);

    Map<String, StepData> executionData = runtimeInformation.getSteps();

    StepData stepData = executionData.get(FIRST_STEP_PATH);
    Assert.assertNotNull("step data is null", stepData);

    verifyStepPublishValues(stepData);//from   w w  w . j  av  a2s. co  m
}

From source file:fr.inria.atlanmod.neoemf.data.blueprints.option.BlueprintsResourceSaveTest.java

@Test
public void testSaveGraphResourceNoOption() throws IOException, ConfigurationException {
    resource.save(Collections.emptyMap());

    File configFile = new File(file() + configFileName);
    assertThat(configFile).exists(); // "Config file does not exist"

    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assertThat(configuration.containsKey(BlueprintsResourceOptions.GRAPH_TYPE)).isTrue();
    assertThat(configuration.getString(BlueprintsResourceOptions.GRAPH_TYPE))
            .isEqualTo(BlueprintsResourceOptions.GRAPH_TYPE_DEFAULT);
    assertThat(getKeyCount(configuration)).isEqualTo(3); // "Too much content in the .properties file"
}

From source file:com.arpnetworking.metrics.vertx.EventBusSinkTest.java

@Test
public void testRecordWithEmptyMaps() throws JsonProcessingException {
    final EventBus eventBus = Mockito.mock(EventBus.class);
    final Sink sink = new EventBusSink.Builder().setEventBus(eventBus).setSinkAddress("sinkAddress").build();
    sink.record(new SinkVerticle.DefaultEvent.Builder().setAnnotations(Collections.emptyMap())
            .setCounterSamples(Collections.emptyMap()).setGaugeSamples(Collections.emptyMap())
            .setTimerSamples(Collections.emptyMap()).build());
    final String data = OBJECT_MAPPER.writeValueAsString(new SinkVerticle.DefaultEvent.Builder()
            .setAnnotations(Collections.emptyMap()).setTimerSamples(Collections.emptyMap())
            .setCounterSamples(Collections.emptyMap()).setGaugeSamples(Collections.emptyMap()).build());
    Mockito.verify(eventBus).publish("sinkAddress", data);
}

From source file:iddb.web.security.service.UserServiceFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    this.context = filterConfig.getServletContext();
    Map<String, String> local = SecurityConfig.getInstance().getSection("urls");
    if (local == null) {
        urls = Collections.emptyMap();
    } else {//from  w w w  .  jav  a  2 s.c o  m
        urls = new LinkedHashMap<String, Set<String>>();
        for (Entry<String, String> entry : local.entrySet()) {
            Set<String> s = new LinkedHashSet<String>(Arrays.asList(entry.getValue().split(",")));
            urls.put(entry.getKey(), s);
        }
    }
}

From source file:org.zalando.github.spring.OrganizationsTemplate.java

protected List<Organization> listOrganizations(String path) {
    return listOrganizations(path, Collections.emptyMap());
}

From source file:de.xwic.appkit.core.remote.server.ParameterProvider.java

/**
 * @param request//  www.  j ava 2 s  .c o  m
 * @throws IOException
 */
public ParameterProvider(final HttpServletRequest request) throws IOException {
    this.request = request;

    multipart = isMultipart(request);

    if (multipart) {
        int maxPostSize = Integer.MAX_VALUE; // 2gb
        //         int maxPostSize = 1024 * 5120; // 5mb
        int memoryUsage = 1024 * 1024;

        Upload upload = new Upload(request, getUploadDir(), maxPostSize, memoryUsage);
        multiPartParams = unmodifiable(upload.getParams());
        files = unmodifiable(upload.getFiles());
    } else {
        multiPartParams = Collections.emptyMap();
        files = Collections.emptyMap();
    }
}

From source file:de.uniulm.omi.cloudiator.visor.rest.entities.MonitorDto.java

public Map<String, String> getMonitorContext() {
    if (monitorContext == null) {
        return Collections.emptyMap();
    }//  w w  w.j  a v  a 2s  .c o  m
    return monitorContext;
}

From source file:com.qwazr.library.LibraryManagerImpl.java

@Override
public void close() {
    mapLock.w.lock();/*  ww w. j  a  v a  2  s.c o m*/
    try {
        libraryFileMap.clear();
        IOUtils.close(this.values());
        setMap(Collections.emptyMap());
    } finally {
        mapLock.w.unlock();
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.BrowseDataGetter.java

@Override
public Map<String, Object> getData(ServletContext context, VitroRequest vreq, String pageUri,
        Map<String, Object> page) {
    try {//  www  .j  a  va2  s  .c  o  m
        Map params = vreq.getParameterMap();

        Mode mode = getMode(vreq, params);
        switch (mode) {
        case VCLASS_ALPHA:
            return doClassAlphaDisplay(params, vreq, context);
        case CLASS_GROUP:
            return doClassGroupDisplay(params, vreq, context);
        case VCLASS:
            return doClassDisplay(params, vreq, context);
        case ALL_CLASS_GROUPS:
            return doAllClassGroupsDisplay(params, page, vreq, context);
        default:
            return doAllClassGroupsDisplay(params, page, vreq, context);
        }
    } catch (Throwable th) {
        log.error(th, th);
        return Collections.emptyMap();
    }
}

From source file:org.elasticsearch.smoketest.SmokeTestWatcherWithSecurityIT.java

@Before
public void startWatcher() throws Exception {
    StringEntity entity = new StringEntity("{ \"value\" : \"15\" }", ContentType.APPLICATION_JSON);
    assertOK(adminClient().performRequest("PUT", "my_test_index/doc/1",
            Collections.singletonMap("refresh", "true"), entity));

    // delete the watcher history to not clutter with entries from other test
    adminClient().performRequest("DELETE", ".watcher-history-*", Collections.emptyMap());

    // create one document in this index, so we can test in the YAML tests, that the index cannot be accessed
    Response resp = adminClient().performRequest("PUT", "/index_not_allowed_to_read/doc/1",
            Collections.emptyMap(), new StringEntity("{\"foo\":\"bar\"}", ContentType.APPLICATION_JSON));
    assertThat(resp.getStatusLine().getStatusCode(), is(201));

    assertBusy(() -> {// ww  w.j  ava  2  s .co  m
        try {
            Response statsResponse = adminClient().performRequest("GET", "_xpack/watcher/stats");
            ObjectPath objectPath = ObjectPath.createFromResponse(statsResponse);
            String state = objectPath.evaluate("stats.0.watcher_state");

            switch (state) {
            case "stopped":
                Response startResponse = adminClient().performRequest("POST", "_xpack/watcher/_start");
                assertOK(startResponse);
                String body = EntityUtils.toString(startResponse.getEntity());
                assertThat(body, containsString("\"acknowledged\":true"));
                break;
            case "stopping":
                throw new AssertionError("waiting until stopping state reached stopped state to start again");
            case "starting":
                throw new AssertionError("waiting until starting state reached started state");
            case "started":
                // all good here, we are done
                break;
            default:
                throw new AssertionError("unknown state[" + state + "]");
            }
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    });

    assertBusy(() -> {
        for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES) {
            assertOK(adminClient().performRequest("HEAD", "_template/" + template));
        }
    });
}