use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testLongProperty.
// ----- long property tests -----
@Test
public void testLongProperty() {
try {
final Property<Long> instance = TestFour.longProperty;
final TestFour testEntity = createTestNode(TestFour.class);
assertNotNull(testEntity);
// store long in the test entitiy
final Long value = 2857312362L;
try (final Tx tx = app.tx()) {
instance.setProperty(securityContext, testEntity, value);
tx.success();
}
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(value, instance.getProperty(securityContext, testEntity, true));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testPositiveInfinityDoublePropertySearchOnNode.
@Test
public void testPositiveInfinityDoublePropertySearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<Double> key = TestFour.doubleProperty;
properties.put(key, Double.POSITIVE_INFINITY);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(Double.POSITIVE_INFINITY, testEntity.getProperty(key), 0.0);
Result<TestFour> result = app.nodeQuery(TestFour.class).and(key, Double.POSITIVE_INFINITY).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testSimpleEnumProperty.
// ----- enum property tests -----
@Test
public void testSimpleEnumProperty() {
try {
final PropertyMap properties = new PropertyMap();
properties.put(TestFour.enumProperty, TestEnum.Status1);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(TestEnum.Status1, testEntity.getProperty(TestFour.enumProperty));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testDoubleProperty.
// ----- double property tests -----
@Test
public void testDoubleProperty() {
try {
final Property<Double> instance = TestFour.doubleProperty;
final TestFour testEntity = createTestNode(TestFour.class);
assertNotNull(testEntity);
// store double in the test entitiy
final Double value = 3.141592653589793238;
try (final Tx tx = app.tx()) {
instance.setProperty(securityContext, testEntity, value);
tx.success();
}
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(value, instance.getProperty(securityContext, testEntity, true));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testDateProperty.
// ----- date property tests -----
@Test
public void testDateProperty() {
try {
final Property<Date> instance = TestFour.dateProperty;
final TestFour testEntity = createTestNode(TestFour.class);
assertNotNull(testEntity);
// store Date in the test entitiy
final Date value = new Date(123456789L);
try (final Tx tx = app.tx()) {
instance.setProperty(securityContext, testEntity, value);
tx.success();
}
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(value, instance.getProperty(securityContext, testEntity, true));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
Aggregations