@Test(expectedExceptions = {IOException.class})
  public void testUnknownFile() throws IOException {

    File tmpF = null;
    try {
      tmpF = File.createTempFile("out", "out");
    } catch (IOException e) {
      Assert.fail(e.getMessage(), e);
    }
    String name = tmpF.getAbsolutePath();
    Assert.assertTrue(tmpF.delete());
    try {
      Configuration r = PlainTextConfigurationSerializer.getInstance().read(name);
    } catch (ConfigurationSerializerException e) {
      Assert.fail(e.getMessage(), e);
    }
  }
 /** Test serialization/unserialization */
 public void test() {
   Configuration cfg = new SimpleConfiguration();
   for (int i = 1; i <= 10; i++) {
     Node n = new SimpleNode("N" + i, i, i + 1, i + 2);
     if (i % 3 == 0) {
       cfg.addOffline(n);
     } else {
       cfg.addOnline(n);
     }
   }
   Random rnd = new Random();
   for (int i = 1; i <= 20; i++) {
     VirtualMachine vm = new SimpleVirtualMachine("VM" + i, i, i + 1, i + 2);
     vm.setCPUDemand(i + 3);
     vm.setCPUMax(i + 7);
     Node n = cfg.getOnlines().get(rnd.nextInt(cfg.getOnlines().size()));
     if (i % 3 == 0) {
       cfg.setSleepOn(vm, n);
     } else if (i % 5 == 0) {
       cfg.addWaiting(vm);
     } else {
       cfg.setRunOn(vm, n);
     }
   }
   FileConfigurationSerializer s = PlainTextConfigurationSerializer.getInstance();
   File tmpF;
   try {
     tmpF = File.createTempFile("out", "out");
     tmpF.deleteOnExit();
     s.write(cfg, tmpF.getAbsolutePath());
     Configuration r = s.read(tmpF.getAbsolutePath());
     Assert.assertEquals(r, cfg);
   } catch (IOException e) {
     Assert.fail(e.getMessage(), e);
   } catch (ConfigurationSerializerException e) {
     Assert.fail(e.getMessage(), e);
   }
 }