下面列出了java.util.Collections#singletonList ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("unchecked")
@Override
public MutationPlan compilePlan(final PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException {
final StatementContext context = new StatementContext(stmt);
return new BaseMutationPlan(context, this.getOperation()) {
@Override
public ExplainPlan getExplainPlan() throws SQLException {
return new ExplainPlan(Collections.singletonList("ALTER INDEX"));
}
@Override
public MutationState execute() throws SQLException {
MetaDataClient client = new MetaDataClient(getContext().getConnection());
return client.alterIndex(ExecutableAlterIndexStatement.this);
}
};
}
/**
* @param mode Mode for the extractor. One of {@link #MODE_MULTI_PMT}, {@link #MODE_SINGLE_PMT}
* and {@link #MODE_HLS}.
* @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps.
* @param payloadReaderFactory Factory for injecting a custom set of payload readers.
*/
public TsExtractor(
@Mode int mode,
TimestampAdjuster timestampAdjuster,
TsPayloadReader.Factory payloadReaderFactory) {
this.payloadReaderFactory = Assertions.checkNotNull(payloadReaderFactory);
this.mode = mode;
if (mode == MODE_SINGLE_PMT || mode == MODE_HLS) {
timestampAdjusters = Collections.singletonList(timestampAdjuster);
} else {
timestampAdjusters = new ArrayList<>();
timestampAdjusters.add(timestampAdjuster);
}
tsPacketBuffer = new ParsableByteArray(new byte[BUFFER_SIZE], 0);
trackIds = new SparseBooleanArray();
trackPids = new SparseBooleanArray();
tsPayloadReaders = new SparseArray<>();
continuityCounters = new SparseIntArray();
durationReader = new TsDurationReader();
pcrPid = -1;
resetPayloadReaders();
}
@Bean
public Catalog catalog() {
return new Catalog(Collections.singletonList(
new ServiceDefinition(
"mongodb-service-broker",
"mongodb",
"A simple MongoDB service broker implementation",
true,
false,
Collections.singletonList(
new Plan("mongo-plan",
"default",
"This is a default mongo plan. All services are created equally.",
getPlanMetadata())),
Arrays.asList("mongodb", "document"),
getServiceDefinitionMetadata(),
null,
null)));
}
private static List<StatementInfo> getStatements(String script, int startOffset, int endOffset,
Compatibility compat) {
if ((startOffset == 0 && endOffset == script.length()) || (startOffset == endOffset)) {
// Either the whole script, or the statement at offset startOffset.
List<StatementInfo> allStatements = split(script, compat);
if (startOffset == 0 && endOffset == script.length()) {
return allStatements;
}
// Just the statement at offset startOffset.
StatementInfo foundStatement = findStatementAtOffset(
allStatements, startOffset, script);
return foundStatement == null
? Collections.<StatementInfo>emptyList()
: Collections.singletonList(foundStatement);
} else {
// Just execute the selected subscript.
return split(script.substring(startOffset, endOffset), compat);
}
}
@Nonnull
@Override
public List<Map<String, Object>> getWithCredentialsParameters(String credentialsId) {
Map<String, Object> map = new HashMap<>();
map.put("$class", DockerServerCredentialsBinding.class.getName());
map.put("variable", new EnvVarResolver());
map.put("credentialsId", credentialsId);
return Collections.singletonList(map);
}
@Test(expected = ValidationException.class)
public void saveUdaDefinitions_EmptyTargetType() throws Exception {
List<VOUdaDefinition> list = Collections
.singletonList(createVOUdaDefinition(" ", "UDA", null,
UdaConfigurationType.SUPPLIER));
accountService_Supplier.saveUdaDefinitions(list,
new ArrayList<VOUdaDefinition>());
}
/**
* Checks if the specified X509CRL matches the criteria specified in the
* CRLSelector.
*/
private static Collection<X509CRL> getMatchingCRLs
(X509CRL crl, CRLSelector selector) {
if (selector == null || (crl != null && selector.match(crl))) {
return Collections.singletonList(crl);
} else {
return Collections.emptyList();
}
}
@Test
public void failsIfNoBufferSizeDisparity() {
Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), Instant.now(), null);
Collection<Symptom> symptoms = Collections.singletonList(symptom);
Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
assertEquals(0, result.size());
}
public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig) throws SQLException {
super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
ConfigCenter configService = getShardingOrchestrationFacade().getConfigCenter();
Collection<RuleConfiguration> configurations = configService.loadRuleConfigurations(DefaultSchema.LOGIC_NAME);
Preconditions.checkState(!configurations.isEmpty(), "Missing the sharding rule configuration on registry center");
Map<String, DataSourceConfiguration> dataSourceConfigurations = configService.loadDataSourceConfigurations(DefaultSchema.LOGIC_NAME);
dataSource = new ShardingSphereDataSource(DataSourceConverter.getDataSourceMap(dataSourceConfigurations), configurations, configService.loadProperties());
initShardingOrchestrationFacade();
disableDataSources();
persistMetaData(dataSource.getSchemaContexts().getDefaultSchemaContext().getSchema().getMetaData().getSchema());
initCluster();
}
/**
* Parse a workflow
*
* @param workflowID
* workflow id
* @param workflowXML
* xml representation of the workflow including all tasks
* @return a workflow
* @throws RepositoryException
*/
public Workflow parsePackagedWorkflow(String workflowID, String workflowXML)
throws RepositoryException {
try {
File tmpfile = File.createTempFile("tempworkflow-", "-packaged");
FileUtils.writeStringToFile(tmpfile, workflowXML);
PackagedWorkflowRepository tmprepo = new PackagedWorkflowRepository(
Collections.singletonList(tmpfile));
tmpfile.delete();
return tmprepo.getWorkflowById(workflowID);
} catch (Exception e) {
throw new RepositoryException("Failed to parse workflow xml: "
+ e.getMessage());
}
}
@Override
public Collection<PacketWrapper> toNative() {
return Collections.singletonList(new PacketWrapper(new Respawn(dimension, 0, (short) difficulty, (short) gamemode, levelType), Unpooled.wrappedBuffer(readbytes)));
}
@Override
public List<SDVariable> doDiff(List<SDVariable> i_v1) {
SDVariable mask = arg().gt(scalarValue.getDouble(0)).castTo(arg().dataType());
return Collections.singletonList(i_v1.get(0).mul(mask));
}
@Override
public List<PermissionDefinition> permissions() {
PermissionDefinition pre = new PermissionDefinition("pre",
DefaultConfigHandler.class, "handlePathPerm");
return Collections.singletonList(pre);
}
public List<Argument> getPrimaryKeyArguments() {
NodeSpec nt = et.getPrimaryKeyNodes(true).iterator().next();
return Collections.singletonList(new NodeQueryArgument(nt));
}
@Test
void validate_RegistrationContext_with_android_key_attestation_statement_test() {
String rpId = "example.com";
Challenge challenge = new DefaultChallenge();
AuthenticatorSelectionCriteria authenticatorSelectionCriteria =
new AuthenticatorSelectionCriteria(
AuthenticatorAttachment.CROSS_PLATFORM,
true,
UserVerificationRequirement.REQUIRED);
PublicKeyCredentialParameters publicKeyCredentialParameters = new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.ES256);
PublicKeyCredentialUserEntity publicKeyCredentialUserEntity = new PublicKeyCredentialUserEntity();
AuthenticationExtensionsClientInputs<RegistrationExtensionClientInput<?>> extensions = new AuthenticationExtensionsClientInputs<>();
PublicKeyCredentialCreationOptions credentialCreationOptions
= new PublicKeyCredentialCreationOptions(
new PublicKeyCredentialRpEntity(rpId, "example.com"),
publicKeyCredentialUserEntity,
challenge,
Collections.singletonList(publicKeyCredentialParameters),
null,
Collections.emptyList(),
authenticatorSelectionCriteria,
AttestationConveyancePreference.DIRECT,
extensions
);
PublicKeyCredential<AuthenticatorAttestationResponse, RegistrationExtensionClientOutput<?>> credential = clientPlatform.create(credentialCreationOptions);
AuthenticatorAttestationResponse registrationRequest = credential.getAuthenticatorResponse();
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput<?>> clientExtensionResults = credential.getClientExtensionResults();
Set<String> transports = Collections.emptySet();
String clientExtensionJSON = authenticationExtensionsClientOutputsConverter.convertToString(clientExtensionResults);
ServerProperty serverProperty = new ServerProperty(origin, rpId, challenge, null);
RegistrationRequest webAuthnRegistrationRequest
= new RegistrationRequest(
registrationRequest.getAttestationObject(),
registrationRequest.getClientDataJSON(),
clientExtensionJSON,
transports
);
RegistrationParameters webAuthnRegistrationParameters
= new RegistrationParameters(
serverProperty,
false,
true,
Collections.emptyList()
);
RegistrationData response = target.validate(webAuthnRegistrationRequest, webAuthnRegistrationParameters);
assertAll(
() -> assertThat(response.getCollectedClientData()).isNotNull(),
() -> assertThat(response.getAttestationObject()).isNotNull(),
() -> assertThat(response.getClientExtensions()).isNotNull()
);
}
@Override
public Iterable<Expression> getOperands() {
return Collections.singletonList(((AnyInValueSet) expression).getCodes());
}
@Override
public Collection<String> getNames() {
return Collections.singletonList("generateUUID");
}
public HomeCommand() {
super(Collections.singletonList("home"), "Teleport to your island home", "", true);
}
public EmbeddedKafkaCluster(String zkConnection, Properties baseProperties) {
this(zkConnection, baseProperties, Collections.singletonList(-1));
}
/**
* Convert a URL query name/value parameter to a list of encoded {@link Pair}
* objects.
*
* <p>The value can be null, in which case an empty list is returned.</p>
*
* @param name The query name parameter.
* @param value The query value, which may not be a collection but may be
* null.
* @return A singleton list of the {@link Pair} objects representing the input
* parameters, which is encoded for use in a URL. If the value is null, an
* empty list is returned.
*/
public static List<Pair> parameterToPairs(String name, Object value) {
if (name == null || name.isEmpty() || value == null) {
return Collections.emptyList();
}
return Collections.singletonList(new Pair(urlEncode(name), urlEncode(value.toString())));
}