/** * Parse the an xml file * @param is the inputsource to parse * @param handler the SAX event handler to use * @throws SAXException if an error occurs during parsing * @throws IOException if an error occurs reading from the InputSource * @throws ParserConfigurationException if there is an error in the config */ public static void parse(InputSource is, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException { parse(is, handler, true); }
/** * {@inheritDoc} */ public void invalidateObjectById(Integer id) { synchronized (cache) { cache.remove(id); } }
/** * {@inheritDoc} */ public Object cacheObjectById(Integer id, InterMineObject obj) { synchronized (cache) { cache.put(id, obj); } return obj; }
public void testInstantiateObject() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Manager); assertTrue(obj instanceof Broke); }
public void testCreateObjectNothing() throws Exception { try { Object obj = DynamicUtil.createObject(Collections.EMPTY_SET); fail("Expected: IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
public void testStripStartNullProperties() throws Exception { try { PropertiesUtil.stripStart("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
public void test1() throws Exception { String hashed = PasswordHasher.hashPassword("flibble"); assertTrue(PasswordHasher.checkPassword("flibble", hashed)); assertFalse(PasswordHasher.checkPassword("flibble", "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")); assertTrue(PasswordHasher.checkPassword("flibble", "flibble")); assertFalse(PasswordHasher.checkPassword("flibble", hashed + " ")); assertFalse(PasswordHasher.checkPassword("flibble", "flobble")); } }
public void testStartingWithNullProperties() throws Exception { try { PropertiesUtil.getPropertiesStartingWith("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
public void testFinishFinished() throws Exception { op = new ObjectPipe(); op.finish(); try { op.finish(); fail("Expected: IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
public void testCreateObjectNoClassTwoInterfaces() { Object obj = DynamicBean.create(null, new Class[] { Employable.class, ImportantPerson.class }); assertTrue(obj instanceof Employable); assertTrue(obj instanceof ImportantPerson); }
/** * Create a 'simple object' which doesn't inherit from InterMineObject and doesn't have an id. * @param c the class of object to create * @param <C> the type of the class * @return an empty simple object of the given class */ public <C extends FastPathObject> C createSimpleObject(Class<C> c) { C o = DynamicUtil.simpleCreateObject(c); return o; }
public void testFixEntityNames() throws Exception { assertEquals("foo γ bar β zz", XmlUtil.fixEntityNames("foo &ggr; bar &bgr; zz")); } }
/** * @see Thread#run */ @Override public void run() { shutdown(); } }
public void testMaxBufferTooSmall() throws Exception { try { op = new ObjectPipe(0); fail("Expected: IllegalArgumentException"); } catch (IllegalArgumentException e) { } } }
public void testInstantiateObjectNullClassName() throws Exception { Object obj = DynamicUtil.instantiateObject(null, "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Broke); }
public void testCreateObjectClassTwoInterfaces() { Object obj = DynamicBean.create(Department.class, new Class[] { Employable.class, ImportantPerson.class }); assertTrue(obj instanceof Department); assertTrue(obj instanceof Employable); assertTrue(obj instanceof ImportantPerson); } }
public void testInstantiateObjectEmptyClassName() throws Exception { Object obj = DynamicUtil.instantiateObject("", "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Broke); }
public void testInstantiateObjectNullImplementations() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", null); assertTrue(obj instanceof Manager); }
public void testInstantiateObjectEmptyImplementations() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", ""); assertTrue(obj instanceof Manager); }