Package org.caffinitas.mapper.core

Examples of org.caffinitas.mapper.core.MappedSchemaObject


    }

    @Test(expectedExceptions = PersistenceRuntimeException.class)
    public void missingColumns_fail() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(IncompleteFailEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 9);
        String ddl = entity.getCreateDDL();

        // REMOVE SOME COLUMNS
        Pattern pattern = Pattern.compile("^  (int_prim|some_enum1|some_enum3|str) .+$", Pattern.MULTILINE);
        Matcher m = pattern.matcher(ddl);
        String ddlShort = m.replaceAll("");
View Full Code Here


        } finally { session.close(); }
    }

    @Test
    public void mappedKeyspace() throws Exception {
        MappedSchemaObject entity = persistenceManager.getEntity(MappedKeyspaceNameEntity.class);
        Assert.assertEquals(entity.getCqlTable().getKeyspace(), "lookup_ks");
    }
View Full Code Here

    }

    @Test(expectedExceptions = PersistenceRuntimeException.class)
    public void notExists_fail() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(NotExistsFailEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 9);
        String ddl = entity.getCreateDDL();

        // REMOVE SOME COLUMNS
        Pattern pattern = Pattern.compile("^  (int_prim|some_enum1|some_enum3|str) .+$", Pattern.MULTILINE);
        Matcher m = pattern.matcher(ddl);
        String ddlShort = m.replaceAll("");
View Full Code Here

    }

    @Test(expectedExceptions = PersistenceRuntimeException.class)
    public void notExists_ignore() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(NotExistsEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 9);
        String ddl = entity.getCreateDDL();

        // REMOVE SOME COLUMNS
        Pattern pattern = Pattern.compile("^  (int_prim|some_enum1|some_enum3|str) .+$", Pattern.MULTILINE);
        Matcher m = pattern.matcher(ddl);
        String ddlShort = m.replaceAll("");
View Full Code Here

    }

    @Test
    public void simpleEntity() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(SimpleEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 8);
        createSchemaDo(Collections.<Class<?>>singletonList(SimpleEntity.class));

        SimpleEntity inst = new SimpleEntity();
        inst.setId(11);
        inst.setSomeEnum1(SomeEnum.ONE);
View Full Code Here

    }

    @Test
    public void noDataColumnsEntity() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(NoDataColumnsEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 2);
        createSchemaDo(Collections.<Class<?>>singletonList(NoDataColumnsEntity.class));

        NoDataColumnsEntity inst = new NoDataColumnsEntity();
        inst.setId(11);
        inst.setStr("foo");
View Full Code Here

    }

    @Test
    public void collEntity() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(CollEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 4);
        createSchemaDo(Collections.<Class<?>>singletonList(CollEntity.class));

        CollEntity inst = new CollEntity();
        inst.setId(11);
        inst.setStringList(Arrays.asList("one", "two", "three"));
View Full Code Here

    }

    @Test
    public void mapEntity() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(MapEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 3);
        createSchemaDo(Collections.<Class<?>>singletonList(MapEntity.class));

        MapEntity inst = new MapEntity();
        inst.setId(11);
        inst.setIntEnumMap(new HashMap<Integer, SomeEnum>());
View Full Code Here

    }

    @Test
    public void flatCompEntity() throws Exception {

        MappedSchemaObject entity = persistenceManager.getEntity(FlatCompEntity.class);
        Assert.assertEquals(entity.getAttributeNames().size(), 2);
        createSchemaDo(Collections.<Class<?>>singletonList(FlatCompEntity.class));

        FlatCompEntity inst = new FlatCompEntity();
        inst.setId(11);
        FlatComposite flatComposite = new FlatComposite();
View Full Code Here

    }

    @Test
    public void reference() throws Exception {

        MappedSchemaObject otherSimple = persistenceManager.getEntity(RefBySimplePKEntity.class);
        MappedSchemaObject otherFull = persistenceManager.getEntity(RefByFullPKEntity.class);
        MappedSchemaObject entity = persistenceManager.getEntity(ReferenceEntity.class);
        createSchemaDo(Arrays.asList(RefBySimplePKEntity.class, RefByFullPKEntity.class, ReferenceEntity.class));

        Assert.assertEquals(entity.getAttributeNames().size(), 4);
        Assert.assertEquals(otherSimple.getAttributeNames().size(), 3);
        Assert.assertEquals(otherFull.getAttributeNames().size(), 7);
        Assert.assertEquals(entity.getAllColumns().length, 8);
        Assert.assertEquals(otherSimple.getAllColumns().length, 3);
        Assert.assertEquals(otherFull.getAllColumns().length, 7);

        PersistenceSession session = persistenceManager.createSession();
        try {
View Full Code Here

TOP

Related Classes of org.caffinitas.mapper.core.MappedSchemaObject

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.