@Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { callCount++; if (throwException) { throwException = false; throw new JDOException(); } throwException = true; }
@Test public void testWrappedMetaExceptionRetry() throws MetaException { IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class); Mockito.when(mockBaseHandler.getConf()).thenReturn(conf); //JDOException wrapped in MetaException wrapped in InvocationException MetaException me = new MetaException("Dummy exception"); me.initCause(new JDOException()); InvocationTargetException ex = new InvocationTargetException(me); Mockito .doThrow(me) .doNothing() .when(mockBaseHandler).init(); RetryingHMSHandler.getProxy(conf, mockBaseHandler, false); Mockito.verify(mockBaseHandler, Mockito.times(2)).init(); } }
/** * * @param conn_factory Connection factory */ public void setConnectionFactory(Object conn_factory) { throw new JDOException("Not available in managed environment"); }
/** * * @param conn_factory_name Connection factory name */ public void setConnectionFactory2Name(String conn_factory_name) { throw new JDOException("Not available in managed environment"); }
/** * * @return Connection factory name */ public String getConnectionFactory2Name() { throw new JDOException("Not available in managed environment"); }
/** * * @return <description> */ public Properties getProperties() { throw new JDOException("Not available in managed environment"); }
/** * Accessor for the username * * @return Username */ public String getConnectionUserName() { throw new JDOException("Not available in managed environment"); }
/** * * @param drivername Driver name */ public void setConnectionDriverName(String drivername) { throw new JDOException("Not available in managed environment"); }
/** * * @return The connection driver name */ public String getConnectionDriverName() { throw new JDOException("Not available in managed environment"); }
/** * * @return Connection Factory name */ public String getConnectionFactoryName() { throw new JDOException("Not available in managed environment"); }
/** * Mutator for the Username * * @param username Username */ public void setConnectionUserName(String username) { throw new JDOException("Not available in managed environment"); }
/** * Mutator for the connection URL * * @param url Connection URL for the datasource */ public void setConnectionURL(String url) { throw new JDOException("Not available in managed environment"); }
/** * * @return The connection factory */ public Object getConnectionFactory() { throw new JDOException("Not available in managed environment"); }
/** * * @param conn_factory Connection Factory */ public void setConnectionFactory2(Object conn_factory) { throw new JDOException("Not available in managed environment"); }
/** * Method to check the status. **/ private void checkStatus() { if (closed || mc == null) { throw new JDOException("Invalid state, closed or no mc"); } }
/** * * @param conn_factory_name <description> */ public void setConnectionFactoryName(String conn_factory_name) { throw new JDOException("Not available in managed environment"); }
/** * Mutator for the Password * * @param password Password */ public void setConnectionPassword(String password) { throw new JDOException("Not available in managed environment"); }
/** * Accessor for the connection URL * * @return The connection URL */ public String getConnectionURL() { throw new JDOException("Not available in managed environment"); }
/** * * @return <description> */ public Object getConnectionFactory2() { throw new JDOException("Not available in managed environment"); }
/** * Accessor for the PersistenceManager Factory. * @return The PersistenceManagerFactory */ public PersistenceManagerFactory getPersistenceManagerFactory() { // To be implemented by subclasses throw new JDOException(LOCALISER.msg("PM.GetPersistenceManagerFactoryNotImplemented")); }