Package org.jooq.test._.testcases

Examples of org.jooq.test._.testcases.GeneralTests


        jOOQAbstractTest.reset = false;

        // [#979] When using Record.from(), and the PK remains unchanged, there
        // must not result an INSERT on a subsequent call to .store()
        A author1 = create().selectFrom(TAuthor()).where(TAuthor_ID().equal(1)).fetchOne();
        AuthorWithoutAnnotations into1 = author1.into(AuthorWithoutAnnotations.class);
        into1.yearOfBirth = null;
        author1.from(into1);
        assertEquals(1, author1.store());

        A author2 = create().selectFrom(TAuthor()).where(TAuthor_ID().equal(1)).fetchOne();
        assertEquals(author1, author2);
        assertEquals(author1.getValue(TAuthor_ID()), author2.getValue(TAuthor_ID()));
        assertEquals(author1.getValue(TAuthor_FIRST_NAME()), author2.getValue(TAuthor_FIRST_NAME()));
        assertEquals(author1.getValue(TAuthor_LAST_NAME()), author2.getValue(TAuthor_LAST_NAME()));
        assertEquals(author1.getValue(TAuthor_DATE_OF_BIRTH()), author2.getValue(TAuthor_DATE_OF_BIRTH()));
        assertEquals(author1.getValue(TAuthor_YEAR_OF_BIRTH()), author2.getValue(TAuthor_YEAR_OF_BIRTH()));
        assertNull(author2.getValue(TAuthor_YEAR_OF_BIRTH()));

        // But when the PK is modified, be sure an INSERT is executed
        A author3 = create().selectFrom(TAuthor()).where(TAuthor_ID().equal(1)).fetchOne();
        AuthorWithoutAnnotations into2 = author3.into(AuthorWithoutAnnotations.class);
        into2.ID = 3;
        author3.from(into2);
        assertEquals(1, author3.store());

        A author4 = create().selectFrom(TAuthor()).where(TAuthor_ID().equal(3)).fetchOne();
View Full Code Here


            case POSTGRES:
                log.info("SKIPPING", "fetchInto() tests");
                return;
        }

        BookWithAnnotations b = new BookWithAnnotations();
        b.firstName = "Edgar Allen";
        b.lastName2 = "Poe";
        b.dateOfBirth = new Date(1);
        b.id = 17;
        b.title = "The Raven";
View Full Code Here

            case POSTGRES:
                log.info("SKIPPING", "fetchInto() tests");
                return;
        }

        BookWithoutAnnotations b = new BookWithoutAnnotations();
        b.firstName = "Edgar Allen";
        b.lastName = "Poe";
        b.DATE_OF_BIRTH = new Date(1);
        b.id = 17;
        b.title = "The Raven";
View Full Code Here

                return;
        }

        // [#933] Map values to char / Character
        A author1 = create().newRecord(TAuthor());
        CharWithAnnotations c1 = author1.into(CharWithAnnotations.class);
        assertEquals((char) 0, c1.id1);
        assertEquals(null, c1.id2);
        assertEquals((char) 0, c1.last1);
        assertEquals(null, c1.last2);

        author1.setValue(TAuthor_ID(), 1);
        author1.setValue(TAuthor_LAST_NAME(), "a");
        CharWithAnnotations c2 = author1.into(CharWithAnnotations.class);
        assertEquals('1', c2.id1);
        assertEquals('1', c2.id2.charValue());
        assertEquals('a', c2.last1);
        assertEquals('a', c2.last2.charValue());
View Full Code Here

            assertEquals(calendars.get(index).cal1.getTime().getTime(), calendars.get(index).long1.longValue());
            assertEquals(calendars.get(index).cal1.getTime().getTime(), calendars.get(index).primitiveLong1);
        }

        A author = create().newRecord(TAuthor());
        DatesWithAnnotations dates = author.into(DatesWithAnnotations.class);

        assertNull(dates.cal1);
        assertNull(dates.cal2);
        assertNull(dates.cal3);
        assertNull(dates.date1);
View Full Code Here

        create().newRecord(TBook()).into(StaticWithAnnotations.class);
        assertEquals(13, StaticWithAnnotations.ID);

        // [#935] Final member fields are considered when reading
        B book = create().newRecord(TBook());
        book.setValue(TBook_ID(), new FinalWithAnnotations().ID);
        assertEquals(book, create().newRecord(TBook(), new FinalWithAnnotations()));

        // [#935] ... but not when writing
        FinalWithAnnotations f = create().newRecord(TBook()).into(FinalWithAnnotations.class);
        assertEquals(f.ID, new FinalWithAnnotations().ID);
    }
View Full Code Here

        create().newRecord(TBook()).into(StaticWithoutAnnotations.class);
        assertEquals(13, StaticWithoutAnnotations.ID);

        // [#935] Final member fields are considered when reading
        B book = create().newRecord(TBook());
        book.setValue(TBook_ID(), new FinalWithoutAnnotations().ID);
        assertEquals(book, create().newRecord(TBook(), new FinalWithoutAnnotations()));

        // [#935] ... but not when writing
        FinalWithoutAnnotations f = create().newRecord(TBook()).into(FinalWithoutAnnotations.class);
        assertEquals(f.ID, new FinalWithoutAnnotations().ID);
    }
View Full Code Here

        assertEquals('1', author2.getValue(TAuthor_ID(), Character.class).charValue());
        assertEquals('a', author2.getValue(TAuthor_LAST_NAME(), char.class).charValue());
        assertEquals('a', author2.getValue(TAuthor_LAST_NAME(), Character.class).charValue());

        // [#934] Static members are not to be considered
        assertEquals(create().newRecord(TBook()), create().newRecord(TBook(), new StaticWithAnnotations()));
        create().newRecord(TBook()).into(StaticWithAnnotations.class);
        assertEquals(13, StaticWithAnnotations.ID);

        // [#935] Final member fields are considered when reading
        B book = create().newRecord(TBook());
View Full Code Here

        // Arbitrary sources should have no effect
        assertEquals(create().newRecord(TBook()), create().newRecord(TBook(), (Object) null));
        assertEquals(create().newRecord(TBook()), create().newRecord(TBook(), new Object()));

        // [#934] Static members are not to be considered
        assertEquals(create().newRecord(TBook()), create().newRecord(TBook(), new StaticWithoutAnnotations()));
        create().newRecord(TBook()).into(StaticWithoutAnnotations.class);
        assertEquals(13, StaticWithoutAnnotations.ID);

        // [#935] Final member fields are considered when reading
        B book = create().newRecord(TBook());
View Full Code Here

        new SelectTests(this).testSelectSimpleQuery();
    }

    @Test
    public void testSelectCountQuery() throws Exception {
        new AggregateWindowFunctionTests(this).testSelectCountQuery();
    }
View Full Code Here

TOP

Related Classes of org.jooq.test._.testcases.GeneralTests

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.