use of org.structr.core.graph.attribute.Name in project structr by structr.
the class PagingAndSortingTest method testRelationshipResourcePagingOnCollectionResource.
@Test
public void testRelationshipResourcePagingOnCollectionResource() {
final Class testUserType = createTestUserType();
final PropertyKey<String> passwordKey = StructrApp.key(testUserType, "password");
Principal tester = null;
try (final Tx tx = app.tx()) {
tester = app.create(testUserType, new Name("tester"), new NodeAttribute<>(passwordKey, "test"));
tx.success();
} catch (FrameworkException fex) {
fex.printStackTrace();
}
final App app = StructrApp.getInstance(SecurityContext.getInstance(tester, AccessMode.Backend));
try (final Tx tx = app.tx()) {
app.create(TestOne.class, "TestOne1");
app.create(TestOne.class, "TestOne2");
tx.success();
} catch (FrameworkException fex) {
fex.printStackTrace();
}
RestAssured.given().contentType("application/json; charset=UTF-8").filter(ResponseLoggingFilter.logResponseIfStatusCodeIs(200)).expect().statusCode(200).body("result_count", equalTo(4)).body("page_size", equalTo(2)).body("page_count", equalTo(2)).body("result", hasSize(2)).body("result[0].type", equalTo("PrincipalOwnsNode")).body("result[1].type", equalTo("Security")).when().get("/TestOne/in?pageSize=2");
}
use of org.structr.core.graph.attribute.Name in project structr by structr.
the class PagingAndSortingTest method testRelationshipResourcePagingOnEntityResource.
@Test
public void testRelationshipResourcePagingOnEntityResource() {
final Class testUserType = createTestUserType();
final PropertyKey<String> passwordKey = StructrApp.key(testUserType, "password");
Principal tester = null;
try (final Tx tx = app.tx()) {
tester = app.create(testUserType, new Name("tester"), new NodeAttribute<>(passwordKey, "test"));
tx.success();
} catch (FrameworkException fex) {
fex.printStackTrace();
}
final App app = StructrApp.getInstance(SecurityContext.getInstance(tester, AccessMode.Backend));
try (final Tx tx = app.tx()) {
app.create(TestOne.class, "TestOne1");
app.create(TestOne.class, "TestOne2");
tx.success();
} catch (FrameworkException fex) {
fex.printStackTrace();
}
RestAssured.given().contentType("application/json; charset=UTF-8").filter(ResponseLoggingFilter.logResponseIfStatusCodeIs(200)).expect().statusCode(200).body("result_count", equalTo(4)).body("page_size", equalTo(2)).body("page_count", equalTo(2)).body("result", hasSize(2)).body("result[0].type", equalTo("PrincipalOwnsNode")).body("result[1].type", equalTo("Security")).when().get("/TestUser/" + tester.getUuid() + "/out?pageSize=2");
}
Aggregations