• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TestActiveObjects类的典型用法和代码示例

java 3次浏览

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

TestActiveObjects类属于com.atlassian.activeobjects.test包,在下文中一共展示了TestActiveObjects类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
    forumAO.setDescription("ForumDescription");
    forumAO.save();
    forumID = forumAO.getID();
    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
    itemRepository = new ItemRepositoryImplement(ao, rightsManagement);
    mockAdminUser = MockConfluenceUserFactory.mockUser();
    mockParticipantUser = MockConfluenceUserFactory.mockUser();
    userKeyAdmin = mockAdminUser.getKey().getStringValue();
    userKeyParticipant = mockParticipantUser.getKey().getStringValue();
    rightsManagement.initPermissions();
    rightsManagement.initAdmin(userKeyAdmin, forumID);
    rightsManagement.addUser(userKeyAdmin, userKeyParticipant, "Admin",
            forumID);
    AuthenticatedUserThreadLocal.set(mockAdminUser);
    AuthenticatedUserThreadLocal.set(mockParticipantUser);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:27,
代码来源:ThreadRepositoryTest.java

示例2: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forum = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
    forum.setDescription(FORUMDESCRIPTION);
    forum.save();

    forum2 = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
    forum2.setDescription(FORUMDESCRIPTION);
    forum2.save();
    FORUMID = forum.getID();
    FORUMID2 = forum2.getID();

    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    rightsManagement.initPermissions();
    rightsManagement.initAdmin(ADMINUSERKEY, FORUMID);
    rightsManagement.initAdmin(ADMINUSERKEY, FORUMID2);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:24,
代码来源:RightsManagementTest.java

示例3: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
    forumAO.setDescription("ForumDescription");
    forumAO.save();
    forumID = forumAO.getID();
    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
    itemRepository = new ItemRepositoryImplement(ao, rightsManagement);
    itemRestService = new ItemRestService(itemRepository, sanitizer);
    mockAdminUser = MockConfluenceUserFactory.mockUser();
    userKeyAdmin = mockAdminUser.getKey().getStringValue();
    rightsManagement.initPermissions();
    rightsManagement.initAdmin(userKeyAdmin, forumID);
    AuthenticatedUserThreadLocal.set(mockAdminUser);
    thread = threadRepository.add(threadTitle, threadDescription,
            threadSticky, date, forumID, userKeyAdmin);
    item = itemRepository.add(itemMessage, date, thread.getID(),
            userKeyAdmin);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:27,
代码来源:ItemRestServiceTest.java

示例4: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
    forumAO.setDescription("ForumDescription");
    forumAO.save();
    forumID = forumAO.getID();
    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
    threadRestService = new ThreadRestService(threadRepository, sanitizer);
    mockAdminUser = MockConfluenceUserFactory.mockUser();
    userKeyAdmin = mockAdminUser.getKey().getStringValue();
    rightsManagement.initPermissions();
    rightsManagement.initAdmin(userKeyAdmin, forumID);
    AuthenticatedUserThreadLocal.set(mockAdminUser);
    thread = threadRepository.add(threadTitle, threadDescription,
            threadSticky, threadDate, forumID, userKeyAdmin);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:24,
代码来源:ThreadRestServiceTest.java

示例5: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    // ensure our runner sets this for us
    Assert.assertNotNull(entityManager);

    Mockito.when(pr.getToRef()).thenReturn(toRef);
    Mockito.when(pr.getFromRef()).thenReturn(fromRef);
    Mockito.when(pr.getId()).thenReturn(PR_ID);
    Mockito.when(toRef.getRepository()).thenReturn(repo);
    Mockito.when(toRef.getLatestChangeset()).thenReturn(TO_SHA);
    Mockito.when(fromRef.getLatestChangeset()).thenReturn(FROM_SHA);
    Mockito.when(repo.getId()).thenReturn(REPO_ID);

    Mockito.when(prs.getById(Mockito.anyInt(), Mockito.anyLong())).thenReturn(pr);
    Mockito.when(rs.getById(Mockito.anyInt())).thenReturn(repo);

    ao = new TestActiveObjects(entityManager);

    cpm = new PersistenceManager(ao, lf);
}
 

开发者ID:palantir,
项目名称:stash-disapproval-plugin,
代码行数:23,
代码来源:PersistenceManagerTest.java

示例6: setUp

点赞 3

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    Mockito.when(pr.getToRef()).thenReturn(toRef);
    Mockito.when(pr.getFromRef()).thenReturn(fromRef);
    Mockito.when(pr.getId()).thenReturn(PR_ID);
    Mockito.when(toRef.getRepository()).thenReturn(repo);
    Mockito.when(toRef.getLatestChangeset()).thenReturn(TO_SHA);
    Mockito.when(fromRef.getLatestChangeset()).thenReturn(FROM_SHA);
    Mockito.when(repo.getId()).thenReturn(REPO_ID);

    // ensure our runner sets this for us
    Assert.assertNotNull(entityManager);

    ao = new TestActiveObjects(entityManager);

    cpm = new ConfigurationPersistenceImpl(ao, lf, publisher);
}
 

开发者ID:palantir,
项目名称:stashbot,
代码行数:20,
代码来源:ConfigurationTest.java

示例7: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
    forumAO.setDescription("ForumDescription");
    forumAO.save();
    forumID = forumAO.getID();
    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
    itemRepository = new ItemRepositoryImplement(ao, rightsManagement);
    mockAdminUser = MockConfluenceUserFactory.mockUser();
    mockParticipantUser = MockConfluenceUserFactory.mockUser();
    userKeyAdmin = mockAdminUser.getKey().getStringValue();
    userKeyParticipant = mockParticipantUser.getKey().getStringValue();
    rightsManagement.initPermissions();
    rightsManagement.initAdmin(userKeyAdmin, forumID);
    rightsManagement.addUser(userKeyAdmin, userKeyParticipant, "Admin",
            forumID);
    AuthenticatedUserThreadLocal.set(mockAdminUser);
    AuthenticatedUserThreadLocal.set(mockParticipantUser);
    thread = threadRepository.add(threadTitle, threadDescription,
            threadSticky, date, forumID, userKeyAdmin);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:29,
代码来源:ItemRepositoryTest.java

示例8: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    permission = ao.create(PermissionAO.class, new DBParam("NAME", PERMISSIONNAME));
    sPerm = SerializablePermission.build(permission);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:8,
代码来源:SerializablePermissionTest.java

示例9: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forum = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
    forum.setDescription(FORUMDESCRIPTION);
    forum.save();
    forumID = forum.getID();
    thread = ao.create(ThreadAO.class, new DBParam("TITLE", TESTTITLE), new DBParam("DESCRIPTION", TESTDESCRIPTION),
            new DBParam("STICKY", TESTSTICKY), new DBParam("CREATION_DATE", TESTCREATIONDATE), new DBParam("FORUM_ID", forumID), new DBParam("USER_KEY", USERKEY));
    sThread = SerializableThread.build(thread);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:13,
代码来源:SerializableThreadTest.java

示例10: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forum = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
    forum.setDescription(FORUMDESCRIPTION);
    forum.save();
    forumID = forum.getID();
    userKey = "JUNIT";
    role = getRole();
    user = getUser(userKey, role);
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:13,
代码来源:SerializableUserTest.java

示例11: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    forum = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
    forum.setDescription(FORUMDESCRIPTION);
    forum.save();
    forumID = forum.getID();
    role = ao.create(RoleAO.class, new DBParam("NAME", ROLENAME), new DBParam("FORUM_ID", forumID));
    role.setDescription(ROLEDESCRIPTION);
    role.save();
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:13,
代码来源:SerializableRoleTest.java

示例12: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ao = new TestActiveObjects(entityManager);
    post = ao.create(PostAO.class, new DBParam("USER_KEY", USERKEY), new DBParam("CREATION_DATE", DATE), new DBParam("LAST_EDITED_DATE", DATE), new DBParam("MESSAGE", MESSAGE));
    AttachmentAO attachment = ao.create(AttachmentAO.class, new DBParam("NAME", ATTACHMENTNAME), new DBParam("URL", ATTACHMENTURL));
    attachment.setPost(post);
    attachment.save();
    this.attachment = attachment;
}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:10,
代码来源:SerializablePostTest.java

示例13: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    // ensure our runner sets this for us
    Assert.assertNotNull(entityManager);

    // Init mocks worked?
    Assert.assertNotNull(rs);
    Assert.assertNotNull(repo);

    Mockito.when(rs.getById(1234)).thenReturn(repo);
    Mockito.when(repo.getId()).thenReturn(1234);
    Mockito.when(repo.getProject()).thenReturn(project);
    Mockito.when(project.getName()).thenReturn("projectName");
    Mockito.when(rs.getById(Mockito.anyInt())).thenReturn(repo);

    ao = new TestActiveObjects(entityManager);

    jtm = new JobTemplateManager(ao, lf);
    cpm = new ConfigurationPersistenceImpl(ao, lf, publisher);

    verifyCommitJT = jtm.getDefaultVerifyJob();
    verifyPRJT = jtm.getDefaultVerifyPullRequestJob();
    publishJT = jtm.getDefaultPublishJob();

    rc = cpm.getRepositoryConfigurationForRepository(repo);

    jtm.setJenkinsJobMapping(rc, verifyCommitJT, true, true);
    jtm.setJenkinsJobMapping(rc, publishJT, true, true);
    jtm.setJenkinsJobMapping(rc, verifyPRJT, true, true);

}
 

开发者ID:palantir,
项目名称:stashbot,
代码行数:34,
代码来源:JenkinsJobTest.java

示例14: setup

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setup() {
    activeObjects = new TestActiveObjects(entityManager);
    dao = new WebHookConfigurationDao(activeObjects);
}
 

开发者ID:Eernie,
项目名称:bitbucket-webhooks-plugin,
代码行数:6,
代码来源:WebHookConfigurationDaoTest.java

示例15: setup

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setup() {

    ao = new TestActiveObjects(entityManager);
    keyRepo = new EnterpriseKeyRepositoryImpl(ao);
}
 

开发者ID:libertymutual,
项目名称:ssh-key-enforcer-stash,
代码行数:7,
代码来源:EnterpriseSshKeyRepositoryTest.java

示例16: setup

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setup() {
    //mock app users
    userService = mock(UserService.class);
    unblessedUser = mock(ApplicationUser.class);
    when(unblessedUser.getId()).thenReturn(VALID_USER_ID);
    when(userService.isUserInGroup(unblessedUser, AUTHED_GROUP)).thenReturn(false);
    blessedUser = mock(ApplicationUser.class);
    when(blessedUser.getId()).thenReturn(VALID_USER_ID);
    when(blessedUser.getSlug()).thenReturn("ADMIN");
    when(userService.isUserInGroup(blessedUser, AUTHED_GROUP)).thenReturn(true);
    when(userService.getUserById(anyInt())).thenReturn(blessedUser);

    // mock their keys and potential keys
    when(approvedUserKey.getText()).thenReturn(APPROVED_PUBLIC_KEY_ONE);
    when(approvedUserKey.getUser()).thenReturn(blessedUser);
    when(approvedUserKey.getLabel()).thenReturn("Known key created inside stash");

    when(unapprovedUserKey.getText()).thenReturn(UNAPPROVED_PUBLIC_KEY_ONE);
    when(unapprovedUserKey.getUser()).thenReturn(unblessedUser);
    when(unapprovedUserKey.getLabel()).thenReturn("Unknown key created outside stash");

    when(existingKeyForUnapprovedUser.getText()).thenReturn(APPROVED_PUBLIC_KEY_ONE);
    when(existingKeyForUnapprovedUser.getUser()).thenReturn(unblessedUser);

    ao = new TestActiveObjects(entityManager);
    keyRepo = new EnterpriseKeyRepositoryImpl(ao);
    stashKeyService = mock(SshKeyService.class);
    when(stashKeyService.addForUser(any(ApplicationUser.class),anyString())).thenReturn(approvedUserKey);
    notificationService = mock(NotificationService.class);
    keyPairGenerator = new JschSshKeyPairGenerator();
    when(userService.existsGroup(anyString())).thenReturn(true);
    pluginSettingsService = mock(PluginSettingsService.class);
    when(pluginSettingsService.getMillisBetweenRuns()).thenReturn(60000L);
    when(pluginSettingsService.getDaysAllowedForUserKeys()).thenReturn(DAYS_ALLOWED);
    when(pluginSettingsService.getDaysAllowedForBambooKeys()).thenReturn(DAYS_ALLOWED);
    when(pluginSettingsService.getAuthorizedGroup()).thenReturn(AUTHED_GROUP);
    when(userService.getUserByName(KeyRotationJobRunner.ADMIN_ACCOUNT_NAME)).thenReturn(mock(ApplicationUser.class));//defeat NPE check
    ourKeyService = new EnterpriseSshKeyServiceImpl(stashKeyService, keyRepo, keyPairGenerator, notificationService,userService, pluginSettingsService);

}
 

开发者ID:libertymutual,
项目名称:ssh-key-enforcer-stash,
代码行数:42,
代码来源:EnterpriseSshKeyManagerImplTest.java

示例17: setUp

点赞 2

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    assertNotNull(entityManager);
    ao = new TestActiveObjects(entityManager);
    userManagementRepository = new UserManagementRepositoryImplement(ao);
    roleManagementRepository = new RoleManagementRepositoryImplement(ao);
    permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
    forumRepository = new ForumRepositoryImplement(ao);
    rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
    restService = new MockRightsManagementRestService(rightsManagement);

    forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
    forumAO.setDescription("ForumDescription");
    forumAO.save();
    forumID = forumAO.getID();

    permissionAO = ao.create(PermissionAO.class, new DBParam("NAME", "Admin"));
    permissionAO.save();
    permissionAO2 = ao.create(PermissionAO.class, new DBParam("NAME", "User"));
    permissionAO2.save();
    roleAO = ao.create(RoleAO.class);
    roleAO.setName("Admin");
    roleAO.setDescription("Admin");
    roleAO.setForum(forumAO);
    roleAO.save();
    roleAO2 = ao.create(RoleAO.class);
    roleAO2.setName("User");
    roleAO2.setDescription("User");
    roleAO2.setForum(forumAO);
    roleAO2.save();
    roleToPermissionAO = ao.create(RoleToPermissionAO.class);
    roleToPermissionAO.setPermission(permissionAO);
    roleToPermissionAO.setRole(roleAO);
    roleToPermissionAO.save();
    roleToPermissionAO2 = ao.create(RoleToPermissionAO.class);
    roleToPermissionAO2.setPermission(permissionAO2);
    roleToPermissionAO2.setRole(roleAO2);
    roleToPermissionAO2.save();

    userAO = ao.create(UserAO.class, new DBParam("USER_KEY", "1"), new DBParam("FORUM_ID", forumID));
    userAO.setRole(roleAO);
    userAO.save();
    userAO2 = ao.create(UserAO.class, new DBParam("USER_KEY", "2"), new DBParam("FORUM_ID", forumID));
    userAO2.setRole(roleAO2);
    userAO2.save();

}
 

开发者ID:confluence-fourum,
项目名称:Fourum-Plugin,
代码行数:48,
代码来源:RightsManagementRestTest.java

示例18: setUp

点赞 1

import com.atlassian.activeobjects.test.TestActiveObjects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    ao = new TestActiveObjects(entityManager);

}
 

开发者ID:palantir,
项目名称:stashbot,
代码行数:8,
代码来源:ConfigurationUpgradeV2Test.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)