List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:com.cloudera.oryx.rdf.computation.RDFDistributedGenerationRunner.java
@Override protected List<DependsOn<Class<? extends JobStep>>> getIterationDependencies() { return Collections.singletonList( DependsOn.<Class<? extends JobStep>>nextAfterFirst(BuildTreesStep.class, MergeNewOldStep.class)); }
From source file:io.cloudslang.lang.runtime.bindings.InputsBindingTest.java
@Test public void testDefaultValueInt() { List<Input> inputs = Collections.singletonList(new Input.InputBuilder("input1", 2).build()); Map<String, Serializable> result = bindInputs(inputs); Assert.assertFalse(result.isEmpty()); Assert.assertTrue(result.containsKey("input1")); Assert.assertEquals(2, result.get("input1")); }
From source file:jails.http.converter.AbstractHttpMessageConverter.java
/** * Construct an {@code AbstractHttpMessageConverter} with one supported media type. * @param supportedMediaType the supported media type *///w w w . j a va2 s . c o m protected AbstractHttpMessageConverter(MediaType supportedMediaType) { setSupportedMediaTypes(Collections.singletonList(supportedMediaType)); }
From source file:org.apereo.portal.soffit.connector.PortalRequestHeaderProvider.java
@Override public Header createHeader(RenderRequest renderRequest, RenderResponse renderResponse) { // Username/*from ww w . j a va2 s . c o m*/ final String username = getUsername(renderRequest); // Properties final Map<String, String> properties = new HashMap<>(); final Enumeration<String> names = renderRequest.getPropertyNames(); for (String propertyName = names.nextElement(); names .hasMoreElements(); propertyName = names.nextElement()) { properties.put(propertyName, renderRequest.getProperty(propertyName)); } // Attributes final Map<String, List<String>> attributes = new HashMap<>(); attributes.put(Attributes.NAMESPACE.getName(), Collections.singletonList(NAMESPACE_PREFIX + renderRequest.getWindowID())); attributes.put(Attributes.MODE.getName(), Collections.singletonList(renderRequest.getPortletMode().toString())); attributes.put(Attributes.WINDOW_STATE.getName(), Collections.singletonList(renderRequest.getWindowState().toString())); attributes.put(Attributes.PORTAL_INFO.getName(), Collections.singletonList(renderRequest.getPortalContext().getPortalInfo())); attributes.put(Attributes.SCHEME.getName(), Collections.singletonList(renderRequest.getScheme())); attributes.put(Attributes.SERVER_NAME.getName(), Collections.singletonList(renderRequest.getServerName())); attributes.put(Attributes.SERVER_PORT.getName(), Collections.singletonList(Integer.valueOf(renderRequest.getServerPort()).toString())); attributes.put(Attributes.SECURE.getName(), Collections.singletonList(Boolean.valueOf(renderRequest.isSecure()).toString())); // Parameters final Map<String, List<String>> parameters = new HashMap<>(); for (Map.Entry<String, String[]> y : renderRequest.getParameterMap().entrySet()) { parameters.put(y.getKey(), Arrays.asList(y.getValue())); } // Preferences header final PortalRequest portalRequest = portalRequestService.createPortalRequest(properties, attributes, parameters, username, getExpiration(renderRequest)); final Header rslt = new BasicHeader(Headers.PORTAL_REQUEST.getName(), portalRequest.getEncryptedToken()); logger.debug("Produced the following PortalRequest header for username='{}': {}", username, rslt); return rslt; }
From source file:io.undertow.server.security.ClientCertRenegotiationTestCase.java
@Override protected List<AuthenticationMechanism> getTestMechanisms() { AuthenticationMechanism mechanism = new ClientCertAuthenticationMechanism(); return Collections.singletonList(mechanism); }
From source file:org.lendingclub.mercator.aws.NetworkInterfaceScanner.java
@Override protected void doScan() { GraphNodeGarbageCollector gc = newGarbageCollector().bindScannerContext(); getClient().describeNetworkInterfaces().getNetworkInterfaces().forEach(intf -> { ObjectNode n = convertAwsObject(intf, getRegion()); NeoRxClient neo4j = getNeoRxClient(); try {/*from w w w. j av a 2 s . c o m*/ String cypher = "merge (x:AwsEc2NetworkInterface {aws_arn:{arn}}) set x+={props}, x.updateTs=timestamp() return x"; String arn = n.path("aws_arn").asText(); neo4j.execCypher(cypher, "arn", arn, "props", n).forEach(it -> { gc.MERGE_ACTION.accept(it); }); LinkageHelper instanceLinkageHelper = new LinkageHelper().withNeo4j(neo4j).withFromArn(arn) .withFromLabel(getNeo4jLabel()).withTargetLabel("AwsEc2Instance") .withLinkLabel("ATTACHED_TO"); if (intf.getAttachment() != null && "attached".equals(intf.getAttachment().getStatus()) && !Strings.isNullOrEmpty(intf.getAttachment().getInstanceId())) { instanceLinkageHelper.withTargetValues(Collections .singletonList(createEc2Arn("instance", intf.getAttachment().getInstanceId()))); } instanceLinkageHelper.execute(); LinkageHelper subnetLinkageHelper = new LinkageHelper().withNeo4j(neo4j) .withFromLabel(getNeo4jLabel()).withFromArn(arn).withTargetLabel("AwsSubnet") .withLinkLabel("EXISTS_IN") .withTargetValues(Strings.isNullOrEmpty(intf.getSubnetId()) ? Collections.emptyList() : Collections.singletonList(createEc2Arn("subnet", intf.getSubnetId()))); subnetLinkageHelper.execute(); incrementEntityCount(); } catch (RuntimeException e) { gc.markException(e); maybeThrow(e); } }); }
From source file:org.bozzo.ipplan.web.assembler.RangeResourceAssemblerTest.java
@Test public void toResources_with_singleton_array_should_return_a_singleton_array() { Range range = new Range(); range.setId(1L);/*from www . j a v a 2 s. co m*/ range.setDescription("Test description"); range.setInfraId(1); range.setZoneId(1L); range.setSize(65535L); range.setIp(0xC0A80001L); List<RangeResource> resources = this.assembler.toResources(Collections.singletonList(range)); Assert.assertNotNull(resources); Assert.assertEquals(1, resources.size()); Assert.assertTrue(ResourceSupport.class.isAssignableFrom(resources.get(0).getClass())); }
From source file:de.tud.inf.db.sparqlytics.olap.DiceTest.java
@Test public void testRun() { Filter filter = new Filter(Var.alloc("test"), NodeValue.TRUE); Dice instance = new Dice("dim1", "lev1", filter); Session session = new Session(); CubeBuilder builder = new CubeBuilder(new ElementTriplesBlock(BasicPattern.wrap( Collections.singletonList(Triple.createMatch(NodeFactory.createVariable("test"), null, null))))) .addMeasure(new DummyMeasure("mes1")); Dimension dim1 = new DummyDimension("dim1"); Level lev1 = dim1.getLevels().get(0); session.setCube(builder.addDimension(dim1).build("")); session.execute(instance);//from w w w. ja v a 2 s . c om Map<Pair<Dimension, Level>, Filter> filters = session.getFilters(); Assert.assertEquals(1, filters.size()); Map.Entry<Pair<Dimension, Level>, Filter> entry = filters.entrySet().iterator().next(); Pair<Dimension, Level> key = entry.getKey(); Assert.assertSame(dim1, key.getLeft()); Assert.assertSame(lev1, key.getRight()); }
From source file:com.hp.autonomy.aci.content.fieldtext.EQUAL.java
/** * Constructs a new single field EQUAL fieldtext * @param field The field name/*from w ww . j a v a2 s . c om*/ * @param values The field values */ public EQUAL(final String field, final Iterable<? extends Number> values) { this(Collections.singletonList(field), values); }
From source file:com.spectralogic.ds3cli.command.GetPhysicalPlacement.java
@Override public GetPhysicalPlacementWithFullDetailsResult call() throws Exception { final List<Ds3Object> objectsList = Collections.singletonList(new Ds3Object(objectName)); final GetPhysicalPlacementForObjectsWithFullDetailsSpectraS3Response response = getClient() .getPhysicalPlacementForObjectsWithFullDetailsSpectraS3( new GetPhysicalPlacementForObjectsWithFullDetailsSpectraS3Request(bucketName, objectsList)); return new GetPhysicalPlacementWithFullDetailsResult(response.getBulkObjectListResult()); }