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:de.sainth.recipe.backend.security.RecipeManagerAuthenticationToken.java

public RecipeManagerAuthenticationToken(Long userId, String role) {
    this.role = role;
    this.authenticated = true;
    this.userId = userId;
    this.permissions = Collections.singletonList(new SimpleGrantedAuthority(role));
}

From source file:jetbrains.buildServer.vsoRooms.rest.impl.StringJsonConverter.java

public List<MediaType> getSupportedMediaTypes() {
    return Collections.singletonList(MediaType.APPLICATION_JSON);
}

From source file:fi.helsinki.opintoni.config.FlammaConfiguration.java

@Bean
public RestTemplate flammaRestTemplate() {
    final AtomFeedHttpMessageConverter converter = new AtomFeedHttpMessageConverter();
    converter.setSupportedMediaTypes(Collections.singletonList(MediaType.TEXT_XML));
    return new RestTemplate(Collections.singletonList(converter));
}

From source file:org.obiba.onyx.core.service.impl.ParticipantHttpMessageConverter.java

public List<MediaType> getSupportedMediaTypes() {
    return Collections.singletonList(new MediaType("text", "xml"));
}

From source file:eu.stratosphere.api.common.operators.util.FieldList.java

public FieldList(Integer fieldId) {
    super(Collections.singletonList(Validate.notNull(fieldId, "The fields ID must not be null.")));
}

From source file:hudson.model.DependencyGraphTest.java

/**
 * Tests triggering downstream projects with DependencyGraph.Dependency
 *///from w  w w.j  a va 2  s . c o m
public void testTriggerJob() throws Exception {
    hudson.quietPeriod = 3;
    Project p = createFreeStyleProject(), down1 = createFreeStyleProject(), down2 = createFreeStyleProject();
    // Add one standard downstream job:
    p.addPublisher(new BuildTrigger(Collections.singletonList(down1), Result.SUCCESS));
    // Add one downstream job with custom Dependency impl:
    p.getBuildersList().add(new TestDeclarer(Result.UNSTABLE, down2));
    hudson.rebuildDependencyGraph();
    // First build won't trigger down1 (Unstable doesn't meet threshold)
    // but will trigger down2 (build #1 is odd).
    Build b = (Build) p.scheduleBuild2(0, new Cause.UserCause()).get();
    String log = getLog(b);
    Queue.Item q = hudson.getQueue().getItem(down1);
    assertNull("down1 should not be triggered: " + log, q);
    assertNull("down1 should not be triggered: " + log, down1.getLastBuild());
    q = hudson.getQueue().getItem(down2);
    assertNotNull("down2 should be in queue (quiet period): " + log, q);
    Run r = (Run) q.getFuture().get(6, TimeUnit.SECONDS);
    assertNotNull("down2 should be triggered: " + log, r);
    assertNotNull("down2 should have MailMessageIdAction", r.getAction(MailMessageIdAction.class));
    // Now change to success result..
    p.getBuildersList().replace(new TestDeclarer(Result.SUCCESS, down2));
    hudson.rebuildDependencyGraph();
    // ..and next build will trigger down1 (Success meets threshold),
    // but not down2 (build #2 is even)
    b = (Build) p.scheduleBuild2(0, new Cause.UserCause()).get();
    log = getLog(b);
    q = hudson.getQueue().getItem(down2);
    assertNull("down2 should not be triggered: " + log, q);
    assertEquals("down2 should not be triggered: " + log, 1, down2.getLastBuild().getNumber());
    q = hudson.getQueue().getItem(down1);
    assertNotNull("down1 should be in queue (quiet period): " + log, q);
    r = (Run) q.getFuture().get(6, TimeUnit.SECONDS);
    assertNotNull("down1 should be triggered", r);
}

From source file:com.consol.citrus.admin.converter.action.AssertContainerConverter.java

@Override
public TestAction convert(AssertModel model) {
    TestAction action = new TestAction(getActionType(), getSourceModelClass());
    addActionProperties(action, model);//ww  w. j av a 2 s .com

    if (model.getWhen() != null) {
        action.setActions(getNestedActions(Collections.singletonList(getNestedAction(model))));
    }

    return action;
}

From source file:com.cloudera.cdk.morphline.hadoop.sequencefile.ParseTextMyWritableBuilder.java

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

From source file:com.epam.cme.storefront.controllers.pages.HomePageController.java

@RequestMapping(method = RequestMethod.GET)
public String home(@RequestParam(value = "logout", defaultValue = "false") final boolean logout,
        final Model model, final RedirectAttributes redirectModel) throws CMSItemNotFoundException {
    if (logout) {
        redirectModel.addFlashAttribute(GlobalMessages.INFO_MESSAGES_HOLDER,
                Collections.singletonList("account.confirmation.signout.title"));
        return REDIRECT_PREFIX + ROOT;
    }/*from w w w.  j  av  a2 s. c  o  m*/

    storeCmsPageInModel(model, getContentPageForLabelOrId(null));
    setUpMetaDataForContentPage(model, getContentPageForLabelOrId(null));
    updatePageTitle(model, getContentPageForLabelOrId(null));

    return getViewForPage(model);
}

From source file:org.excalibur.aqmp.handler.SequenceScorePairHandler.java

public void handle(SequencePair pair) {
    this.handle(Collections.singletonList(pair));
}