Package org.apache.ivy.core.settings

Examples of org.apache.ivy.core.settings.IvySettings


    private TestFixture fixture;

    protected void setUp() throws Exception {
        fixture = new TestFixture();
        IvySettings settings = fixture.getSettings();
        repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
                new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
    }
View Full Code Here


    protected void tearDown() throws Exception {
        FileUtil.forceDelete(new File("build/test/publish"));
    }

    public void testAtomicity() throws Exception {
        IvySettings settings = new IvySettings();
        final PublishEngine engine = new PublishEngine(settings, new EventManager());
        final int[] counter = new int[] {0};

        final DefaultModuleDescriptor md = DefaultModuleDescriptor
                .newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
View Full Code Here

    protected void setUp() throws Exception {
        File f = File.createTempFile("ivycache", ".dir");
        Ivy ivy = new Ivy();
        ivy.configureDefault();
        IvySettings settings = ivy.getSettings();
        f.delete(); // we want to use the file as a directory, so we delete the file itself
        cacheManager = new DefaultRepositoryCacheManager();
        cacheManager.setSettings(settings);
        cacheManager.setBasedir(f);
View Full Code Here

        this.merge = merge;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        organisation = getProperty(organisation, settings, "ivy.organisation");
        module = getProperty(module, settings, "ivy.module");
        revision = getProperty(revision, settings, "ivy.revision");
        pubBranch = getProperty(pubBranch, settings, "ivy.deliver.branch");
View Full Code Here

        };
        task.setProject(p);

        Ivy ivy = task.getIvyInstance();
        assertNotNull(ivy);
        IvySettings settings = ivy.getSettings();
        assertNotNull(settings);

        assertEquals(new File("test/repositories/build/cache").getAbsoluteFile(),
            settings.getDefaultCache());
        // The next test doesn't always works on windows (mix C: and c: drive)
        assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(),
            new File(settings.getVariables().getVariable("ivy.settings.file")).getAbsolutePath()
                    .toUpperCase());
        assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm()
                .toUpperCase(), settings.getVariables().getVariable("ivy.settings.url")
                .toUpperCase());
        assertEquals(new File("test/repositories").getAbsolutePath().toUpperCase(), settings
                .getVariables().getVariable("ivy.settings.dir").toUpperCase());
        assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
    }
View Full Code Here

        };
        task.setProject(p);
        task.setSettingsRef(new Reference("mySettings"));
        Ivy ivy = task.getIvyInstance();
        assertNotNull(ivy);
        IvySettings settings = ivy.getSettings();
        assertNotNull(settings);

        assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
        assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
                .getVariables().getVariable("ivy.settings.file"));
        assertEquals(
            new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
            settings.getVariables().getVariable("ivy.settings.url"));
        assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables()
                .getVariable("ivy.settings.dir"));
        assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
    }
View Full Code Here

    private ResolveData data;

    private File cache;

    protected void setUp() throws Exception {
        settings = new IvySettings();
        engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
        cache = new File("build/cache");
        data = new ResolveData(engine, new ResolveOptions());
        cache.mkdirs();
        settings.setDefaultCache(cache);
View Full Code Here

        // by default settings look in the current directory for an ivysettings.xml file...
        // but Ivy itself has one, and we don't want to use it
        configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
        configure.execute();

        IvySettings settings = getIvyInstance().getSettings();
        assertNotNull(settings.getDefaultResolver());

        DependencyResolver publicResolver = settings.getResolver("public");
        assertNotNull(publicResolver);
        assertTrue(publicResolver instanceof IBiblioResolver);
        IBiblioResolver ibiblio = (IBiblioResolver) publicResolver;
        assertTrue(ibiblio.isM2compatible());
    }
View Full Code Here

        // but Ivy itself has one, and we don't want to use it
        configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
        configure.getProject().setProperty("ivy.14.compatible", "true");
        configure.execute();

        IvySettings settings = getIvyInstance().getSettings();
        assertNotNull(settings.getDefaultResolver());

        DependencyResolver publicResolver = settings.getResolver("public");
        assertTrue(publicResolver instanceof IvyRepResolver);
    }
View Full Code Here

        value = aValue;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();
        if (getName() != null) {
            settings.setVariable(getVarName(getName()), getValue());
        } else {
            Properties props = new Properties();
            InputStream is = null;
            try {
                if (getFile() != null) {
                    is = new FileInputStream(getFile());
                } else if (getUrl() != null) {
                    is = new URL(getUrl()).openStream();
                } else {
                    throw new BuildException("specify either name or file or url to ivy var task");
                }
                props.load(is);
            } catch (Exception ex) {
                throw new BuildException("impossible to load variables from file: " + ex, ex);
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (Exception e) {
                        // ignore
                    }
                }
            }
            for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
                String name = (String) iter.next();
                String value = (String) props.get(name);
                settings.setVariable(getVarName(name), value);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.settings.IvySettings

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.