Search in sources :

Example 1 with BeanInformation

use of org.apache.archiva.rest.api.v2.model.BeanInformation in project archiva by apache.

the class NativeSecurityConfigurationServiceTest method testGetRbacManagers.

@Test
void testGetRbacManagers() {
    String token = getAdminToken();
    Response response = given().spec(getRequestSpec(token)).contentType(JSON).when().get("rbac_managers").then().statusCode(200).extract().response();
    assertNotNull(response);
    List<BeanInformation> rbacList = response.getBody().jsonPath().getList("", BeanInformation.class);
    assertEquals(2, rbacList.size());
    assertTrue(rbacList.stream().anyMatch(bi -> "Database RBAC Manager".equals(bi.getDisplayName())));
    assertTrue(rbacList.stream().anyMatch(bi -> "LDAP RBAC Manager".equals(bi.getDisplayName())));
}
Also used : Response(io.restassured.response.Response) BeanInformation(org.apache.archiva.rest.api.v2.model.BeanInformation) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Arrays(java.util.Arrays) JSON(io.restassured.http.ContentType.JSON) HashMap(java.util.HashMap) CacheConfiguration(org.apache.archiva.rest.api.v2.model.CacheConfiguration) DisplayName(org.junit.jupiter.api.DisplayName) MethodOrderer(org.junit.jupiter.api.MethodOrderer) AfterAll(org.junit.jupiter.api.AfterAll) Test(org.junit.jupiter.api.Test) BeanInformation(org.apache.archiva.rest.api.v2.model.BeanInformation) List(java.util.List) TestInstance(org.junit.jupiter.api.TestInstance) Response(io.restassured.response.Response) PropertyEntry(org.apache.archiva.components.rest.model.PropertyEntry) BeforeAll(org.junit.jupiter.api.BeforeAll) Map(java.util.Map) Assertions(org.junit.jupiter.api.Assertions) RestAssured.given(io.restassured.RestAssured.given) Tag(org.junit.jupiter.api.Tag) PagedResult(org.apache.archiva.components.rest.model.PagedResult) LdapConfiguration(org.apache.archiva.rest.api.v2.model.LdapConfiguration) Test(org.junit.jupiter.api.Test)

Example 2 with BeanInformation

use of org.apache.archiva.rest.api.v2.model.BeanInformation in project archiva by apache.

the class NativeSecurityConfigurationServiceTest method testGetUserManagers.

@Test
void testGetUserManagers() {
    String token = getAdminToken();
    Response response = given().spec(getRequestSpec(token)).contentType(JSON).when().get("user_managers").then().statusCode(200).extract().response();
    assertNotNull(response);
    List<BeanInformation> usrList = response.getBody().jsonPath().getList("", BeanInformation.class);
    assertEquals(2, usrList.size());
    assertTrue(usrList.stream().anyMatch(bi -> "LDAP User Manager".equals(bi.getDisplayName())));
    assertTrue(usrList.stream().anyMatch(bi -> "Database User Manager".equals(bi.getDisplayName())));
}
Also used : Response(io.restassured.response.Response) BeanInformation(org.apache.archiva.rest.api.v2.model.BeanInformation) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Arrays(java.util.Arrays) JSON(io.restassured.http.ContentType.JSON) HashMap(java.util.HashMap) CacheConfiguration(org.apache.archiva.rest.api.v2.model.CacheConfiguration) DisplayName(org.junit.jupiter.api.DisplayName) MethodOrderer(org.junit.jupiter.api.MethodOrderer) AfterAll(org.junit.jupiter.api.AfterAll) Test(org.junit.jupiter.api.Test) BeanInformation(org.apache.archiva.rest.api.v2.model.BeanInformation) List(java.util.List) TestInstance(org.junit.jupiter.api.TestInstance) Response(io.restassured.response.Response) PropertyEntry(org.apache.archiva.components.rest.model.PropertyEntry) BeforeAll(org.junit.jupiter.api.BeforeAll) Map(java.util.Map) Assertions(org.junit.jupiter.api.Assertions) RestAssured.given(io.restassured.RestAssured.given) Tag(org.junit.jupiter.api.Tag) PagedResult(org.apache.archiva.components.rest.model.PagedResult) LdapConfiguration(org.apache.archiva.rest.api.v2.model.LdapConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

RestAssured.given (io.restassured.RestAssured.given)2 JSON (io.restassured.http.ContentType.JSON)2 Response (io.restassured.response.Response)2 Arrays (java.util.Arrays)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 PagedResult (org.apache.archiva.components.rest.model.PagedResult)2 PropertyEntry (org.apache.archiva.components.rest.model.PropertyEntry)2 BeanInformation (org.apache.archiva.rest.api.v2.model.BeanInformation)2 CacheConfiguration (org.apache.archiva.rest.api.v2.model.CacheConfiguration)2 LdapConfiguration (org.apache.archiva.rest.api.v2.model.LdapConfiguration)2 AfterAll (org.junit.jupiter.api.AfterAll)2 Assertions (org.junit.jupiter.api.Assertions)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 DisplayName (org.junit.jupiter.api.DisplayName)2 MethodOrderer (org.junit.jupiter.api.MethodOrderer)2 Tag (org.junit.jupiter.api.Tag)2 Test (org.junit.jupiter.api.Test)2 TestInstance (org.junit.jupiter.api.TestInstance)2