@Override public String extractExtraXAExceptionDetails(XAException ex) { if (ex.getClass().getName().equals("oracle.jdbc.xa.OracleXAException")) { try { return "ORA-" + PropertyUtils.getProperty(ex, "oracleError"); } catch (PropertyException e) { return null; } } return null; }
@Override public String extractExtraXAExceptionDetails(XAException ex) { if (ex.getClass().getName().equals("oracle.jdbc.xa.OracleXAException")) { try { return "ORA-" + PropertyUtils.getProperty(ex, "oracleError"); } catch (PropertyException e) { return null; } } return null; }
public String extractExtraXAExceptionDetails(XAException ex) { if (ex.getClass().getName().equals("oracle.jdbc.xa.OracleXAException")) { try { return "ORA-" + PropertyUtils.getProperty(ex, "oracleError"); } catch (PropertyException e) { return null; } } return null; }
public String extractExtraXAExceptionDetails(XAException ex) { if (ex.getClass().getName().equals("oracle.jdbc.xa.OracleXAException")) { try { return "ORA-" + PropertyUtils.getProperty(ex, "oracleError"); } catch (PropertyException e) { return null; } } return null; }
/** * Return a comma-separated String of r/w properties of the specified object. * @param obj the object to introspect. * @return a a comma-separated String of r/w properties. */ public static String propertiesToString(Object obj) { StringBuilder sb = new StringBuilder(); Map<String, Object> properties = new TreeMap<String, Object>(getProperties(obj)); Iterator<String> it = properties.keySet().iterator(); while (it.hasNext()) { String property = it.next(); Object val = getProperty(obj, property); sb.append(property); sb.append("="); sb.append(val); if (it.hasNext()) { sb.append(", "); } } return sb.toString(); }
/** * Return a comma-separated String of r/w properties of the specified object. * @param obj the object to introspect. * @return a a comma-separated String of r/w properties. */ public static String propertiesToString(Object obj) { StringBuffer sb = new StringBuffer(); Map properties = new TreeMap(getProperties(obj)); Iterator it = properties.keySet().iterator(); while (it.hasNext()) { String property = (String) it.next(); Object val = getProperty(obj, property); sb.append(property); sb.append("="); sb.append(val); if (it.hasNext()) sb.append(", "); } return sb.toString(); }
/** * Return a comma-separated String of r/w properties of the specified object. * @param obj the object to introspect. * @return a a comma-separated String of r/w properties. */ public static String propertiesToString(Object obj) { StringBuffer sb = new StringBuffer(); Map properties = new TreeMap(getProperties(obj)); Iterator it = properties.keySet().iterator(); while (it.hasNext()) { String property = (String) it.next(); Object val = getProperty(obj, property); sb.append(property); sb.append("="); sb.append(val); if (it.hasNext()) sb.append(", "); } return sb.toString(); }
/** * Return a comma-separated String of r/w properties of the specified object. * @param obj the object to introspect. * @return a a comma-separated String of r/w properties. */ public static String propertiesToString(Object obj) { StringBuilder sb = new StringBuilder(); Map<String, Object> properties = new TreeMap<String, Object>(getProperties(obj)); Iterator<String> it = properties.keySet().iterator(); while (it.hasNext()) { String property = it.next(); Object val = getProperty(obj, property); sb.append(property); sb.append("="); sb.append(val); if (it.hasNext()) { sb.append(", "); } } return sb.toString(); }
public void testGetPrimitiveTypes() throws Exception { Destination destination = new Destination(); destination.setAString("this is my string"); destination.setABoolean(true); destination.setAByte((byte) 100); destination.setAShort((short) 20000); destination.setAnInteger(300000); destination.setALong(4000000L); destination.setAFloat(3.14f); destination.setADouble(0.654987); assertEquals("this is my string", PropertyUtils.getProperty(destination, "aString")); assertEquals(Boolean.TRUE, PropertyUtils.getProperty(destination, "aBoolean")); assertEquals(new Byte((byte) 100), PropertyUtils.getProperty(destination, "aByte")); assertEquals(new Short((short) 20000), PropertyUtils.getProperty(destination, "aShort")); assertEquals(new Integer(300000), PropertyUtils.getProperty(destination, "anInteger")); assertEquals(new Long(4000000L), PropertyUtils.getProperty(destination, "aLong")); assertEquals(new Float(3.14f), PropertyUtils.getProperty(destination, "aFloat")); assertEquals(new Double(0.654987), PropertyUtils.getProperty(destination, "aDouble")); }
public void testGetPrimitiveTypes() throws Exception { Destination destination = new Destination(); destination.setAString("this is my string"); destination.setABoolean(true); destination.setAByte((byte) 100); destination.setAShort((short) 20000); destination.setAnInteger(300000); destination.setALong(4000000L); destination.setAFloat(3.14f); destination.setADouble(0.654987); assertEquals("this is my string", PropertyUtils.getProperty(destination, "aString")); assertEquals(Boolean.TRUE, PropertyUtils.getProperty(destination, "aBoolean")); assertEquals(new Byte((byte) 100), PropertyUtils.getProperty(destination, "aByte")); assertEquals(new Short((short) 20000), PropertyUtils.getProperty(destination, "aShort")); assertEquals(new Integer(300000), PropertyUtils.getProperty(destination, "anInteger")); assertEquals(new Long(4000000L), PropertyUtils.getProperty(destination, "aLong")); assertEquals(new Float(3.14f), PropertyUtils.getProperty(destination, "aFloat")); assertEquals(new Double(0.654987), PropertyUtils.getProperty(destination, "aDouble")); }
public void testDecryptPassword() throws Exception { ResourceLoader loader = new ResourceLoader(); Properties p = new Properties(); p.setProperty("resource.ds1.className", MockitoXADataSource.class.getName()); p.setProperty("resource.ds1.uniqueName", "dataSource10"); p.setProperty("resource.ds1.maxPoolSize", "123"); p.setProperty("resource.ds1.automaticEnlistingEnabled", "true"); p.setProperty("resource.ds1.useTmJoin", "false"); p.setProperty("resource.ds1.deferConnectionRelease", "true"); p.setProperty("resource.ds1.driverProperties.userName", "java"); p.setProperty("resource.ds1.driverProperties.password", "{DES}UcXKog312decCrwu51xGmw=="); p.setProperty("resource.ds1.driverProperties.database", "users1"); loader.initXAResourceProducers(p); Map dataSources = loader.getResources(); assertEquals(1, dataSources.size()); String uniqueName = (String) dataSources.keySet().iterator().next(); assertEquals("dataSource10", uniqueName); PoolingDataSource pds = (PoolingDataSource) dataSources.get(uniqueName); assertEquals("bitronix.tm.mock.resource.jdbc.MockitoXADataSource", pds.getClassName()); assertEquals("dataSource10", pds.getUniqueName()); assertEquals(123, pds.getMaxPoolSize()); assertEquals(3, pds.getDriverProperties().size()); String decryptedPassword = (String) PropertyUtils.getProperty(getXADataSource(pds), "password"); assertEquals("java", decryptedPassword); }
public void testDecryptPassword() throws Exception { ResourceLoader loader = new ResourceLoader(); Properties p = new Properties(); p.setProperty("resource.ds1.className", MockitoXADataSource.class.getName()); p.setProperty("resource.ds1.uniqueName", "dataSource10"); p.setProperty("resource.ds1.maxPoolSize", "123"); p.setProperty("resource.ds1.automaticEnlistingEnabled", "true"); p.setProperty("resource.ds1.useTmJoin", "false"); p.setProperty("resource.ds1.deferConnectionRelease", "true"); p.setProperty("resource.ds1.driverProperties.userName", "java"); p.setProperty("resource.ds1.driverProperties.password", "{DES}UcXKog312decCrwu51xGmw=="); p.setProperty("resource.ds1.driverProperties.database", "users1"); loader.initXAResourceProducers(p); Map dataSources = loader.getResources(); assertEquals(1, dataSources.size()); String uniqueName = (String) dataSources.keySet().iterator().next(); assertEquals("dataSource10", uniqueName); PoolingDataSource pds = (PoolingDataSource) dataSources.get(uniqueName); assertEquals("bitronix.tm.mock.resource.jdbc.MockitoXADataSource", pds.getClassName()); assertEquals("dataSource10", pds.getUniqueName()); assertEquals(123, pds.getMaxPoolSize()); assertEquals(3, pds.getDriverProperties().size()); String decryptedPassword = (String) PropertyUtils.getProperty(getXADataSource(pds), "password"); assertEquals("java", decryptedPassword); }