APISonar


org.neo4j.values.storable.DateValue.date

> org > neo4j > values > storable > DateValue > date
org APIs neo4j APIs values APIs storable APIs DateValue APIs date APIs

Example 1
public void testDateTypeSmallEpochDay()
    {
        LocalDate date = DateValue.date( 2018, 1, 31 ).asObjectCopy();
        String key = "dt";
        node1.setProperty( key, date );
        newTransaction();

        Object property = node1.getProperty( key );
        assertEquals( date, property );
    }
Example 2
void shouldHandleDate()
    {
        // Given
        DateValue dvalue = DateValue.date( 1, 2, 3 );

        // When
        dvalue.writeTo( converter );

        // Then
        Object value = converter.value();
        assertThat( value, instanceOf( LocalDate.class ) );
        assertThat( value, equalTo( dvalue.asObjectCopy() ) );
    }
Example 3
void testValueGroupRange()
    {
        RangePredicate<?> p = IndexQuery.range( propId, ValueGroup.DATE );

        assertTrue( test( p, DateValue.date( -4000, 1, 31 ) ) );
        assertTrue( test( p, DateValue.date( 2018, 3, 7 ) ) );
        assertFalse( test( p, DateTimeValue.datetime( 2018, 3, 7, 0, 0, 0, 0, ZoneOffset.UTC ) ) );
        assertFalse( test( p, stringValue( "hej" ) ) );
        assertFalse( test( p, gps2_3d ) );
    }
Example 4
void failToOpenStoreWithDatePropertyUsingOldFormat()
    {
        File storeDir = testDirectory.storeDir();
        GraphDatabaseService database = startDatabaseWithFormat( storeDir, StandardV3_4.NAME );
        try ( Transaction transaction = database.beginTx() )
        {
            Node node = database.createNode();
            node.setProperty( "a", DateValue.date( 1991, 5, 3 ) );
            transaction.success();
        }
        database.shutdown();

        Throwable throwable = assertThrows( Throwable.class, () -> startDatabaseWithFormat( storeDir, StandardV3_2.NAME ) );
        assertSame( StoreUpgrader.AttemptedDowngradeException.class, Exceptions.rootCause( throwable ).getClass() );
    }