Search in sources :

Example 26 with TestDir

use of org.apache.hadoop.test.TestDir in project hadoop by apache.

the class TestServer method serviceNotImplementingServiceInterface.

@Test
@TestException(exception = ServerException.class, msgRegExp = "S04.*")
@TestDir
public void serviceNotImplementingServiceInterface() throws Exception {
    String dir = TestDirHelper.getTestDir().getAbsolutePath();
    Configuration conf = new Configuration(false);
    conf.set("server.services", MyService4.class.getName());
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TestException(org.apache.hadoop.test.TestException) TestDir(org.apache.hadoop.test.TestDir) Test(org.junit.Test)

Example 27 with TestDir

use of org.apache.hadoop.test.TestDir in project hadoop by apache.

the class TestServer method changeStatusServiceException.

@Test
@TestException(exception = ServerException.class, msgRegExp = "S11.*")
@TestDir
public void changeStatusServiceException() throws Exception {
    TestService.LIFECYCLE.clear();
    Configuration conf = new Configuration(false);
    conf.set("server.services", TestServiceExceptionOnStatusChange.class.getName());
    Server server = createServer(conf);
    server.init();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TestException(org.apache.hadoop.test.TestException) TestDir(org.apache.hadoop.test.TestDir) Test(org.junit.Test)

Example 28 with TestDir

use of org.apache.hadoop.test.TestDir in project hadoop by apache.

the class TestServer method illegalState2.

@Test(expected = IllegalStateException.class)
@TestDir
public void illegalState2() throws Exception {
    Server server = new Server("server", TestDirHelper.getTestDir().getAbsolutePath(), new Configuration(false));
    server.get(Object.class);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TestDir(org.apache.hadoop.test.TestDir) Test(org.junit.Test)

Example 29 with TestDir

use of org.apache.hadoop.test.TestDir in project hadoop by apache.

the class TestServer method illegalState1.

@Test(expected = IllegalStateException.class)
@TestDir
public void illegalState1() throws Exception {
    Server server = new Server("server", TestDirHelper.getTestDir().getAbsolutePath(), new Configuration(false));
    server.destroy();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TestDir(org.apache.hadoop.test.TestDir) Test(org.junit.Test)

Example 30 with TestDir

use of org.apache.hadoop.test.TestDir in project hadoop by apache.

the class TestServer method siteFileNotAFile.

@Test
@TestException(exception = ServerException.class, msgRegExp = "S05.*")
@TestDir
public void siteFileNotAFile() throws Exception {
    String homeDir = TestDirHelper.getTestDir().getAbsolutePath();
    File siteFile = new File(homeDir, "server-site.xml");
    assertTrue(siteFile.mkdir());
    Server server = new Server("server", homeDir, homeDir, homeDir, homeDir);
    server.init();
}
Also used : File(java.io.File) TestException(org.apache.hadoop.test.TestException) TestDir(org.apache.hadoop.test.TestDir) Test(org.junit.Test)

Aggregations

TestDir (org.apache.hadoop.test.TestDir)67 Test (org.junit.Test)67 Configuration (org.apache.hadoop.conf.Configuration)46 TestException (org.apache.hadoop.test.TestException)25 TestHdfs (org.apache.hadoop.test.TestHdfs)21 Server (org.apache.hadoop.lib.server.Server)19 TestJetty (org.apache.hadoop.test.TestJetty)18 FileSystem (org.apache.hadoop.fs.FileSystem)14 File (java.io.File)13 Path (org.apache.hadoop.fs.Path)13 FileOutputStream (java.io.FileOutputStream)10 FileSystemAccess (org.apache.hadoop.lib.service.FileSystemAccess)10 HttpURLConnection (java.net.HttpURLConnection)9 URL (java.net.URL)9 AuthenticatedURL (org.apache.hadoop.security.authentication.client.AuthenticatedURL)9 IOException (java.io.IOException)6 OutputStream (java.io.OutputStream)6 InputStreamReader (java.io.InputStreamReader)5 ServiceException (org.apache.hadoop.lib.server.ServiceException)4 FileSystemAccessException (org.apache.hadoop.lib.service.FileSystemAccessException)4