• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ImmutableList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jersey.repackaged.com.google.common.collect.ImmutableList的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList类的具体用法?Java ImmutableList怎么用?Java ImmutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImmutableList类属于jersey.repackaged.com.google.common.collect包,在下文中一共展示了ImmutableList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
    });
}
 
开发者ID:holisticon,项目名称:holunda,代码行数:18,代码来源:MigrateCaseInstanceVersionCmd.java


示例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();
}
 
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:25,代码来源:UserRequestValidator.java


示例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()));
}
 
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:20,代码来源:ResetPasswordResource.java


示例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);
            }
        }
    });
}
 
开发者ID:shaie,项目名称:browze,代码行数:20,代码来源:ZooResource.java


示例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);
}
 
开发者ID:arteam,项目名称:jdit-examples,代码行数:20,代码来源:TeamDaoTest.java


示例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));
}
 
开发者ID:holisticon,项目名称:holunda,代码行数:9,代码来源:TaskMigrator.java


示例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")));
}
 
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:10,代码来源:ForgottenPasswordValidator.java


示例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");
}
 
开发者ID:vcu-swim-lab,项目名称:stack-intheflow,代码行数:9,代码来源:QuestionTest.java


示例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));
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:29,代码来源:TestMapReduceConfig.java


示例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()));
}
 
开发者ID:holisticon,项目名称:holunda,代码行数:6,代码来源:MigrateCaseInstanceVersionCmd.java


示例11: onJobSummary

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
private void onJobSummary() {
    getSender().tell(ImmutableList.copyOf(jobDatabase.getJobSummary().values()), getSelf());
}
 
开发者ID:Abiy,项目名称:distGatling,代码行数:4,代码来源:Master.java


示例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)));
}
 
开发者ID:vcu-swim-lab,项目名称:stack-intheflow,代码行数:7,代码来源:SumCombinerTest.java


示例13: testGetTags

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testGetTags() throws Exception {
    assertEquals(ImmutableList.of("Tag1", "Tag2"), question.getTags());
}
 
开发者ID:vcu-swim-lab,项目名称:stack-intheflow,代码行数:5,代码来源:QuestionTest.java


示例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());
}
 
开发者ID:vcu-swim-lab,项目名称:stack-intheflow,代码行数:6,代码来源:QuestionTest.java


示例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")));
}
 
开发者ID:robcrowley,项目名称:microservices-pact-demo,代码行数:7,代码来源:ProductCatalogueServiceAdapterTests.java


示例16: StatusCommand

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
public StatusCommand(final ServerContext context, final String localPath) {
    this(context, localPath == null ? null : ImmutableList.of(localPath));
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:4,代码来源:StatusCommand.java


示例17: testGetPlayerListNames

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testGetPlayerListNames() {
    List<String> playerLastNames = playerDao.getPlayerLastNames();
    assertEquals(playerLastNames, ImmutableList.of("Ellis", "Seguin", "Tarasenko", "Tavares"));
}
 
开发者ID:arteam,项目名称:jdit-examples,代码行数:6,代码来源:PlayerDaoTest.java


示例18: migrateOneCaseInstance

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void migrateOneCaseInstance(@NonNull final String caseInstanceId, @NonNull final String targetCaseDefId) {
    log.info(String.format("Migrating case instance '%s'", caseInstanceId));

    final List<CamundaCaseExecution> executionsToMigrate = ImmutableList.copyOf(camundaCaseExecutionRepository.findByCaseInstanceId(caseInstanceId));

    log.info(String.format("Found %d executions for case instance '%s'", executionsToMigrate.size(), caseInstanceId));

    executionsToMigrate.forEach(execution -> migrateOneExecution(execution, targetCaseDefId));

    produceCaseInstanceHistoryEventsForOneCaseInstance(caseInstanceId);

    taskMigrator.migrateAllTasksForCaseInstance(caseInstanceId, targetCaseDefId);
}
 
开发者ID:holisticon,项目名称:holunda,代码行数:15,代码来源:CaseInstanceMigrator.java


示例19: confirmExpectedUrlsPresentTest

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void confirmExpectedUrlsPresentTest() throws InterruptedException, ExecutionException{
	
	assertThat(rest.get("http://localhost:8080/test-app/test-status/ping"),is("test!"));
	
	
	assertThat((List<String>)rest.post("http://localhost:8081/alternative-app/alt-status/ping",new ImmutableEntity("value",ImmutableList.of("hello","world")),List.class),
			hasItem("hello"));

}
 
开发者ID:aol,项目名称:micro-server,代码行数:11,代码来源:EmbeddedAppTest.java


示例20: confirmTestAppCantUseAltAppResources

import jersey.repackaged.com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test(expected=NotFoundException.class)
public void confirmTestAppCantUseAltAppResources(){
	
	assertThat((List<String>)rest.post("http://localhost:8081/test-app/alt-status/ping",new ImmutableEntity("value",ImmutableList.of("hello","world")),List.class),
			hasItem("hello"));

}
 
开发者ID:aol,项目名称:micro-server,代码行数:8,代码来源:EmbeddedAppTest.java



注:本文中的jersey.repackaged.com.google.common.collect.ImmutableList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EditorHighlighterProvider类代码示例发布时间:2022-05-22
下一篇:
Java SourceReader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap