Example usage for java.util Collections singletonMap

List of usage examples for java.util Collections singletonMap

Introduction

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

Prototype

public static <K, V> Map<K, V> singletonMap(K key, V value) 

Source Link

Document

Returns an immutable map, mapping only the specified key to the specified value.

Usage

From source file:org.osiam.auth.oauth_client.ClientEntity.java

@Override
@JsonIgnore//from   w  w  w.ja  v a2  s  .  c o m
public Map<String, Object> getAdditionalInformation() {
    return Collections.singletonMap("validityInSeconds", (Object) validityInSeconds);
}

From source file:info.magnolia.imaging.operations.cropresize.SelectedCropAndResize.java

protected CroppingInfo decode(String jsonString) {
    if (StringUtils.isEmpty(jsonString)) {
        return null;
    }/*from  w w w.  ja va  2s.  c  om*/
    final JSONObject json = JSONObject.fromObject(jsonString);
    final Map map = (Map) JSONObject.toBean(json, Map.class,
            Collections.singletonMap("CropperInfo", CroppingInfo.class));
    return (CroppingInfo) map.get("CropperInfo");
}

From source file:com.logsniffer.reader.grok.GrokTest.java

@Test(expected = GrokException.class)
public void testExceptionInCaseOfInvalidReference() throws GrokException {
    GroksRegistry r = new GroksRegistry();
    r.registerPatternBlocks(//w  w w .j  a v  a2s.  com
            Collections.singletonMap("base", new String[] { "USERNAME %{USER}[a-zA-Z0-9_-]+" }));
}

From source file:de.tud.inf.db.sparqlytics.bench.LDBCBenchmark.java

@Test
public void testQ05() throws Exception {
    test("05", Collections.singletonMap("country", "http://dbpedia.org/resource/Germany"));
}

From source file:edu.utah.further.i2b2.query.criteria.dao.jdbc.SimpleI2b2QueryDao.java

/**
 * Private method to query for the children
 * //from   ww  w  . jav  a2s.com
 * @param itemKey
 * @return
 */
private List<Map<String, Object>> queryForChildren(final String itemKey) {
    final String sql = newStringBuilder().append("SELECT DISTINCT c_basecode, c_hlevel FROM ").append(tableName)
            .append(" WHERE trim(upper(c_fullname)) LIKE trim(upper(:fullname))").append(" order by c_hlevel")
            .toString();
    return jdbcTemplate.queryForList(sql, Collections.singletonMap("fullname", itemKey));
}

From source file:uk.org.taverna.platform.LocalExecutionIT.java

public void testLocalExecution2() throws Exception {
    setup();// w  ww .ja v  a  2s . c om

    WorkflowBundle workflowBundle = loadWorkflow("/t2flow/beanshell.t2flow");
    Workflow workflow = workflowBundle.getMainWorkflow();
    Profile profile = workflowBundle.getMainProfile();

    for (ExecutionEnvironment executionEnvironment : executionEnvironments) {
        Map<String, Data> inputs = Collections.singletonMap("in", dataService.create("test-input"));

        String executionId = executionService.createExecution(executionEnvironment, workflowBundle, workflow,
                profile, inputs);
        WorkflowReport report = executionService.getWorkflowReport(executionId);
        System.out.println(report);
        assertEquals(State.CREATED, report.getState());
        executionService.start(executionId);
        System.out.println(report);

        Map<String, Data> results = report.getOutputs();
        waitForResults(results, report, "out");

        List<Data> result = results.get("out").getElements();
        assertEquals(1000, result.size());
        assertEquals("test-input:0", result.get(0).getValue());
        assertEquals(State.COMPLETED, report.getState());
        System.out.println(report);
    }
}

From source file:org.cloudfoundry.identity.uaa.oauth.ClientAdminBootstrapTests.java

@Test
public void testOverrideClientByDefault() throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("secret", "bar");
    bootstrap.setClients(Collections.singletonMap("foo", map));
    doThrow(new ClientAlreadyExistsException("Planned")).when(clientRegistrationService)
            .addClientDetails(any(ClientDetails.class));
    bootstrap.afterPropertiesSet();//w ww . j a  va 2  s  . c o m
    verify(clientRegistrationService, times(1)).addClientDetails(any(ClientDetails.class));
    verify(clientRegistrationService, times(1)).updateClientDetails(any(ClientDetails.class));
    verify(clientRegistrationService, times(1)).updateClientSecret("foo", "bar");
}

From source file:com.example.app.ui.DemoUserProfileListing.java

@Override
public void handle(SearchUIOperationContext context) {
    // Alternatively, you could use a NavigationLinkColumn instead of an ActionColumn.
    switch (context.getOperation()) {
    case view: {/*  w w  w . j a  va  2 s .  c om*/
        final NavigationDestination destination = new NavigationDestination(USER_PROFILE_VIEWER);
        destination.apply(Collections.singletonMap(URL_PROP_PROFILE, context.getData()));
        destination.actionPerformed(new ActionEvent(this, this, "view"));
        break;
    }
    case edit:
    //case add: /* handled by NavigationAction. */
    {
        final NavigationDestination destination = new NavigationDestination(USER_PROFILE_EDITOR);
        destination.apply(Collections.singletonMap(URL_PROP_PROFILE, context.getData()));
        destination.actionPerformed(new ActionEvent(this, this, "edit"));
        break;
    }
    case delete: {
        _demoUserProfileDAO.deleteUserProfile(context.<DemoUserProfile>getData());
        context.getSearchUI().doAction(SearchUIAction.search);
        break;
    }
    default:
        break;
    }
}

From source file:ru.mystamps.web.dao.impl.JdbcCountryDao.java

@Override
public long countCountriesOfCollection(Integer collectionId) {
    return jdbcTemplate.queryForObject(countCountriesOfCollectionSql,
            Collections.singletonMap("collection_id", collectionId), Long.class);
}

From source file:com.netflix.spinnaker.clouddriver.kubernetes.v2.caching.agent.KubernetesV2CachingAgent.java

protected CacheResult buildCacheResult(KubernetesManifest resource) {
    return buildCacheResult(Collections.singletonMap(resource.getKind(), Collections.singletonList(resource)));
}