### Question:
PersistenceProductDerivation extends AbstractProductDerivation implements OpenJPAProductDerivation { public ConfigurationProvider load(PersistenceUnitInfo pinfo, Map m) throws IOException { if (pinfo == null) return null; if (!isOpenJPAPersistenceProvider(pinfo, null)) { warnUnknownProvider(pinfo); return null; } ConfigurationProviderImpl cp = new ConfigurationProviderImpl(); cp.addProperties(PersistenceUnitInfoImpl.toOpenJPAProperties(pinfo)); cp.addProperties(m); if (pinfo instanceof PersistenceUnitInfoImpl) { PersistenceUnitInfoImpl impl = (PersistenceUnitInfoImpl) pinfo; if (impl.getPersistenceXmlFileUrl() != null) cp.setSource(impl.getPersistenceXmlFileUrl().toString()); } return cp; } PersistenceProductDerivation(); @Override void putBrokerFactoryAliases(Map<String, String> m); @Override int getType(); @Override String getConfigurationPrefix(); @Override Set<String> getSupportedQueryHints(); @Override void validate(); @Override boolean beforeConfigurationLoad(Configuration c); @Override boolean afterSpecificationSet(Configuration c); ConfigurationProvider load(PersistenceUnitInfo pinfo, Map m); ConfigurationProvider load(String rsrc, String name, Map m); @Override ConfigurationProvider load(String rsrc, String anchor,
        ClassLoader loader); @Override ConfigurationProvider load(File file, String anchor); @Override String getDefaultResourceLocation(); @Override List<String> getAnchorsInFile(File file); @Override List getAnchorsInResource(String resource); @Override ConfigurationProvider loadGlobals(ClassLoader loader); @Override ConfigurationProvider loadDefaults(ClassLoader loader); boolean checkPuNameCollisions(Log logger,String puName); static final Specification SPEC_JPA; static final Specification ALIAS_EJB; static final String RSRC_GLOBAL; static final String RSRC_DEFAULT; static final BigDecimal VERSION_1_0; static final String PREFIX; }### Answer:
@Test public void testEncryptionPluginConfiguration() throws Exception { PersistenceProductDerivation ppd = new PersistenceProductDerivation(); OpenJPAConfiguration conf = new OpenJPAConfigurationImpl(); String encryptedPassword = "encrypted_password"; ClassLoader loader = null; ConfigurationProvider provider = ppd.load( PersistenceProductDerivation.RSRC_DEFAULT, "encryption_plugin_pu", loader); provider.setInto(conf); EncryptionProvider ep = conf.getEncryptionProvider(); assertNotNull(ep); TestEncryptionProvider tep = (TestEncryptionProvider) ep; conf.setConnectionPassword(encryptedPassword); assertEquals(TestEncryptionProvider.decryptedPassword, conf .getConnectionPassword()); assertEquals(encryptedPassword, tep.getEncryptedPassword()); }
@Test public void testEncryptionPluginConfigurationDefaultValue() throws Exception { PersistenceProductDerivation ppd = new PersistenceProductDerivation(); OpenJPAConfiguration conf = new OpenJPAConfigurationImpl(); ClassLoader loader = null; ConfigurationProvider provider = ppd.load( PersistenceProductDerivation.RSRC_DEFAULT, "encryption_plugin_default_pu", loader); provider.setInto(conf); assertNull(conf.getEncryptionProvider()); }