use of cern.laser.definition.LaserDefinitionException in project ACS by ACS-Community.
the class CategoryDefinitionHandlerImplTest method testUploadReader.
//
// -- TEST METHODS --------------------------------------------------
//
/*
* Class to test for void upload(Reader)
*/
public void testUploadReader() {
InputStream is = getClass().getResourceAsStream("create-category-definitions.xml");
InputStreamReader reader = new InputStreamReader(new BufferedInputStream(is));
try {
handler.upload(reader);
} catch (LaserDefinitionException e) {
fail(e.getMessage());
}
try {
assertNotNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS"));
} catch (LaserException e1) {
fail(e1.getMessage());
}
try {
assertNotNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST1"));
} catch (LaserException e2) {
fail(e2.getMessage());
}
try {
assertNotNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST2"));
} catch (LaserException e3) {
fail(e3.getMessage());
}
try {
assertNotNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST3"));
} catch (LaserException e4) {
fail(e4.getMessage());
}
is = getClass().getResourceAsStream("remove-category-definitions.xml");
reader = new InputStreamReader(new BufferedInputStream(is));
try {
handler.upload(reader);
} catch (LaserDefinitionException e5) {
fail(e5.getMessage());
}
try {
assertNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS"));
} catch (LaserException e6) {
}
try {
assertNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST1"));
} catch (LaserException e7) {
}
try {
assertNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST2"));
} catch (LaserException e8) {
}
try {
assertNull(categoryBrowsing.getCategoryByPath("CERN.DEFUNITTESTS.DEFUNITTEST3"));
} catch (LaserException e9) {
}
}
Aggregations