Search in sources :

Example 26 with CeylonConfig

use of org.eclipse.ceylon.common.config.CeylonConfig in project ceylon by eclipse.

the class RepositoriesTest method setup.

@Before
public void setup() throws IOException {
    testConfig = CeylonConfigFinder.loadConfigFromFile(new File("test/src/org/eclipse/ceylon/common/test/repos.config"));
    if (FileUtil.getInstallDir() == null) {
        // Set a fake installation folder
        System.setProperty("ceylon.home", "fake-install-dir");
    }
    repos = Repositories.withConfig(testConfig);
    CeylonConfig fakeConfig = new CeylonConfig();
    defaultRepos = Repositories.withConfig(fakeConfig);
    CeylonConfig overriddenConfig = CeylonConfigFinder.loadConfigFromFile(new File("test/src/org/eclipse/ceylon/common/test/overridden.config"));
    overriddenRepos = Repositories.withConfig(overriddenConfig);
}
Also used : CeylonConfig(org.eclipse.ceylon.common.config.CeylonConfig) File(java.io.File) Before(org.junit.Before)

Example 27 with CeylonConfig

use of org.eclipse.ceylon.common.config.CeylonConfig in project ceylon by eclipse.

the class CeylonConfigTest method testRemoveOption.

@Test
public void testRemoveOption() {
    CeylonConfig tmpConfig = testConfig.copy();
    Assert.assertTrue(tmpConfig.isOptionDefined("test.string-hello"));
    tmpConfig.removeOption("test.string-hello");
    Assert.assertFalse(tmpConfig.isOptionDefined("test.string-hello"));
}
Also used : CeylonConfig(org.eclipse.ceylon.common.config.CeylonConfig) Test(org.junit.Test)

Example 28 with CeylonConfig

use of org.eclipse.ceylon.common.config.CeylonConfig in project ceylon by eclipse.

the class CeylonConfigTest method testSetOption.

@Test
public void testSetOption() {
    CeylonConfig tmpConfig = testConfig.copy();
    Assert.assertEquals("hello", tmpConfig.getOption("test.string-hello"));
    tmpConfig.setOption("test.string-hello", "world");
    Assert.assertEquals("world", tmpConfig.getOption("test.string-hello"));
    try {
        tmpConfig.setOption("hello", null);
        Assert.fail();
    } catch (IllegalArgumentException ex) {
    // Ok
    }
}
Also used : CeylonConfig(org.eclipse.ceylon.common.config.CeylonConfig) Test(org.junit.Test)

Aggregations

CeylonConfig (org.eclipse.ceylon.common.config.CeylonConfig)28 Test (org.junit.Test)16 File (java.io.File)12 Authentication (org.eclipse.ceylon.common.config.Authentication)7 Proxy (org.eclipse.ceylon.common.config.Proxies.Proxy)7 PasswordAuthentication (java.net.PasswordAuthentication)6 Proxies (org.eclipse.ceylon.common.config.Proxies)6 InetSocketAddress (java.net.InetSocketAddress)5 Repositories (org.eclipse.ceylon.common.config.Repositories)3 Repository (org.eclipse.ceylon.common.config.Repositories.Repository)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 BuildException (org.apache.tools.ant.BuildException)2 CeylonBaseTool (org.eclipse.ceylon.common.tool.CeylonBaseTool)2 Before (org.junit.Before)2 InputStream (java.io.InputStream)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 HashSet (java.util.HashSet)1