Package org.dayatang.configuration.impl

Source Code of org.dayatang.configuration.impl.ConfigurationUrlImplTest

package org.dayatang.configuration.impl;

import org.dayatang.configuration.EmbeddedHttpServer;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertTrue;

public class ConfigurationUrlImplTest extends AbstractConfigurationTest {

    private static EmbeddedHttpServer httpServer;

    @BeforeClass
    public static void classSetUp() throws Exception {
        String pathname = ConfigurationUrlImplTest.class.getResource("/conf.properties").getFile();
        final File file = new File(pathname);
        httpServer = new EmbeddedHttpServer(1528);
        httpServer.mapping("/", file);
        httpServer.start();
    }

    @AfterClass
    public static void classTearDown() {
        httpServer.shutdown();
    }

  @Before
  public void setUp() throws Exception {
        instance = ConfigurationUrlImpl.fromUrl("http://localhost:1528/");
    }

  @Test
  public void testUsePrefix() {
    ((ConfigurationUrlImpl)instance).usePrefix("org.dayatang");
    assertTrue(instance.getBoolean("finished"));
  }

}
TOP

Related Classes of org.dayatang.configuration.impl.ConfigurationUrlImplTest

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.