List of usage examples for java.util Collections singletonMap
public static <K, V> Map<K, V> singletonMap(K key, V value)
From source file:at.ac.univie.isc.asio.insight.Operation.java
/** * Triggered if an operation fails at any stage. *///from w ww . j a v a 2 s . c o m public static Event failure(final Throwable cause) { final Map<String, String> properties = Collections.singletonMap("message", VndError.labelFor(cause)); return new OperationEvent("failed", properties); }
From source file:com.graphaware.server.CommunityTxParticipationIntegrationTest.java
@Test public void nonExistingTransactionShouldResultInException() { httpClient.get(baseUrl() + "/greeting", Collections.singletonMap("_GA_TX_ID", "1"), HttpStatus.SC_BAD_REQUEST); }
From source file:com.joshlong.activiti.coordinator.registration1.distribution.producer.RegistrationProducerMain.java
/** * generates new processes in response to a read-line * @param ctx//from w w w .ja v a 2 s.co m * @throws Throwable */ static void doReadLine(ApplicationContext ctx) throws Throwable { ProcessEngine processEngine = ctx.getBean(ProcessEngine.class); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true) { System.out.println("which customer would you like to start a fulfillment " + "process for? Enter it, then hit <Enter>:"); line = reader.readLine(); Integer customerId = Integer.parseInt(StringUtils.defaultString(line).trim()); Map<String, Object> vars = Collections.singletonMap("customerId", (Object) customerId); processEngine.getRuntimeService().startProcessInstanceByKey("customer-fullfillment-process", vars); } }
From source file:io.coala.bind.LocalConfig.java
static LocalConfig openYAML(final String yamlPath, final String id, final Map<?, ?>... imports) throws IOException { return GlobalConfig.openYAML(yamlPath).subConfig(id, LocalConfig.class, Collections.singletonMap(ID_KEY, id)); }
From source file:de.perdian.commons.i18n.polyglot.PolyglotInvocationHandlerTest.java
@Test public void testInvoke() { MessageSource messageSource = Mockito.mock(MessageSource.class); PolyglotInvocationInfo invocationInfo = new PolyglotInvocationInfo(); invocationInfo.setKey(UUID.randomUUID().toString()); invocationInfo.setDefaultValue(UUID.randomUUID().toString()); Object[] arguments = new Object[] { "a", 42 }; PolyglotInvocationHandler invocationHandler = new PolyglotInvocationHandler(); invocationHandler.setLocale(Locale.GERMANY); invocationHandler.setMessageSource(messageSource); invocationHandler.setInfoMap(Collections.singletonMap((Method) null, invocationInfo)); invocationHandler.invoke(null, null, arguments); // Make sure all the information get's passed correctly to the // underlaying MessageSource implementation Mockito.verify(messageSource).getMessage(Matchers.eq(invocationInfo.getKey()), Matchers.eq(arguments), Matchers.eq(invocationInfo.getDefaultValue()), Matchers.eq(invocationHandler.getLocale())); }
From source file:sample.actuator.SampleController.java
@RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody//from w ww . j ava 2 s . co m public Map<String, String> hello() { return Collections.singletonMap("message", this.helloWorldService.getHelloMessage()); }
From source file:com.couchbase.client.spring.cache.wiring.CacheEnabledTestConfiguration.java
@Bean public CacheManager cacheManager() { return new CouchbaseCacheManager(Collections.singletonMap(DATA_CACHE_NAME, bucket())); }
From source file:com.thoughtworks.go.remote.work.PluggableArtifactMetadataTest.java
@Test public void shouldAddMetadataWhenMetadataAbsentForPlugin() { final PluggableArtifactMetadata pluggableArtifactMetadata = new PluggableArtifactMetadata(); assertTrue(pluggableArtifactMetadata.getMetadataPerPlugin().isEmpty()); pluggableArtifactMetadata.addMetadata("docker", "installer", Collections.singletonMap("image", "alpine")); assertThat(pluggableArtifactMetadata.getMetadataPerPlugin(), Matchers.hasEntry("docker", Collections.singletonMap("installer", Collections.singletonMap("image", "alpine")))); }
From source file:de.pentasys.playground.springbootexample.SampleController.java
/** * Calls the HelloWorldService to get the hello message * * @return the message/* ww w . jav a 2 s . co m*/ */ @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody public Map<String, String> helloWorld() { return Collections.singletonMap("message", this.helloWorldService.getHelloMessage()); }
From source file:org.cloudfoundry.identity.uaa.config.EnvironmentPropertiesFactoryBeanTests.java
@Test public void testNullProperties() throws Exception { EnvironmentPropertiesFactoryBean factory = new EnvironmentPropertiesFactoryBean(); StandardEnvironment environment = new StandardEnvironment(); environment.getPropertySources()//from w ww . ja va2s. c o m .addFirst(new MapPropertySource("foo", Collections.singletonMap("foo", null))); factory.setEnvironment(environment); Properties properties = factory.getObject(); assertEquals("", properties.get("foo")); }