Example usage for java.util Collections singleton

List of usage examples for java.util Collections singleton

Introduction

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

Prototype

public static <T> Set<T> singleton(T o) 

Source Link

Document

Returns an immutable set containing only the specified object.

Usage

From source file:com.hp.autonomy.frontend.find.idol.beanconfiguration.ReverseProxyIdolSecurityCustomizer.java

@Override
public Collection<AuthenticationProvider> getAuthenticationProviders() {
    return Collections.singleton(idolPreAuthenticatedAuthenticationProvider);
}

From source file:ch.ledcom.jpreseed.UsbCreatorTest.java

@Test
public void createUsb() throws IOException {
    Date startTime = new Date();
    ByteBuffer sysLinuxCfg = ByteBuffer.wrap("sysLinuxCfg".getBytes());
    Set<Path> preseeds = Collections.singleton(HELLO_WORLD_TXT);

    try (InputStream srcBootImg = Files.newInputStream(VFAT_IMG_GZ);
            GZIPOutputStream newBootImg = new GZIPOutputStream(Files.newOutputStream(NEW_IMAGE))) {
        new UsbCreator().create(srcBootImg, newBootImg, sysLinuxCfg, preseeds);
    }/*from  ww w  . j a  va2 s.  co m*/

    assertThat(NEW_IMAGE).exists();

    FileSystem fileSystem = FileSystemFactory.create(RamDisk.readGzipped(NEW_IMAGE.toFile()), true);

    FsDirectoryEntry newInitRdGzEntry = fileSystem.getRoot().getEntry(INITRD_GZ);
    assertThat(newInitRdGzEntry).hasBeenModifiedAt(startTime, 2000);
    assertThat(fileSystem.getRoot().getEntry(SYSLINUX_CFG)).hasBeenModifiedAt(startTime, 2000);

    CpioArchiveInputStream initRdCpio = getCpioArchiveInputStream(newInitRdGzEntry);
    assertThat(initRdCpio).hasSingleEntry(HELLO_WORLD_TXT.getFileName().toString());
}

From source file:com.example.auth.ClientDetailsImpl.java

@Override
public Set<String> getRegisteredRedirectUri() {
    return Collections.singleton(client.getRedirectUri());
}

From source file:com.example.oauth.Authentication.java

private OAuth2Request request() {
    final ClientApplicationEntity clientApplication = accessTokenEntity.getClientApplication();
    return new OAuth2Request(Collections.emptyMap(), Long.toHexString(clientApplication.getId()),
            resourceUserAuthentication.getAuthorities(), true, accessToken.getScope(),
            Collections.singleton(ResourceConfig.RESOURCE_ID), clientApplication.getRedirectUri(),
            Collections.emptySet(), Collections.emptyMap());
}

From source file:ch.cyberduck.cli.SingleTransferItemFinder.java

@Override
public Set<TransferItem> find(final CommandLine input, final TerminalAction action, final Path remote) {
    if (input.getOptionValues(action.name()).length == 2) {
        switch (action) {
        case download:
            return new DownloadTransferItemFinder().find(input, action, remote);
        case upload:
        case synchronize:
            return new UploadTransferItemFinder().find(input, action, remote);
        }// w ww . java2s. co  m
    } else {
        switch (action) {
        case upload:
        case synchronize:
            return Collections.emptySet();
        }
    }
    // Relative to current working directory using prefix finder.
    return Collections
            .singleton(new TransferItem(remote, LocalFactory.get(prefixer.normalize(remote.getName()))));
}

From source file:com.redhat.red.build.koji.model.json.KojiImportTest.java

@Test
public void jsonRoundTrip() throws VerificationException, IOException {
    KojiImport info = new KojiImport(KojiJsonConstants.DEFAULT_METADATA_VERSION, newBuildDescription(),
            Collections.singleton(newBuildRoot()),
            Arrays.asList(newBuildOutput(1001, "foo-1.jar"), newLogOutput(1001, "build.log")).stream()
                    .collect(Collectors.toSet()));

    String json = mapper.writeValueAsString(info);
    System.out.println(json);//from w  ww . j av a2  s.c  o m

    KojiImport out = mapper.readValue(json, KojiImport.class);

    assertThat(out.getBuild(), equalTo(info.getBuild()));
}

From source file:org.fenixedu.bennu.spring.converters.UserFromUsernameConverter.java

@Override
public Set<ConvertiblePair> getConvertibleTypes() {
    return Collections.singleton(new ConvertiblePair(String.class, User.class));
}

From source file:com.orange.ngsi2.model.ErrorTest.java

@Test
public void checkSerializationComplete() throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module());

    Error parseError = new Error("400");
    parseError.setDescription(Optional.of("The incoming JSON payload cannot be parsed"));
    parseError.setAffectedItems(Optional.of(Collections.singleton("entities")));
    String json = objectMapper.writeValueAsString(parseError);
    assertTrue(json.contains("error"));
    assertTrue(json.contains("description"));
    assertTrue(json.contains("affectedItems"));
}

From source file:com.kagilum.plugins.icescrum.IceScrumProjectProperty.java

@Override
public Collection<? extends Action> getJobActions(AbstractProject<?, ?> job) {
    if (settings != null) {
        return Collections.singleton(new IceScrumLinkAction(this));
    }// w ww  .ja  v  a 2 s.c  o  m
    return Collections.emptyList();
}

From source file:com.create.application.configuration.Bootstrap.java

private User createAdminUser() {
    String password = passwordEncoder.encode(USER_PASSWORD);
    Set<Role> roles = Collections.singleton(Role.ADMIN);
    Set<Permission> permissions = Collections.singleton(Permission.BATCH);
    return UserBuilder.anUser().withUsername(ADMIN_USER).withPassword(password).withRoles(roles)
            .withPermissions(permissions).build();
}