Permalink
Browse files

Removing obsolete test

  • Loading branch information...
1 parent 6e9a505 commit d74d3952419bb349214e77e6c5c05f66fb538739 @phooky phooky committed Sep 13, 2010
@@ -1,121 +0,0 @@
-package testing.fabman;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.Vector;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import fabman.coordinator.FabCoordinator;
-import fabman.messages.Coordinator;
-import fabman.messages.Coordinator.GetFabRequest;
-import fabman.messages.Coordinator.GetFabResponse;
-import fabman.messages.Coordinator.Request;
-import fabman.messages.Coordinator.Response;
-import fabman.messages.Coordinator.Type;
-import fabman.messages.Coordinator.GetFabResponse.RspCode;
-
-public class FabCoordinatorTest {
-
- FabCoordinator coordinator = null;
- static final int TESTING_PORT = 5115;
-
- @BeforeClass
- public void createCoordinator() throws IOException {
- assert coordinator == null;
- try {
- Vector<File> paths = new Vector<File>();
- String descriptorPath = System.getenv("TEST_DESCRIPTORS");
- assert descriptorPath != null : "TEST_DESCRIPTORS environment variable is unset; needed for test";
- paths.add(new File(descriptorPath));
- coordinator = new FabCoordinator(TESTING_PORT,paths);
- new Thread(coordinator).start();
- } catch (java.net.BindException be) {
- assert false : "Problem binding test port; ensure that no other test is running";
- }
- }
-
- @AfterClass
- public void shutdownCoordinator() throws IOException {
- assert coordinator != null;
- coordinator.shutdown();
- }
-
- @Test
- public void createDuplicate() throws IOException {
- try {
- new FabCoordinator(TESTING_PORT);
- } catch (java.net.BindException be) {
- // Success; the already-running server should have the port.
- return;
- }
- assert false : "Multiple coordinators were permitted to start";
- }
-
- // Get a socket to the fab coordinator
- Socket getConnection() throws IOException {
- Socket socket = new Socket(InetAddress.getLocalHost(), TESTING_PORT);
- return socket;
- }
-
- @Test
- public void requestNonsenseFab() throws IOException {
- Socket socket = getConnection();
- GetFabRequest.Builder gfr = GetFabRequest.newBuilder();
- Request.Builder req = Request.newBuilder();
- gfr.setName("NON-EXTANT FABRICATOR");
- req.setType(Type.GET_FAB);
- req.setGetFabReq(gfr.build());
- req.build().writeDelimitedTo(socket.getOutputStream());
- // Get response
- Response rsp = Response.parseDelimitedFrom(socket.getInputStream());
- assert rsp != null;
- assert rsp.getType() == Type.GET_FAB;
- GetFabResponse fabRsp = rsp.getGetFabRsp();
- assert fabRsp != null;
- assert fabRsp.getCode() == RspCode.BAD_DESCRIPTOR;
- socket.close();
- }
-
- @Test
- public void requestFabList() throws IOException {
- Socket socket = getConnection();
- Coordinator.ListFabsRequest.Builder gfr = Coordinator.ListFabsRequest.newBuilder();
- Coordinator.Request.Builder req = Coordinator.Request.newBuilder();
- req.setType(Type.LIST_FABS);
- req.setListFabsReq(gfr.build());
- req.build().writeDelimitedTo(socket.getOutputStream());
- // Get response
- Coordinator.Response rsp = Coordinator.Response.parseDelimitedFrom(socket.getInputStream());
- assert rsp != null;
- assert rsp.getType() == Type.LIST_FABS;
- Coordinator.ListFabsResponse fabRsp = rsp.getListFabsRsp();
- assert fabRsp != null;
- assert fabRsp.getFabsCount() == 5 : "Expected fab count 5, got "+Integer.toString(fabRsp.getFabsCount());
- socket.close();
- }
-
- @Test
- public void getTestFab() throws IOException {
- Socket socket = getConnection();
- GetFabRequest.Builder gfr = GetFabRequest.newBuilder();
- Request.Builder req = Request.newBuilder();
- gfr.setName("No Driver Test");
- req.setType(Type.GET_FAB);
- req.setGetFabReq(gfr.build());
- req.build().writeDelimitedTo(socket.getOutputStream());
- // Get response
- Response rsp = Response.parseDelimitedFrom(socket.getInputStream());
- assert rsp != null;
- assert rsp.getType() == Type.GET_FAB;
- GetFabResponse fabRsp = rsp.getGetFabRsp();
- assert fabRsp != null;
- assert fabRsp.getCode() == RspCode.ERROR;
- System.err.println("No driver error message: "+fabRsp.getErrorMessage());
- socket.close();
- }
-}
@@ -1,66 +0,0 @@
-package testing.fabman;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Vector;
-
-import javax.media.j3d.BoundingBox;
-import javax.vecmath.Point3d;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import fabman.manager.FabDescriptor;
-import fabman.manager.FabManager;
-
-public class FabDescriptorTest {
- FabManager mgr;
-
- @BeforeClass
- public void setUp() {
- Vector<File> paths = new Vector<File>();
- String descriptorPath = System.getenv("TEST_DESCRIPTORS");
- assert descriptorPath != null : "TEST_DESCRIPTORS environment variable is unset; needed for test";
- paths.add(new File(descriptorPath));
- mgr = FabManager.getFabManager(paths);
- assert mgr != null : "Could not create a custom fab manager";
- }
-
- @Test
- public void checkDescriptors() {
- // Check that the number of descriptors is valid for this test.
- Collection<FabDescriptor> descriptors = mgr.getAvailableDescriptors();
- assert descriptors.size() == 5 : "Incorrect number of descriptors loaded";
- }
-
- private FabDescriptor getDescriptor(String name) {
- Collection<FabDescriptor> descriptors = mgr.getAvailableDescriptors();
- for (FabDescriptor test : descriptors) {
- if (test.getName().equals(name)) {
- return test;
- }
- }
- return null;
- }
-
- static final String TST_NAME = "Testing Machine";
-
- @Test(dependsOnMethods = {"checkDescriptors"})
- public void getTestDescriptor() {
- FabDescriptor testMachine = getDescriptor(TST_NAME);
- assert testMachine != null;
- }
-
- @Test(dependsOnMethods = {"getTestDescriptor"})
- public void checkBoundsLoading() {
- FabDescriptor descriptor = getDescriptor(TST_NAME);
- BoundingBox envelope = descriptor.getBuildEnvelope();
- assert envelope != null;
- BoundingBox expectedBounds = new BoundingBox(new Point3d(-50,-50,0), new Point3d(50,50,120));
- assert envelope.equals(expectedBounds);
- }
-
- @Test
- public void openTestConnection() {
- }
-}
@@ -1,39 +0,0 @@
-package testing.fabman;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-
-import fabman.queue.FabServer;
-
-public class FabServerTest {
-
- static final String xmlStub = "<?xml version=\"1.1\" encoding=\"utf-8\"?><machines></machines>";
-
- @Test
- public void createTestServer() throws URISyntaxException, IOException, SAXException, ParserConfigurationException {
- FabServer server = new FabServer(xmlStub);
- URI serverUri = server.getServerURI();
- assert serverUri != null;
- assert "localhost".equals(serverUri.getHost());
- assert serverUri.getPort() > 0;
- assert "fab".equals(serverUri.getScheme());
- }
-
- @Test
- public void createTestServerProcess() throws IOException, URISyntaxException {
-
- FabServer.ServerInfo info = FabServer.startServer(xmlStub);
- URI serverUri = info.socketUri;
- assert serverUri != null;
- assert "localhost".equals(serverUri.getHost());
- assert serverUri.getPort() > 0;
- assert "fab".equals(serverUri.getScheme());
- info.process.destroy();
- }
-}
@@ -1,26 +0,0 @@
-package testing.fabman;
-
-import java.io.File;
-import java.util.Vector;
-
-import org.testng.annotations.Test;
-
-import fabman.manager.FabManager;
-
-public class ManagerFactoryTest {
- @Test
- public void createDefaultManager() {
- FabManager mgr = FabManager.getFabManager();
- assert mgr != null : "Could not create a default fab manager";
- }
-
- @Test
- public void createTestManager() {
- Vector<File> paths = new Vector<File>();
- String descriptorPath = System.getenv("TEST_DESCRIPTORS");
- assert descriptorPath != null : "TEST_DESCRIPTORS environment variable is unset; needed for test";
- paths.add(new File(descriptorPath));
- FabManager mgr = FabManager.getFabManager(paths);
- assert mgr != null : "Could not create a custom fab manager";
- }
-}

0 comments on commit d74d395

Please sign in to comment.