本文整理汇总了Java中jersey.repackaged.com.google.common.collect.ImmutableList类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList类的具体用法?Java ImmutableList怎么用?Java ImmutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableList类属于jersey.repackaged.com.google.common.collect包,在下文中一共展示了ImmutableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: migrateAllCaseInstances
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
private void migrateAllCaseInstances(@NonNull final String targetCaseDefId, @NonNull final String caseDefinitionKey) {
final List<String> caseDefinitionIds = ImmutableList.copyOf(getAllButTargetCaseDefinitionIds(caseDefinitionKey, targetCaseDefId));
final List<CaseInstance> caseInstancesToMigrate = new ArrayList<>();
caseDefinitionIds.forEach(caseDefinitionId -> caseInstancesToMigrate.addAll(caseService.createCaseInstanceQuery().caseDefinitionId(caseDefinitionId).list()));
log.info(String.format("Found %d case instances to migrate", caseInstancesToMigrate.size()));
caseInstancesToMigrate.forEach(caseInstance -> {
try {
migrator.migrateOneCaseInstance(caseInstance.getCaseInstanceId(), targetCaseDefId);
} catch (Exception e) {
log.error(String.format("Exception during migration of case instance '%s", caseInstance.getCaseInstanceId()), e);
}
});
}
示例2: validatePatchRequest
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
public Optional<Errors> validatePatchRequest(JsonNode payload) {
Optional<List<String>> missingMandatoryFields = requestValidations.checkIfExistsOrEmpty(payload, "op", "path", "value");
if (missingMandatoryFields.isPresent()) {
return Optional.of(Errors.from(missingMandatoryFields.get()));
}
String path = payload.get("path").asText();
String op = payload.get("op").asText();
if (!isPathAllowed(path)) {
return Optional.of(Errors.from(ImmutableList.of(format("Patching path [%s] not allowed", path))));
}
if (!isAllowedOpForPath(path, op)) {
return Optional.of(Errors.from(ImmutableList.of(format("Operation [%s] not allowed for path [%s]", op, path))));
}
Optional<List<String>> invalidData = checkValidPatchValue(payload.get("value"), getUserPatchPathValidations(path));
if (invalidData.isPresent()) {
return Optional.of(Errors.from(invalidData.get()));
}
return Optional.empty();
}
示例3: resetForgottenPassword
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Path(RESET_PASSWORD_RESOURCE)
@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
public Response resetForgottenPassword(JsonNode payload) {
return resetPasswordValidator.validateResetRequest(payload)
.map(errors -> Response.status(BAD_REQUEST)
.type(APPLICATION_JSON)
.entity(errors).build())
.orElseGet(() -> resetPasswordService.updatePassword(payload.get(FIELD_CODE).asText(), payload.get(FIELD_PASSWORD).asText())
.map(userId -> {
logger.info("user {} updated password successfully. user_id={}", userId);
return Response.status(NO_CONTENT).build();
})
.orElseGet(() -> Response.status(NOT_FOUND)
.entity(from(ImmutableList.of(String.format("Field [%s] non-existent/expired", FIELD_CODE))))
.build()));
}
示例4: getChildren
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
private List<Tree> getChildren(final String zkPath, final Stat stat) throws Exception {
if (stat.getNumChildren() == 0) {
return ImmutableList.of();
}
final List<String> children = curatorFramework.getChildren().forPath(zkPath);
return Lists.transform(children, new Function<String, Tree>() {
@Override
public Tree apply(String input) {
try {
final Stat childStat = curatorFramework.checkExists().forPath(ZKPaths.makePath(zkPath, input));
return new Tree(new PathAndNode(zkPath, input), ImmutableList.<Tree> of(), childStat);
} catch (final Exception e) {
// not expected
throw new RuntimeException(e);
}
}
});
}
示例5: testAddTeam
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
@DataSet("teamDao/divisions.sql")
public void testAddTeam() {
teamDao.addTeam("St. Louis Blues", Division.CENTRAL, ImmutableList.of(
new Player("David", "Backes", 42, Position.CENTER),
new Player("TJ", "O'Shie", 74, Position.RIGHT_WING)
));
List<Map<String, Object>> rows = handle.createQuery("select * from teams where name=?")
.bind(0, "St. Louis Blues")
.mapToMap()
.list();
Assert.assertEquals(rows.size(), 1);
Long teamId = (Long) rows.get(0).get("id");
List<Map<String, Object>> rosterRows = handle.createQuery("select * from roster where team_id=?")
.bind(0, teamId)
.mapToMap()
.list();
Assert.assertEquals(rosterRows.size(), 2);
}
示例6: migrateAllTasksForCaseInstance
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Transactional(propagation = Propagation.MANDATORY)
public void migrateAllTasksForCaseInstance(@NonNull final String caseInstanceId, @NonNull final String targetCaseDefId) {
final List<CamundaTask> tasksToMigrate = ImmutableList.copyOf(camundaTaskRepository.findByCaseInstanceId(caseInstanceId));
log.info(String.format("Found %d tasks to migrate for case instance '%s'", tasksToMigrate.size(), caseInstanceId));
tasksToMigrate.forEach(t -> migrateOneTask(t, targetCaseDefId));
}
示例7: validateCreateRequest
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
public Optional<Errors> validateCreateRequest(JsonNode payload) {
if (payload != null &&
payload.get("username") != null &&
!isBlank(payload.get("username").asText())) {
return Optional.empty();
}
return Optional.of(Errors.from(ImmutableList.of("Field [username] is required")));
}
示例8: setUp
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
question = new Question(ImmutableList.of("Tag1", "Tag2"),
"myBody",
"myExcerpt",
"myTitle",
"myLink");
}
示例9: testInitAllSources
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testInitAllSources() throws Exception {
Configuration coreConf = new Configuration();
coreConf.set("coreConf", "present");
writeConfiguration(coreConf, new File(confDir, "core-site.xml"));
Configuration yarnConf = new Configuration();
yarnConf.set("yarnConf", "present");
writeConfiguration(yarnConf, new File(confDir, "yarn-site.xml"));
Configuration mapreduceConf = new Configuration();
mapreduceConf.set("mapreduceConf", "present");
writeConfiguration(mapreduceConf, new File(confDir, "mapred-site.xml"));
Configuration hdfsConf = new Configuration();
hdfsConf.set("hdfsConf", "present");
writeConfiguration(hdfsConf, new File(confDir, "hdfs-site.xml"));
config.mapreduceConfigs = ImmutableMap.of("sdcConf", "present");
List<Stage.ConfigIssue> issues = config.init(context, "prefix");
Assert.assertEquals(0, issues.size());
Configuration finalConf = config.getConfiguration();
for(String property : ImmutableList.of("coreConf", "yarnConf", "mapreduceConf", "sdcConf", "hdfsConf")) {
Assert.assertEquals("Key is not present: " + property, "present", finalConf.get(property));
}
}
示例10: getAllButTargetCaseDefinitionIds
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
private List<String> getAllButTargetCaseDefinitionIds(@NonNull final String caseDefinitionKey, @NonNull final String targetCaseDefinitionId) {
final List<CaseDefinition> caseDefinitions = ImmutableList.copyOf(repositoryService.createCaseDefinitionQuery().caseDefinitionKey(caseDefinitionKey).list());
return ImmutableList.copyOf(caseDefinitions.stream().filter(def -> !def.getId().equals(targetCaseDefinitionId)).map(ResourceDefinition::getId).collect(Collectors.toList()));
}
示例11: onJobSummary
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
private void onJobSummary() {
getSender().tell(ImmutableList.copyOf(jobDatabase.getJobSummary().values()), getSelf());
}
示例12: setUp
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
sumCombiner = new SumCombiner(ImmutableList.of(new IctfScorer(termStatComponent),
new IctfScorer(termStatComponent),
new IctfScorer(termStatComponent)));
}
示例13: testGetTags
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testGetTags() throws Exception {
assertEquals(ImmutableList.of("Tag1", "Tag2"), question.getTags());
}
示例14: testSetTags
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testSetTags() throws Exception {
question.setTags(ImmutableList.of("Tag3", "Tag4"));
assertEquals(ImmutableList.of("Tag3", "Tag4"), question.getTags());
}
示例15: runTest
import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
@PactVerification("Product_Catalogue_Provider")
public void runTest() {
assertEquals(new ProductCatalogueServiceAdapter("http://localhost:8080").getProducts(),
ImmutableList.of(new Product("LRPL", "2016-2-28", "Personal Loan", "Low Rate Personal Loan", "/cdn/logos/lrpl.webp")));
}