List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:com.shmsoft.dmass.ec2.EC2Agent.java
public void launchInstances() throws EC2Exception { Settings settings = Settings.getSettings(); String amiName = settings.getClusterAmi(); LaunchConfiguration launchConfiguration = new LaunchConfiguration(amiName); launchConfiguration.setKeyName(keyName); launchConfiguration.setSecurityGroup(Collections.singletonList(getSecurityGroup())); launchConfiguration.setAvailabilityZone(availabilityZone); launchConfiguration.setMinCount(clusterSize); launchConfiguration.setMaxCount(clusterSize); String instanceTypeStr = settings.getInstanceType(); InstanceType instanceType = InstanceType.getTypeFromString(instanceTypeStr); launchConfiguration.setInstanceType(instanceType); ReservationDescription reservationDescription = jec2.runInstances(launchConfiguration); }
From source file:gov.nih.nci.caarray.platforms.AbstractDataFileHandler.java
/** * {@inheritDoc}/* www.j a v a2 s . c o m*/ */ @Override public List<String> getHybridizationNames() { return Collections.singletonList(FilenameUtils.getBaseName(this.caArrayFile.getName())); }
From source file:com.chariotsolutions.crowd.connector.PrincipalRowMapper.java
public RemotePrincipal mapRow(ResultSet rs, int i) throws SQLException { long id = rs.getLong("id"); String username = rs.getString("user_name"); String email = rs.getString("email"); String firstName = rs.getString("first_name"); String lastName = rs.getString("last_name"); String company = rs.getString("company"); String title = rs.getString("title"); String phone = rs.getString("phone"); String country = rs.getString("country"); String password = rs.getString("password"); PasswordCredential credential = new PasswordCredential(password, true); boolean active = !rs.getBoolean("account_disabled"); Date created = rs.getDate("created"); RemotePrincipal principal = new RemotePrincipal(); principal.setID(id);// ww w .j a v a2 s .c o m principal.setName(username); principal.setEmail(email); principal.setActive(active); principal.setAttribute(RemotePrincipal.FIRSTNAME, firstName); principal.setAttribute(RemotePrincipal.LASTNAME, lastName); principal.setAttribute(RemotePrincipal.DISPLAYNAME, firstName + " " + lastName); principal.setAttribute("company", company); principal.setAttribute("title", title); principal.setAttribute("phone", phone); principal.setAttribute("country", country); principal.setConception(created); principal.setCredentials(Collections.singletonList(credential)); principal.setCredentialHistory(Collections.singletonList(credential)); return principal; }
From source file:com.stratio.cassandra.lucene.schema.mapping.SingleColumnMapper.java
/** * Builds a new {@link SingleColumnMapper} supporting the specified types for indexing and clustering. * * @param field The name of the field. * @param column The name of the column to be mapped. * @param indexed If the field supports searching. * @param sorted If the field supports sorting. * @param analyzer The name of the analyzer to be used. * @param base The Lucene type for this mapper. * @param supportedTypes The supported Cassandra types for indexing. *///from w w w . j a v a 2 s . c o m public SingleColumnMapper(String field, String column, Boolean indexed, Boolean sorted, String analyzer, Class<T> base, AbstractType<?>... supportedTypes) { super(field, indexed, sorted, analyzer, Collections.singletonList(column == null ? field : column), supportedTypes); if (StringUtils.isWhitespace(column)) { throw new IndexException("Column must not be whitespace, but found '%s'", column); } this.column = column == null ? field : column; this.base = base; }
From source file:com.create.validation.PropertyValidationErrorsProviderTest.java
private List<ObjectError> getObjectErrors() { final ObjectError objectError = getObjectError(); return Collections.singletonList(objectError); }
From source file:com.orange.ngsi2.model.RegistrationTest.java
@Test public void serializationRegistrationTest() throws JsonProcessingException, MalformedURLException { ObjectWriter writer = Utils.objectMapper.writer(new DefaultPrettyPrinter()); Registration registration = new Registration("abcde", new URL("http://localhost:1234")); registration.setDuration("PT1M"); SubjectEntity subjectEntity = new SubjectEntity(); subjectEntity.setType(Optional.of("Room")); SubjectRegistration subjectRegistration = new SubjectRegistration(Collections.singletonList(subjectEntity), Collections.singletonList("humidity")); registration.setSubject(subjectRegistration); String json = writer.writeValueAsString(registration); String jsonString = "{\n" + " \"id\" : \"abcde\",\n" + " \"subject\" : {\n" + " \"entities\" : [ {\n" + " \"type\" : \"Room\"\n" + " } ],\n" + " \"attributes\" : [ \"humidity\" ]\n" + " },\n" + " \"callback\" : \"http://localhost:1234\",\n" + " \"duration\" : \"PT1M\"\n" + "}"; assertEquals(jsonString, json);//from w ww . j av a 2s .c om }
From source file:org.apereo.services.persondir.support.AbstractQueryPersonAttributeDaoTest.java
public void testDefaultAttributeNameUsage() { this.testQueryPersonAttributeDao.getUserAttributes("eric"); final List<List<Object>> args = this.testQueryPersonAttributeDao.getArgs(); //Do asList for an easy comparison assertEquals(Collections.singletonList(Collections.singletonList("eric")), args); }
From source file:ru.mystamps.web.support.togglz.TogglzConfig.java
@Bean public ServletRegistrationBean getTogglzConsole() { ServletRegistrationBean servlet = new ServletRegistrationBean(); servlet.setName("TogglzConsole"); servlet.setServlet(new TogglzConsoleServlet()); // See also src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java servlet.setUrlMappings(Collections.singletonList(Url.TOGGLZ_CONSOLE_PAGE + "/*")); return servlet; }
From source file:fi.helsinki.opintoni.service.portfolio.PortfolioStudyAttainmentWhitelistServiceTest.java
@Test @Transactional/*from w w w . j av a2 s . c om*/ public void shouldUpdatePortfolioWhitelist() { StudyAttainmentWhitelistDto whitelistDto = new StudyAttainmentWhitelistDto(); whitelistDto.oodiStudyAttainmentIds = Arrays.asList(OODI_ATTAINMENT_ID_1, OODI_ATTAINMENT_ID_2); whitelistService.update(PORTFOLIO_ID, whitelistDto); StudyAttainmentWhitelist whitelist = whitelistRepository.findByPortfolioId(PORTFOLIO_ID).get(); assertThat(whitelist.whitelistEntries.get(0).studyAttainmentId).isEqualTo(OODI_ATTAINMENT_ID_1); assertThat(whitelist.whitelistEntries.get(1).studyAttainmentId).isEqualTo(OODI_ATTAINMENT_ID_2); whitelistDto.oodiStudyAttainmentIds = Collections.singletonList(OODI_ATTAINMENT_ID_3); whitelistService.update(PORTFOLIO_ID, whitelistDto); whitelist = whitelistRepository.findByPortfolioId(PORTFOLIO_ID).get(); assertThat(whitelist.whitelistEntries.get(0).studyAttainmentId).isEqualTo(OODI_ATTAINMENT_ID_3); }