List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:org.surfnet.oaaas.resource.ResourceServerResource.java
/** * Get all existing resource servers for the provided credentials (== owner). *///from ww w.j a v a2 s . c o m @GET public Response getAll(@Context HttpServletRequest request) { Response validateScopeResponse = validateScope(request, Collections.singletonList(AbstractResource.SCOPE_READ)); if (validateScopeResponse != null) { return validateScopeResponse; } Response.ResponseBuilder responseBuilder; String owner = getUserId(request); final List<ResourceServer> resourceServers = resourceServerRepository.findByOwner(owner); LOG.debug("About to return all resource servers ({}) for owner {}", resourceServers.size(), owner); responseBuilder = Response.ok(resourceServers); return responseBuilder.build(); }
From source file:org.apache.marmotta.ldclient.provider.phpbb.mapping.PHPBBTopicHrefMapper.java
/** * Take the selected value, process it according to the mapping definition, and create Sesame Values using the * factory passed as argument.//from w w w .j a v a 2s. c o m * * @param resourceUri * @param selectedValue * @param factory * @return */ @Override public List<Value> map(String resourceUri, Element selectedValue, ValueFactory factory) { String baseUriSite = resourceUri.substring(0, resourceUri.lastIndexOf('/')); String baseUriTopic = baseUriSite + "/viewtopic.php?"; try { URI uri = new URI(selectedValue.absUrl("href")); Map<String, String> params = new HashMap<String, String>(); for (NameValuePair p : URLEncodedUtils.parse(uri, "UTF-8")) { params.put(p.getName(), p.getValue()); } return Collections.singletonList((Value) factory.createURI(baseUriTopic + "t=" + params.get("t"))); } catch (URISyntaxException ex) { throw new RuntimeException("invalid syntax for URI", ex); } }
From source file:com.weibo.api.motan.config.RefererConfig.java
public void setMethods(MethodConfig methods) { this.methods = Collections.singletonList(methods); }
From source file:com.bradley.musicapp.test.restapi.PersonRestControllerTest.java
private HttpEntity<?> getHttpEntity() { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAccept(Collections.singletonList(new MediaType("application", "json"))); HttpEntity<?> requestEntity = new HttpEntity<>(requestHeaders); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); return requestEntity; }
From source file:ca.uhn.fhir.rest.method.SummaryEnumParameter.java
@SuppressWarnings("unchecked") @Override//from w w w.ja va2 s.c o m public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { if (theSourceClientArgument instanceof Collection) { List<String> values = new ArrayList<String>(); for (SummaryEnum next : (Collection<SummaryEnum>) theSourceClientArgument) { if (next != null) { values.add(next.getCode()); } } theTargetQueryArguments.put(Constants.PARAM_SUMMARY, values); } else { SummaryEnum ss = (SummaryEnum) theSourceClientArgument; if (ss != null) { theTargetQueryArguments.put(Constants.PARAM_SUMMARY, Collections.singletonList(ss.getCode())); } } }
From source file:com.civis.utils.html.parser.HtmlParserTest.java
@Test public void testFindHtmlLinksInMonsterMailWithFilter() { String monsterMailContent = getMailContent(MONSTER_MAIL_PATH); List<String> linkMatcher = Collections.singletonList("stellenanzeige.monster.de"); HtmlParseFilter htmlParseFilter = getHtmlParseFilter(linkMatcher); List<HtmlLink> links = new HtmlParser(monsterMailContent, htmlParseFilter).parse().getLinks(); Assert.assertEquals("This mail content include only 4 job links!", 4, links.size()); }
From source file:com.epam.reportportal.extension.bugtracking.jira.TicketDescriptionServiceTest.java
@Test public void testDescription() { PostTicketRQ postTicketRQ = new PostTicketRQ(); postTicketRQ.setIsIncludeScreenshots(true); postTicketRQ.setNumberOfLogs(1);//from w w w. j ava 2s. c o m postTicketRQ.setIsIncludeLogs(true); postTicketRQ.setBackLinks(new HashMap<>()); String description = descriptionService .getDescription(Collections.singletonList("44524cc1553de743b3e5aa2f"), postTicketRQ); Assert.assertNotNull(description); Assert.assertEquals( "h3.*Test execution log:*\n{panel:title=Test execution log|borderStyle=solid|borderColor=#ccc|titleColor=#34302D|titleBGColor=#6DB33F}{code} Time: 05/06/2013 18:26:00, Log: Demo Test Log Message_spdOP\n{code}{panel}\n", description); }
From source file:org.openlmis.fulfillment.domain.ShipmentDraftTest.java
@Test public void shouldCreateInstanceBasedOnImporter() { ShipmentDraft expected = createShipment(); DummyShipmentDraftDto shipmentDraftDto = new DummyShipmentDraftDto(id, order, notes, Collections .singletonList(new DummyShipmentLineItemDto(lineItemId, orderableId, lotId, quantityShipped))); ShipmentDraft actual = ShipmentDraft.newInstance(shipmentDraftDto); assertThat(expected, new ReflectionEquals(actual)); }
From source file:de.jackwhite20.japs.client.sub.impl.SubscriberImpl.java
public SubscriberImpl(String host, int port, String name) { this(Collections.singletonList(new ClusterServer(host, port)), name); }
From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.core.TcServerConfiguratorImporterTest.java
@Test public void testDetect() throws Exception { ConfiguratorImporter importer = new ConfiguratorImporter(); importer.setScanInstallPath(false);/*from www .ja v a2 s .c om*/ provisionAndCopyFixtures(location.getRoot(), fixtures); importer.setSearchLocations(Collections.singletonList(location.getRoot())); List<ConfigurableExtension> extensions = importer.detectExtensions(new NullProgressMonitor()); for (TcServerFixture fixture : fixtures) { assertContains(fixture.getDescription(), extensions); } }