Examples of DataMap


Examples of org.apache.cayenne.map.DataMap

    }

    public void testLoadWithMeaningfulPK() throws Exception {
        try {

            DataMap map = new DataMap();
            String tableLabel = getNode().getAdapter().tableTypeForTable();

            loader.setCreatingMeaningfulPK(true);
           
            List<DbEntity> testLoader = loader.getTables(
                    null,
                    null,
                    "artist",
                    new String[] {
                        tableLabel
                    });
            if(testLoader.size()==0){
                testLoader = loader.getTables(
                        null,
                        null,
                        "ARTIST",
                        new String[] {
                            tableLabel
                        });
            }
           
            loader.loadDbEntities(map, testLoader);

            loader.loadObjEntities(map);
            ObjEntity artist = map.getObjEntity("Artist");
            assertNotNull(artist);
            ObjAttribute id = (ObjAttribute) artist.getAttribute("artistId");
            assertNotNull(id);
        }
        finally {
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        try {
            boolean supportsUnique = getNode().getAdapter().supportsUniqueConstraints();
            boolean supportsLobs = getAccessStackAdapter().supportsLobs();
            boolean supportsFK = getAccessStackAdapter().supportsFKConstraints();

            DataMap map = new DataMap();
            String tableLabel = getNode().getAdapter().tableTypeForTable();

            // *** TESTING THIS ***
            loader.loadDbEntities(map, loader.getTables(null, null, "%", new String[] {
                tableLabel
            }));

            assertDbEntities(map);

            if (supportsLobs) {
                assertLobDbEntities(map);
            }

            // *** TESTING THIS ***
            loader.loadDbRelationships(map);

            if (supportsFK) {
                Collection rels = getDbEntity(map, "ARTIST").getRelationships();
                assertNotNull(rels);
                assertTrue(rels.size() > 0);

                // test one-to-one
                rels = getDbEntity(map, "PAINTING").getRelationships();
                assertNotNull(rels);

                // find relationship to PAINTING_INFO
                DbRelationship oneToOne = null;
                Iterator it = rels.iterator();
                while (it.hasNext()) {
                    DbRelationship rel = (DbRelationship) it.next();
                    if ("PAINTING_INFO".equalsIgnoreCase(rel.getTargetEntityName())) {
                        oneToOne = rel;
                        break;
                    }
                }

                assertNotNull("No relationship to PAINTING_INFO", oneToOne);
                assertFalse("Relationship to PAINTING_INFO must be to-one", oneToOne
                        .isToMany());
                assertTrue("Relationship to PAINTING_INFO must be to-one", oneToOne
                        .isToDependentPK());

                // test UNIQUE only if FK is supported...
                if (supportsUnique) {
                    assertUniqueConstraintsInRelationships(map);
                }
            }

            // *** TESTING THIS ***
            loader.setCreatingMeaningfulPK(false);
            loader.loadObjEntities(map);

            ObjEntity ae = map.getObjEntity("Artist");
            assertNotNull(ae);
            assertEquals("Artist", ae.getName());
            // assert primary key is not an attribute
            assertNull(ae.getAttribute("artistId"));
            if (supportsLobs) {
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        CayenneContext context = new CayenneContext(channel);
        ObjEntity entity = new ObjEntity("test_entity");
        entity.setClassName(MockPersistentObject.class.getName());

        DataMap dataMap = new DataMap("test");
        dataMap.addObjEntity(entity);
        Collection<DataMap> entities = Collections.singleton(dataMap);
        context.setEntityResolver(new EntityResolver(entities));
        Persistent object = context.newObject(MockPersistentObject.class);

        // record change here to make it available to the anonymous connector method..
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        CayenneContext context = new CayenneContext(new MockDataChannel());

        ObjEntity entity = new ObjEntity("test_entity");
        entity.setClassName(MockPersistentObject.class.getName());

        DataMap dataMap = new DataMap("test");
        dataMap.addObjEntity(entity);
        Collection<DataMap> entities = Collections.singleton(dataMap);
        context.setEntityResolver(new EntityResolver(entities));

        Persistent object = context.newObject(MockPersistentObject.class);
        assertNotNull(object);
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        CayenneContext context = new CayenneContext(new MockDataChannel());
        ObjEntity entity = new ObjEntity("test_entity");
        entity.setClassName(MockPersistentObject.class.getName());

        DataMap dataMap = new DataMap("test");
        dataMap.addObjEntity(entity);
        Collection<DataMap> entities = Collections.singleton(dataMap);
        context.setEntityResolver(new EntityResolver(entities));

        // TRANSIENT ... should quietly ignore it
        Persistent transientObject = new MockPersistentObject();
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        ServletUtil.initializeSharedConfiguration(servletContext);

        try {
            DataDomain cayenneDomain =
                Configuration.getSharedConfiguration().getDomain();
            DataMap dataMap = cayenneDomain.getMap("cayenneMap");
            DataNode dataNode = cayenneDomain.getNode("cayenneNode");

            initDatabaseSchema(dataNode, dataMap);

            loadDatabase();
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

     */
    public void testPartialLoad() throws Exception {

        try {

            DataMap map = new DataMap();
            String tableLabel = getNode().getAdapter().tableTypeForTable();

            loader.loadDataMapFromDB(null, "%", new String[] {
                tableLabel
            }, map);
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

                continue;
            }

            // skip FK to a different DB
            if (domain != null) {
                DataMap srcMap = rel.getSourceEntity().getDataMap();
                DataMap targetMap = rel.getTargetEntity().getDataMap();

                if (srcMap != null && targetMap != null && srcMap != targetMap) {
                    if (domain.lookupDataNode(srcMap) != domain.lookupDataNode(targetMap)) {
                        continue;
                    }
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

     * include it.
     *
     * @since 3.1
     */
    public synchronized void removeDataMap(String mapName) {
        DataMap map = getDataMap(mapName);
        if (map == null) {
            return;
        }

        // remove from data nodes
View Full Code Here

Examples of org.apache.cayenne.map.DataMap

        // create dependencies
        final String testConfigName = "testConfig";
        final DataChannelDescriptor testDescriptor = new DataChannelDescriptor();

        DataMap map1 = new DataMap("map1");
        testDescriptor.getDataMaps().add(map1);

        DataMap map2 = new DataMap("map2");
        testDescriptor.getDataMaps().add(map2);

        DataNodeDescriptor nodeDescriptor1 = new DataNodeDescriptor();
        nodeDescriptor1.setName("node1");
        nodeDescriptor1.getDataMapNames().add("map1");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.