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:reconf.server.services.property.ClientReadPropertyServiceTest.java

@Test
public void found() throws Exception {
    Property property = standardProperty();

    when(propertyRepository.findByKeyProductAndKeyComponentAndKeyNameOrderByRulePriorityDescKeyRuleNameAsc(
            PROPERTY_KEY_PRODUCT, PROPERTY_KEY_COMPONENT, PROPERTY_KEY_NAME))
                    .thenReturn(Collections.singletonList(property));

    when(jsEngine.eval(Mockito.anyString(), Mockito.anyMap(), Mockito.anyString())).thenReturn(true);

    this.mockMvc/* ww w . ja  v  a 2s . c  o  m*/
            .perform(get("/{prod}/{comp}/{prop}", PROPERTY_KEY_PRODUCT, PROPERTY_KEY_COMPONENT,
                    PROPERTY_KEY_NAME).accept(ReConfConstants.MT_PROTOCOL_V1))
            .andDo(print()).andExpect(status().isOk()).andExpect(content().string(property.getValue()));

    verify(propertyRepository).findByKeyProductAndKeyComponentAndKeyNameOrderByRulePriorityDescKeyRuleNameAsc(
            PROPERTY_KEY_PRODUCT, PROPERTY_KEY_COMPONENT, PROPERTY_KEY_NAME);
}

From source file:com.thinkbiganalytics.metadata.modeshape.support.JcrPath.java

public JcrPath(boolean absolute, String element) {
    this.elements = Collections.singletonList(element);
    this.absolute = absolute;
}

From source file:com.example.CassandraConfiguration.java

@Override
protected List<CreateKeyspaceSpecification> getKeyspaceCreations() {
    final CreateKeyspaceSpecification specification = CreateKeyspaceSpecification
            .createKeyspace(CassandraConfiguration.KEY_SPACE_NAME).ifNotExists()
            .with(KeyspaceOption.DURABLE_WRITES, true);
    return Collections.singletonList(specification);
}

From source file:springfox.documentation.swagger.schema.ApiModelProperties.java

public static AllowableValues allowableValueFromString(String allowableValueString) {
    AllowableValues allowableValues = new AllowableListValues(Lists.<String>newArrayList(), "LIST");
    allowableValueString = allowableValueString.trim();
    if (allowableValueString.startsWith("range[")) {
        allowableValueString = allowableValueString.replaceAll("range\\[", "").replaceAll("]", "");
        Iterable<String> split = Splitter.on(',').trimResults().omitEmptyStrings().split(allowableValueString);
        List<String> ranges = newArrayList(split);
        allowableValues = new AllowableRangeValues(ranges.get(0), ranges.get(1));
    } else if (allowableValueString.contains(",")) {
        Iterable<String> split = Splitter.on(',').trimResults().omitEmptyStrings().split(allowableValueString);
        allowableValues = new AllowableListValues(newArrayList(split), "LIST");
    } else if (hasText(allowableValueString)) {
        List<String> singleVal = Collections.singletonList(allowableValueString);
        allowableValues = new AllowableListValues(singleVal, "LIST");
    }//  ww  w.  j  a  v a  2 s.  c o m
    return allowableValues;
}

From source file:org.openmrs.module.kenyaemr.chore.VoidDuplicateIdentifiers.java

/**
 * Voids all duplicate identifiers of the given type
 * @param type the patient identifier type
 *///from  w w w . j  ava  2s  .co m
protected void voidDuplicatesOfType(PatientIdentifierType type, PrintWriter output) {
    List<PatientIdentifier> allOfType = patientService.getPatientIdentifiers(null,
            Collections.singletonList(type), null, null, null);
    Set<String> values = new HashSet<String>();
    int voided = 0;

    for (PatientIdentifier identifier : allOfType) {
        if (values.contains(identifier.getIdentifier())) {
            patientService.voidPatientIdentifier(identifier, "Duplicate");
            voided++;
        } else {
            values.add(identifier.getIdentifier());
        }
    }

    output.println("Voided " + voided + " duplicate '" + type.getName() + "' identifiers");
}

From source file:com.github.nukesparrow.htmlunit.HUQueryElements.java

HUQueryElements(HUQueryWindow w, Elem element) {
    this.w = w;
    this.elements = Collections.singletonList(element);
}

From source file:com.schibsted.triathlon.operators.GroupByOperatorTest.java

private void initializeInstanceInfos(int count) {
    for (int n = 0; n < count; n++) {
        List<NetworkAddress> na = Collections
                .singletonList(new NetworkAddress("public", NetworkAddress.ProtocolType.IPv4,
                        "192.168.0." + Integer.toString(n + 1), "myHost-" + Integer.toString(n)));
        DataCenterInfo dc = new BasicDataCenterInfo("datacenter-" + Integer.toString(n), na);
        InstanceInfo ii = new InstanceInfo.Builder().withId("instance-info-id-" + Integer.toString(n))
                .withDataCenterInfo(dc).build();

        ChangeNotification<InstanceInfo> cn = new ChangeNotification<>(ChangeNotification.Kind.Add, ii);
        InstanceInfoModel.interestSubscriber(cn);
    }// w w w  .ja va2s  .c om
}

From source file:io.cloudslang.lang.runtime.bindings.ArgumentsBindingTest.java

@Test
public void testDefaultValueNoExpression() {
    List<Argument> arguments = Collections.singletonList(new Argument("argument1", "value"));
    Map<String, Serializable> result = bindArguments(arguments);
    Assert.assertFalse(result.isEmpty());
    Assert.assertTrue(result.containsKey("argument1"));
    Assert.assertEquals("value", result.get("argument1"));
}

From source file:org.fcrepo.auth.xacml.PDPFactory.java

/**
 * Make a PDP for the Fedora environment.
 *
 * @see org.springframework.beans.factory.FactoryBean#getObject()
 * @return the PDP//from   ww  w.ja  v a  2 s.c o m
 */
public PDP makePDP() {
    final PolicyFinder policyFinder = new PolicyFinder();
    policyFinder.setModules(Collections.singleton(fedoraPolicyFinderModule));

    final ResourceFinder resourceFinder = new ResourceFinder();
    resourceFinder.setModules(Collections.singletonList(fedoraResourceFinderModule));

    final PDPConfig pdpConfig = new PDPConfig(new AttributeFinder(), policyFinder, resourceFinder);
    final PDP pdp = new PDP(pdpConfig);
    LOGGER.info("XACML Policy Decision Point (PDP) initialized");
    return pdp;
}

From source file:org.apache.drill.exec.ref.rse.QueueRSE.java

public QueueRSE(QueueRSEConfig engineConfig, DrillConfig dConfig) throws SetupException {
    this.dConfig = dConfig;
    sinkQueues = Collections.singletonList((Queue<Object>) (new ArrayBlockingQueue<Object>(100)));
}