Search in sources :

Example 1 with AdminToolDescriptors

use of com.enonic.xp.admin.tool.AdminToolDescriptors in project xp by enonic.

the class AdminToolDescriptorServiceImplTest method getByApplication.

@Test
public void getByApplication() {
    final AdminToolDescriptors result = this.service.getByApplication(ApplicationKey.from("myapp1"));
    assertEquals(1, result.getSize());
    final AdminToolDescriptor adminToolDescriptor = result.get(0);
    assertEquals("My admin tool", adminToolDescriptor.getDisplayName());
    assertEquals("My admin tool description", adminToolDescriptor.getDescription());
    assertEquals(1, adminToolDescriptor.getAllowedPrincipals().getSize());
}
Also used : AdminToolDescriptors(com.enonic.xp.admin.tool.AdminToolDescriptors) AdminToolDescriptor(com.enonic.xp.admin.tool.AdminToolDescriptor) Test(org.junit.jupiter.api.Test)

Example 2 with AdminToolDescriptors

use of com.enonic.xp.admin.tool.AdminToolDescriptors in project xp by enonic.

the class AdminToolDescriptorServiceImplTest method getAllowedAdminToolDescriptors.

@Test
public void getAllowedAdminToolDescriptors() throws Exception {
    final PrincipalKeys principalKeys = PrincipalKeys.from(PrincipalKey.from("role:system.user.admin"));
    AdminToolDescriptors result = this.service.getAllowedAdminToolDescriptors(principalKeys);
    assertNotNull(result);
    assertEquals(1, result.getSize());
    result = this.service.getAllowedAdminToolDescriptors(PrincipalKeys.empty());
    assertNotNull(result);
    assertEquals(0, result.getSize());
}
Also used : PrincipalKeys(com.enonic.xp.security.PrincipalKeys) AdminToolDescriptors(com.enonic.xp.admin.tool.AdminToolDescriptors) Test(org.junit.jupiter.api.Test)

Aggregations

AdminToolDescriptors (com.enonic.xp.admin.tool.AdminToolDescriptors)2 Test (org.junit.jupiter.api.Test)2 AdminToolDescriptor (com.enonic.xp.admin.tool.AdminToolDescriptor)1 PrincipalKeys (com.enonic.xp.security.PrincipalKeys)1