Commits

Anonymous committed e55a332

Add tests to setup method in these 2 unit tests to test for existence of the OpenSP utilitites at the path where the test-config.xml file says they exist.

  • Participants
  • Parent commits 9fbcffc

Comments (0)

Files changed (2)

File src/test/java/org/jhove2/module/format/sgml/OpenSpWrapperTest.java

 		}
 		catalogPath = sgmlDirPath.concat(catalogFile);
 		File cFile = new File (catalogPath);
+		if (!cFile.exists()){
+			fail("Path to catalog file " + catalogPath + " does not exist");
+		}
 		catalogPath = cFile.getAbsolutePath();
 		if (sp.filepathFilter != null){
 			catalogPath = sp.filepathFilter.filter(catalogPath);
 		}
 		sp.getOnsgmlsOptions().setCatalogPath(catalogPath);
 		sp.getSgmlnormOptions().setCatalogPath(catalogPath);
-
+		String commandPath = sp.getOnsgmlsPath();
+		File commandPathFile = null;
+		try {
+			commandPathFile = new File(commandPath);
+			if (!(commandPathFile.exists())){
+				fail("Configured path to ongsmls utility " + commandPath + " does not exist");
+			}
+		}
+		catch (NullPointerException e){
+			fail("no path to onsgmls utility configured");
+		}
+		commandPath = sp.getSgmlnormPath();
+		try {
+			commandPathFile = new File(commandPath);
+			if (!(commandPathFile.exists())){
+				fail("Configured path to sgmlNorm utility " + commandPath + " does not exist");
+			}
+		}
+		catch (NullPointerException e){
+			fail("no path to sgmlNorm utility configured");
+		}
 	}
 
 	/**

File src/test/java/org/jhove2/module/format/sgml/OpenSpWrapperWindowsExeTest.java

 		}
 		catalogPath = sgmlDirPath.concat(catalogFile);
 		File cFile = new File (catalogPath);
+		if (!cFile.exists()){
+			fail("Path to catalog file " + catalogPath + " does not exist");
+		}
 		catalogPath = cFile.getAbsolutePath();
 		if (sp.filepathFilter != null){
 			catalogPath = sp.filepathFilter.filter(catalogPath);
 		}
 		sp.getOnsgmlsOptions().setCatalogPath(catalogPath);
 		sp.getSgmlnormOptions().setCatalogPath(catalogPath);
+		String commandPath = sp.getOnsgmlsPath();
+		File commandPathFile = null;
+		try {
+			commandPathFile = new File(commandPath);
+			if (!(commandPathFile.exists())){
+				fail("Configured path to ongsmls utility " + commandPath + " does not exist");
+			}
+		}
+		catch (NullPointerException e){
+			fail("no path to onsgmls utility configured");
+		}
+		commandPath = sp.getSgmlnormPath();
+		try {
+			commandPathFile = new File(commandPath);
+			if (!(commandPathFile.exists())){
+				fail("Configured path to sgmlNorm utility " + commandPath + " does not exist");
+			}
+		}
+		catch (NullPointerException e){
+			fail("no path to onsgmls utility configured");
+		}
 	}
 
 	/**