Example usage for java.util Collections singletonList

List of usage examples for java.util Collections singletonList

Introduction

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

Prototype

public static <T> List<T> singletonList(T o) 

Source Link

Document

Returns an immutable list containing only the specified object.

Usage

From source file:com.epam.ta.reportportal.database.triggers.DeleteLaunchTriggerTest.java

@Test
public void testDeleteByAsList() {
    launchRepository.delete(Collections.singletonList(LAUNCH_ID));
    Assert.assertNull(launchRepository.findOne(LAUNCH_ID));
    Assert.assertTrue(testItemRepository.findIdsByLaunch(LAUNCH_ID).isEmpty());
}

From source file:com.jakduk.api.configuration.ApiSwaggerConfig.java

@Bean
public Docket api() {

    Set<String> protocols = new HashSet<>();
    protocols.add(environment.getProperty("swagger.protocol"));

    Set<String> producesList = new HashSet<>();
    producesList.add("application/json");

    return new Docket(DocumentationType.SWAGGER_2).select()
            //                .apis(RequestHandlerSelectors.basePackage("com.jakduk.restcontroller"))
            .paths(PathSelectors.ant("/api/**")).build().protocols(protocols)
            .host(environment.getProperty("swagger.host")).apiInfo(apiInfo()).useDefaultResponseMessages(false)
            .securitySchemes(Collections.singletonList(apiKey())).produces(producesList);
}

From source file:ddf.catalog.registry.transformer.Gml3ToWkt.java

public Gml3ToWkt(Parser parser) {
    this.parser = parser;
    this.configurator = parser.configureParser(
            Collections.singletonList(AbstractGeometryType.class.getPackage().getName()),
            Gml3ToWkt.class.getClassLoader());
}

From source file:com.tesora.dve.sql.node.expression.IntervalExpression.java

@SuppressWarnings("unchecked")
@Override// ww w . ja va 2s  .  co m
public <T extends Edge<?, ?>> List<T> getEdges() {
    return (List<T>) Collections.singletonList(target);
}

From source file:org.openmrs.module.bahmniexports.example.domain.trade.internal.FlatFileCustomerCreditDao.java

@Override
public void writeCredit(CustomerCredit customerCredit) throws Exception {

    if (!opened) {
        open(new ExecutionContext());
    }//from   w w w .jav  a 2  s .  co m

    String line = "" + customerCredit.getName() + separator + customerCredit.getCredit();

    itemWriter.write(Collections.singletonList(line));
}

From source file:uk.ac.ebi.eva.utils.ConnectionHelper.java

public static MongoClient getMongoClient(String hosts, String authenticationDB, String user, char[] password)
        throws UnknownHostException {
    if (mongoClientWithAuthentication == null) {
        mongoClientWithAuthentication = new MongoClient(parseServerAddresses(hosts),
                Collections.singletonList(MongoCredential.createCredential(user, authenticationDB, password)));
    }/*from   ww  w . ja  v  a  2s . co m*/

    return mongoClientWithAuthentication;
}

From source file:com.cloudera.cdk.morphline.hadoop.core.DownloadHdfsFileBuilder.java

@Override
public Collection<String> getNames() {
    return Collections.singletonList("downloadHdfsFile");
}

From source file:cern.molr.mole.impl.RunnableSpringMole.java

@Override
public List<Method> discover(Class<?> classType) {
    if (null == classType) {
        throw new IllegalArgumentException("Class type cannot be null");
    }//from w  ww . j a va  2s  .  c o m
    if (Runnable.class.isAssignableFrom(classType)
            && classType.getAnnotation(MoleSpringConfiguration.class) != null) {
        try {
            return Collections.singletonList(classType.getMethod("run"));
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    return Collections.emptyList();
}

From source file:org.trustedanalytics.metadata.parser.RestOperationsFactory.java

public RestOperations oAuth(Authentication authentication) {
    final String token = tokenRetriever.getAuthToken(authentication);
    final RestTemplate restTemplate = new RestTemplate();

    restTemplate.setInterceptors(Collections
            .singletonList(new HeaderAddingHttpInterceptor(HttpHeaders.AUTHORIZATION, "bearer " + token)));

    return restTemplate;
}

From source file:org.commonjava.cartographer.result.ProjectPathsResultTest.java

@Test
public void jsonRoundTrip() throws Exception {
    ProjectPathsResult in = new ProjectPathsResult();
    ProjectVersionRef ref = new SimpleProjectVersionRef("org.foo", "bar", "1");
    in.addPath(ref,// ww w .ja v  a 2s.  c o m
            new ProjectPath(
                    Collections.singletonList(new SimpleParentRelationship(URI.create("http://nowhere.com"),
                            ref, new SimpleProjectVersionRef("org.dep", "project", "1.1")))));

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModules(new ProjectVersionRefSerializerModule(), new ProjectRelationshipSerializerModule());
    mapper.enable(SerializationFeature.INDENT_OUTPUT);
    mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
    mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);

    String json = mapper.writeValueAsString(in);

    Logger logger = LoggerFactory.getLogger(getClass());
    logger.debug(json);

    ProjectPathsResult out = mapper.readValue(json, ProjectPathsResult.class);
}