@Test public void testInitServiceThrowsNullPointerException() throws Throwable { String[] args = new String[0]; KeyStoreAdaptor keyStoreAdaptor = new KeyStoreAdaptor(); keyStoreAdaptor.setServer(q2); try { keyStoreAdaptor.initService(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.q2.QFactory.newInstance(String)\" because \"factory\" is null", ex.getMessage(), "ex.getMessage()"); } assertFalse(keyStoreAdaptor.isModified(), "keyStoreAdaptor.isModified()"); assertNull(keyStoreAdaptor.ks, "keyStoreAdaptor.ks"); } }
protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); }
KeyStoreAdaptor extends QBeanSupport implements KeyStoreAdaptorMBean { protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); } }
KeyStoreAdaptor extends QBeanSupport implements KeyStoreAdaptorMBean { protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); } KeyStoreAdaptor(); }
KeyStoreAdaptor extends QBeanSupport implements KeyStoreAdaptorMBean { protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); } KeyStoreAdaptor(); void setImpl(String clazz); String getImpl(); }
KeyStoreAdaptor extends QBeanSupport implements KeyStoreAdaptorMBean { protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); } KeyStoreAdaptor(); void setImpl(String clazz); String getImpl(); static final String DEFAULT_IMPL; }