Package org.apache.cayenne.resource

Examples of org.apache.cayenne.resource.URLResource


        String testConfigName = "testConfig1";
        String baseUrl = getClass().getPackage().getName().replace('.', '/');
        URL url = getClass().getClassLoader().getResource(
                baseUrl + "/cayenne-" + testConfigName + ".xml");
        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));

        assertNotNull(tree);
        assertNotNull(tree.getRootNode());
        assertEquals(testConfigName, tree.getRootNode().getName());
    }
View Full Code Here


        // create and initialize loader instance to test
        XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
        injector.injectMembers(loader);

        try {
            loader.load(new URLResource(new URL("file:///no_such_resource")));
            fail("No exception was thrown on bad absent config name");
        }
        catch (ConfigurationException e) {
            // expected
        }
View Full Code Here

        String testConfigName = "testConfig2";
        String baseUrl = getClass().getPackage().getName().replace('.', '/');
        URL url = getClass().getClassLoader().getResource(
                baseUrl + "/cayenne-" + testConfigName + ".xml");

        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));

        assertNotNull(tree);
        assertNotNull(tree.getRootNode());

        assertEquals(testConfigName, tree.getRootNode().getName());
View Full Code Here

        String testConfigName = "testConfig3";
        String baseUrl = getClass().getPackage().getName().replace('.', '/');
        URL url = getClass().getClassLoader().getResource(
                baseUrl + "/cayenne-" + testConfigName + ".xml");

        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));

        assertNotNull(tree);

        DataChannelDescriptor descriptor = tree.getRootNode();
        assertNotNull(descriptor);
View Full Code Here

                        .getAbsolutePath(), targetFile.getAbsolutePath());
            }

            unit.targetTempFile = null;
            try {
                unit.node.acceptVisitor(new ConfigurationSourceSetter(new URLResource(
                        targetFile.toURL())));
            }
            catch (MalformedURLException e) {
                throw new CayenneRuntimeException(
                        "Malformed URL for file '%s'",
View Full Code Here

        File out = new File(outUrl.toURI());
        out.delete();
        assertFalse(out.isFile());

        DataMap map = new DataMap("testSaveLoaded1");
        map.setConfigurationSource(new URLResource(outUrl));

        action.saveLoaded(map, out);

        assertTrue(out.isFile());
View Full Code Here

            String dataMapName = name.substring(0, name.length() - DATA_MAP_LOCATION_SUFFIX.length());
            dataMap = new DataMap(dataMapName);
        }

        URL dataMapUrl = dataMapFile.toURI().toURL();
        dataMap.setConfigurationSource(new URLResource(dataMapUrl));

        // update map defaults

        // do not override default package of existing DataMap unless it is
        // explicitly requested by the plugin caller
View Full Code Here

        rootNode.getNodeDescriptors().addAll(Arrays.asList(nodes));

        Project project = new Project(new ConfigurationTree<DataChannelDescriptor>(
                rootNode));

        saver.saveAs(project, new URLResource(testFolder.toURL()));

        File target = new File(testFolder, "cayenne-test.xml");
        assertTrue(target.isFile());
        assertSaveAs_Sorted(target);
    }
View Full Code Here

        File testFolder = setupTestDirectory("testSaveForProjectFileWithRelatedPaths");

        String mapFilePath = testFolder.toURI() + "../test.map.xml";
        String mapFileName = "test";
        DataMap testDataMap = new DataMap(mapFileName);
        testDataMap.setConfigurationSource(new URLResource(new URL(mapFilePath)));
        Project project = new Project(new ConfigurationTree<DataMap>(testDataMap));

        saver.save(project);

        File target = new File(testFolder.getParentFile(), mapFileName + ".map.xml");
View Full Code Here

    DataMapLoader loader = runtime.getInjector().getInstance(
        DataMapLoader.class);
    URL url = getClass().getClassLoader().getResource(
        "inheritance-vertical.map.xml");
    DataMap dataMap = loader.load(new URLResource(url));
    EntityResolver resolver = new EntityResolver(
        Collections.singleton(dataMap));

    ObjEntity iv2Sub1 = resolver.getObjEntity(Iv2Sub1.class);
    ObjRelationship x = (ObjRelationship) iv2Sub1
View Full Code Here

TOP

Related Classes of org.apache.cayenne.resource.URLResource

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.