List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:org.jasig.portlet.emailpreview.service.link.SimpleEmailLinkServiceImpl.java
@Override public List<ConfigurationParameter> getAdminConfigurationParameters() { ConfigurationParameter param = new ConfigurationParameter(); param.setKey(INBOX_URL_PROPERTY); param.setLabel("Webmail inbox URL"); return Collections.singletonList(param); }
From source file:fi.hsl.parkandride.core.service.PredictionServiceTest.java
@Test public void enables_all_registered_predictors_when_signaling_that_update_is_needed() { usePredictor(new SameAsLatestPredictor()); assertThat(predictorRepository.findAllPredictors()).as("all predictors, before").isEmpty(); predictionService.signalUpdateNeeded(Collections.singletonList(newUtilization(facilityId, now, 0))); assertThat(predictorRepository.findAllPredictors()).as("all predictors, after").isNotEmpty(); }
From source file:ch.cyberduck.core.onedrive.OneDriveCopyFeature.java
@Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final OneDriveCopyOperation copyOperation = new OneDriveCopyOperation(); if (!StringUtils.equals(source.getName(), target.getName())) { copyOperation.rename(target.getName()); }/*from w w w. j a v a 2 s.c o m*/ if (status.isExists()) { new OneDriveDeleteFeature(session).delete(Collections.singletonList(target), callback, new Delete.DisabledCallback()); } copyOperation.copy(session.toFolder(target.getParent())); try { session.toFile(source).copy(copyOperation).await( statusObject -> logger.info(String.format("Copy Progress Operation %s progress %f status %s", statusObject.getOperation(), statusObject.getPercentage(), statusObject.getStatus()))); return target; } catch (OneDriveAPIException e) { throw new OneDriveExceptionMappingService().map("Cannot copy {0}", e, source); } catch (IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot copy {0}", e, source); } }
From source file:com.yahoo.elide.core.filter.FilterPredicate.java
public FilterPredicate(PathElement pathElement, Operator op, List<Object> values) { this(new Path(Collections.singletonList(pathElement)), op, values); }
From source file:dollar.api.types.DollarString.java
@NotNull @Override// w w w.ja v a 2 s. com public Value $as(@NotNull Type type) { if (type.is(Type._BOOLEAN)) { return DollarStatic.$("true".equals(value) || "yes".equals(value)); } else if (type.is(Type._STRING)) { return this; } else if (type.is(Type._LIST)) { return DollarStatic.$(Collections.singletonList(this)); } else if (type.is(Type._MAP)) { return DollarStatic.$("value", this); } else if (type.is(Type._DECIMAL)) { return DollarStatic.$(Double.parseDouble(value)); } else if (type.is(Type._INTEGER)) { return DollarStatic.$(Long.parseLong(value)); } else if (type.is(Type._VOID)) { return DollarStatic.$void(); } else if (type.is(Type._DATE)) { return DollarFactory.fromValue(LocalDateTime.parse(value)); } else if (type.is(Type._URI)) { return DollarFactory.fromURI(value); } else { throw new DollarFailureException(INVALID_CAST); } }
From source file:io.spring.initializr.web.project.LegacyStsControllerIntegrationTests.java
@Override protected String htmlHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML)); return getRestTemplate() .exchange(createUrl("/sts"), HttpMethod.GET, new HttpEntity<Void>(headers), String.class).getBody(); }
From source file:org.cloudfoundry.identity.uaa.scim.job.ItemWriterSkipListener.java
@Override public void onSkipInWrite(S item, Throwable t) { logger.debug("Skipping: " + item + "(" + t.getClass().getName() + ", " + t.getMessage() + ")"); List<S> items = Collections.singletonList(item); try {//from w ww .ja v a2 s . c o m classifier.classify(t).write(items); } catch (Exception e) { try { classifier.getDefault().write(items); } catch (Exception ex) { // ignore logger.error("Could not register failed item", ex); } } }
From source file:net.sf.springderby.ExecuteSqlScriptsAction.java
public void setScript(Resource script) { this.scripts = Collections.singletonList(script); }
From source file:io.gravitee.gateway.security.core.SecurityPolicyChainResolver.java
@Override public PolicyChain resolve(StreamType streamType, Request request, Response response, ExecutionContext executionContext) { if (streamType == StreamType.ON_REQUEST) { final SecurityProvider securityProvider = securityManager.resolve(request); if (securityProvider != null) { logger.debug("Security provider [{}] has been selected to secure incoming request {}", securityProvider.name(), request.id()); SecurityPolicy securityPolicy = securityProvider.create(executionContext); Policy policy = create(streamType, securityPolicy.policy(), securityPolicy.configuration()); return RequestPolicyChain.create(Collections.singletonList(policy), executionContext); }//from www. j a v a 2s. c o m // No authentication method selected, must send a 401 logger.debug( "No security provider has been selected to process request {}. Returning an unauthorized status (401)", request.id()); return new DirectPolicyChain(PolicyResult.failure(HttpStatusCode.UNAUTHORIZED_401, "Unauthorized"), executionContext); } else { // In the case of response flow, there is no need for authentication. return new NoOpPolicyChain(executionContext); } }
From source file:com.orange.cloud.servicebroker.filter.core.service.mapper.SuffixedCatalogMapperTest.java
private Catalog expectedCatalog() { ArrayList plans = new ArrayList(); HashMap metadata = new HashMap(); metadata.put("key1", "value1"); metadata.put("key2", "value2"); plans.add(new Plan("plan-one-id-suffix", "Plan One-suffix", "Description for Plan One")); plans.add(new Plan("plan-two-id-suffix", "Plan Two-suffix", "Description for Plan Two", metadata)); List services = Collections.singletonList(new ServiceDefinition("service-one-id-suffix", "Service One-suffix", "Description for Service One", true, plans)); return new Catalog(services); }