JobServiceTest.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:herd 作者:
@Test
public void testDeleteJobAssertNoErrorWhenUserHasPermissions() throws Exception
{
    // Start a job that will wait in a receive task
    jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
    Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));

    String username = "username";
    ApplicationUser applicationUser = new ApplicationUser(getClass());
    applicationUser.setUserId(username);
    applicationUser.setNamespaceAuthorizations(new HashSet<>());
    applicationUser.getNamespaceAuthorizations()
        .add(new NamespaceAuthorization(TEST_ACTIVITI_NAMESPACE_CD, Arrays.asList(NamespacePermissionEnum.EXECUTE)));
    SecurityContextHolder.getContext().setAuthentication(
        new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
            null));

    try
    {
        jobService.deleteJob(job.getId(), new JobDeleteRequest("test delete reason"));
    }
    catch (AccessDeniedException e)
    {
        fail();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号