target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test(expected = IllegalArgumentException.class) public void testAllowGeneratedIdInsertPrimitive() throws Exception { Field field = AllowGeneratedIdNotGeneratedId.class.getDeclaredField("stuff"); FieldType.createFieldType(connectionSource, AllowGeneratedIdNotGeneratedId.class.getSimpleName(), field, AllowGeneratedIdNot... | public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... |
@Test(expected = IllegalArgumentException.class) public void testVersionFieldWrongType() throws Exception { Field field = VersionFieldWrongType.class.getDeclaredField("version"); FieldType.createFieldType(connectionSource, AllowGeneratedIdNotGeneratedId.class.getSimpleName(), field, AllowGeneratedIdNotGeneratedId.class... | public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... | FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field... |
@Test public void testEmptyFile() throws Exception { String value = ""; assertNull(DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value)))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = SQLException.class) public void testBadLine() throws Exception { String value = "not a good line"; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test public void testBlankLine() throws Exception { String value = LINE_SEP; assertNull(DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value)))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test public void testComment() throws Exception { String value = "# some comment" + LINE_SEP; assertNull(DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value)))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test public void testExpressionParameter4InNull() throws Exception { String sql = "select #if (:1) id in (:1) #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList(new TypeToken<List<Integer>>(){}.getType())); n.checkAndBind(ctx); InvocationContext context... | final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn00... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... |
@Test(expected = IllegalArgumentException.class) public void testBadPersisterClass() throws Exception { String value = "persisterClass=unknown class name" + LINE_SEP; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = IllegalArgumentException.class) public void testBadEnumValue() throws Exception { String value = "unknownEnumValue=notvalidclass" + LINE_SEP; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = IllegalArgumentException.class) public void testBadEnumClass() throws Exception { String value = "unknownEnumValue=notvalidclass#somevalue" + LINE_SEP; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = IllegalArgumentException.class) public void testBadEnumClassNotAnEnum() throws Exception { String value = "unknownEnumValue=java.lang.Object#somevalue" + LINE_SEP; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = IllegalArgumentException.class) public void testBadEnumClassInvalidEnumValue() throws Exception { String value = "unknownEnumValue=" + OurEnum.class.getName() + "#notvalid" + LINE_SEP; DatabaseFieldConfigLoader.fromReader(new BufferedReader(new StringReader(value))); } | public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Could not read DatabaseFieldCon... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... | DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUtil.create("Cou... |
@Test(expected = SQLException.class) public void testDateLongParseInvalid() throws Exception { FieldType fieldType = FieldType.createFieldType(connectionSource, TABLE_NAME, LocalDateLong.class.getDeclaredField(DATE_COLUMN), LocalDateLong.class); DataType.DATE_LONG.getDataPersister().parseDefaultString(fieldType, "not v... | @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default date-long value: " + defaultStr, e); } } | DateLongType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default date-long value: ... | DateLongType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default date-long value: ... | DateLongType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default date-long value: ... | DateLongType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default date-long value: ... |
@Test(expected = SQLException.class) public void testSerializableParseDefault() throws Exception { DataType.SERIALIZABLE.getDataPersister().parseDefaultString(null, null); } | @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } | SerializableType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } } | SerializableType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } private SerializableType(); protected SerializableType(SqlType sqlType, Class<?>[] class... | SerializableType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } private SerializableType(); protected SerializableType(SqlType sqlType, Class<?>[] class... | SerializableType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } private SerializableType(); protected SerializableType(SqlType sqlType, Class<?>[] class... |
@Test(expected = SQLException.class) public void testJavaToSqlArg() throws Exception { DateTimeType.getSingleton().javaToSqlArg(null, new Object()); } | @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } | DateTimeType extends BaseDataType { @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } } | DateTimeType extends BaseDataType { @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); } | DateTimeType extends BaseDataType { @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getSingleton(); @Override String[] getAsso... | DateTimeType extends BaseDataType { @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getSingleton(); @Override String[] getAsso... |
@Test public void testParseDefaultString() throws SQLException { Long value = 423424234234L; assertEquals(value, DateTimeType.getSingleton().parseDefaultString(null, value.toString())); } | @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default DateTime value: " + defaultStr, e); } } | DateTimeType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default DateTime value: "... | DateTimeType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default DateTime value: "... | DateTimeType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default DateTime value: "... | DateTimeType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default DateTime value: "... |
@Test(expected = SQLException.class) public void testResultToSqlArg() throws Exception { DatabaseResults results = createMock(DatabaseResults.class); int col = 21; long value = 2094234324L; expect(results.getLong(col)).andReturn(value); replay(results); DateTimeType.getSingleton().resultToJava(null, results, col); } | @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } | DateTimeType extends BaseDataType { @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } } | DateTimeType extends BaseDataType { @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); } | DateTimeType extends BaseDataType { @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getSingleton(); @O... | DateTimeType extends BaseDataType { @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getSingleton(); @O... |
@Test public void testJdbcType() throws Exception { String sql = "insert into table ... values(:1.b.c@blob) a in (:2.x.y@clob)"; ASTRootNode n = new Parser(sql).parse().init(); final AtomicInteger t = new AtomicInteger(0); n.jjtAccept(new ParserVisitorAdapter() { @Override public Object visit(ASTJDBCParameter node, Obj... | final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn00... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... | Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); bool... |
@Test(expected = SQLException.class) public void testDateParseInvalid() throws Exception { FieldType fieldType = FieldType.createFieldType(connectionSource, TABLE_NAME, LocalDate.class.getDeclaredField(DATE_COLUMN), LocalDate.class); DataType.DATE.getDataPersister().parseDefaultString(fieldType, "not valid date string"... | @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, defaultStr).getTime()); } catch (ParseExceptio... | DateType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, defaultStr).ge... | DateType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, defaultStr).ge... | DateType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, defaultStr).ge... | DateType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, defaultStr).ge... |
@Test public void testDoubleInitialize() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, Foo.class) { }; dao.initialize(); dao.initialize(); } | public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == null) { throw new IllegalStateException... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... |
@Test(expected = IllegalStateException.class) public void testInitNoConnectionSource() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.initialize(); } | public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == null) { throw new IllegalStateException... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... |
@Test public void testCreate() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); int equal = 21313; foo.equal = equal; assertEquals(1, dao.create(foo)); Foo result = dao.queryForId(foo.id); assertNotNull(result); assertEquals(equal, result.equal); } | @Override public int create(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseConnection connection = connectionSour... | BaseDaoImpl implements Dao<T, ID> { @Override public int create(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int create(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int create(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int create(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... |
@Test public void testUpdate() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); assertEquals(1, dao.create(foo)); foo.equal = 1; assertEquals(1, dao.update(foo)); } | @Override public int update(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseConnection connection = connectionSour... | BaseDaoImpl implements Dao<T, ID> { @Override public int update(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int update(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int update(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... | BaseDaoImpl implements Dao<T, ID> { @Override public int update(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseCo... |
@Test public void testUpdateId() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); assertEquals(1, dao.create(foo)); int id = foo.id; assertNotNull(dao.queryForId(id)); assertNull(dao.queryForId(id + 1)); assertEquals(1, dao.updateId(foo, id + 1)); assertNull(dao.queryForId(id)... | @Override public int updateId(T data, ID newId) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateId(connection, data, newId, objectCache); } finally ... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateId(T data, ID newId) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateId(connection, d... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateId(T data, ID newId) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateId(connection, d... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateId(T data, ID newId) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateId(connection, d... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateId(T data, ID newId) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateId(connection, d... |
@Test public void testDelete() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); assertEquals(1, dao.create(foo)); assertNotNull(dao.queryForId(foo.id)); assertEquals(1, dao.delete(foo)); assertNull(dao.queryForId(foo.id)); assertEquals(0, dao.queryForAll().size()); } | @Override public int delete(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.delete(connection, data, objectCache); } finally { connectionSource.re... | BaseDaoImpl implements Dao<T, ID> { @Override public int delete(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.delete(connection, data, objectCac... | BaseDaoImpl implements Dao<T, ID> { @Override public int delete(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.delete(connection, data, objectCac... | BaseDaoImpl implements Dao<T, ID> { @Override public int delete(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.delete(connection, data, objectCac... | BaseDaoImpl implements Dao<T, ID> { @Override public int delete(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.delete(connection, data, objectCac... |
@Test public void testDeleteById() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); assertEquals(1, dao.create(foo)); assertNotNull(dao.queryForId(foo.id)); assertEquals(1, dao.deleteById(foo.id)); assertNull(dao.queryForId(foo.id)); assertEquals(0, dao.queryForAll().size()); ... | @Override public int deleteById(ID id) throws SQLException { checkForInitialized(); if (id == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteById(connection, id, objectCache); } finally { connectionSource... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteById(ID id) throws SQLException { checkForInitialized(); if (id == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteById(connection, id, object... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteById(ID id) throws SQLException { checkForInitialized(); if (id == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteById(connection, id, object... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteById(ID id) throws SQLException { checkForInitialized(); if (id == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteById(connection, id, object... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteById(ID id) throws SQLException { checkForInitialized(); if (id == null) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteById(connection, id, object... |
@Test public void testDeleteIds() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); assertEquals(1, dao.create(foo2)); assertNotNull(dao.queryForId(foo1.id)); assertNotNull(dao.queryForId(foo2.id)); List<Integer> ids = n... | @Override public int deleteIds(Collection<ID> ids) throws SQLException { checkForInitialized(); if (ids == null || ids.isEmpty()) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.deleteIds(connection, ids, objectCache)... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteIds(Collection<ID> ids) throws SQLException { checkForInitialized(); if (ids == null || ids.isEmpty()) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.del... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteIds(Collection<ID> ids) throws SQLException { checkForInitialized(); if (ids == null || ids.isEmpty()) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.del... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteIds(Collection<ID> ids) throws SQLException { checkForInitialized(); if (ids == null || ids.isEmpty()) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.del... | BaseDaoImpl implements Dao<T, ID> { @Override public int deleteIds(Collection<ID> ids) throws SQLException { checkForInitialized(); if (ids == null || ids.isEmpty()) { return 0; } else { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.del... |
@Test public void testRefresh() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); int equal1 = 11312331; foo.equal = equal1; assertEquals(1, dao.create(foo)); int equal2 = 312312; assertNotNull(dao.queryForId(foo.id)); UpdateBuilder<Foo, Integer> updateBuilder = dao.updateBuild... | @Override public int refresh(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseConnection connection = connectionSou... | BaseDaoImpl implements Dao<T, ID> { @Override public int refresh(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseC... | BaseDaoImpl implements Dao<T, ID> { @Override public int refresh(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseC... | BaseDaoImpl implements Dao<T, ID> { @Override public int refresh(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseC... | BaseDaoImpl implements Dao<T, ID> { @Override public int refresh(T data) throws SQLException { checkForInitialized(); if (data == null) { return 0; } if (data instanceof BaseDaoEnabled) { @SuppressWarnings("unchecked") BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data; daoEnabled.setDao(this); } DatabaseC... |
@Test public void testGetFullName() throws Exception { BindingParameter bp = BindingParameter.create("a", "b", null); assertThat(bp.getFullName(), equalTo(":a.b")); bp = BindingParameter.create("a", "", null); assertThat(bp.getFullName(), equalTo(":a")); } | public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } | BindingParameter { public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } } | BindingParameter { public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } BindingParameter(String parameterName, String propertyPath, JdbcType jdbcType); } | BindingParameter { public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } BindingParameter(String parameterName, String propertyPath, JdbcType jdbcType); static BindingParameter create(String parameterName, String propertyPath, JdbcType jdbcType); BindingParameter rightShift(); String ... | BindingParameter { public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } BindingParameter(String parameterName, String propertyPath, JdbcType jdbcType); static BindingParameter create(String parameterName, String propertyPath, JdbcType jdbcType); BindingParameter rightShift(); String ... |
@Test(expected = IllegalStateException.class) public void testNoDatabaseType() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.initialize(); } | public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == null) { throw new IllegalStateException... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... | BaseDaoImpl implements Dao<T, ID> { public void initialize() throws SQLException { if (initialized) { return; } if (connectionSource == null) { throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName()); } databaseType = connectionSource.getDatabaseType(); if (databaseType == nul... |
@Test(expected = IllegalStateException.class) public void testQueryForIdNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.queryForId(1); } | @Override public T queryForId(ID id) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForId(connection, id, objectCache); } finally { connectionSource.releaseConnection(connection); } } | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForId(ID id) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForId(connection, id, objectCache); } finally { connectionSource.rel... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForId(ID id) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForId(connection, id, objectCache); } finally { connectionSource.rel... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForId(ID id) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForId(connection, id, objectCache); } finally { connectionSource.rel... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForId(ID id) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForId(connection, id, objectCache); } finally { connectionSource.rel... |
@Test public void testQueryForFirst() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); assertEquals(1, dao.create(foo2)); assertNotNull(dao.queryForId(foo1.id)); assertNotNull(dao.queryForId(foo2.id)); assertEquals(2, d... | @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, objectCache); } finally { connectionSour... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... |
@Test(expected = IllegalStateException.class) public void testStatementBuilderNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.queryBuilder(); } | @Override public QueryBuilder<T, ID> queryBuilder() { checkForInitialized(); return new QueryBuilder<T, ID>(databaseType, tableInfo, this); } | BaseDaoImpl implements Dao<T, ID> { @Override public QueryBuilder<T, ID> queryBuilder() { checkForInitialized(); return new QueryBuilder<T, ID>(databaseType, tableInfo, this); } } | BaseDaoImpl implements Dao<T, ID> { @Override public QueryBuilder<T, ID> queryBuilder() { checkForInitialized(); return new QueryBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoI... | BaseDaoImpl implements Dao<T, ID> { @Override public QueryBuilder<T, ID> queryBuilder() { checkForInitialized(); return new QueryBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoI... | BaseDaoImpl implements Dao<T, ID> { @Override public QueryBuilder<T, ID> queryBuilder() { checkForInitialized(); return new QueryBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoI... |
@Test(expected = IllegalStateException.class) public void testQueryForFirstNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.queryForFirst(null); } | @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, objectCache); } finally { connectionSour... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForFirst(connection, preparedQuery, obje... |
@Test(expected = IllegalStateException.class) public void testQueryForPreparedNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.query((PreparedQuery<Foo>) null); } | @Override public List<T> query(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); return statementExecutor.query(connectionSource, preparedQuery, objectCache); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); return statementExecutor.query(connectionSource, preparedQuery, objectCache); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); return statementExecutor.query(connectionSource, preparedQuery, objectCache); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSo... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); return statementExecutor.query(connectionSource, preparedQuery, objectCache); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSo... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) throws SQLException { checkForInitialized(); return statementExecutor.query(connectionSource, preparedQuery, objectCache); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSo... |
@Test public void testObjectToString() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, Foo.class) { }; dao.initialize(); Foo foo = new Foo(); String objStr = dao.objectToString(foo); assertTrue(objStr.contains("id=" + foo.id)); } | @Override public String objectToString(T data) { checkForInitialized(); return tableInfo.objectToString(data); } | BaseDaoImpl implements Dao<T, ID> { @Override public String objectToString(T data) { checkForInitialized(); return tableInfo.objectToString(data); } } | BaseDaoImpl implements Dao<T, ID> { @Override public String objectToString(T data) { checkForInitialized(); return tableInfo.objectToString(data); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connecti... | BaseDaoImpl implements Dao<T, ID> { @Override public String objectToString(T data) { checkForInitialized(); return tableInfo.objectToString(data); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connecti... | BaseDaoImpl implements Dao<T, ID> { @Override public String objectToString(T data) { checkForInitialized(); return tableInfo.objectToString(data); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connecti... |
@Test public void testObjectsEqual() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, Foo.class) { }; dao.initialize(); Foo foo = new Foo(); foo.id = 121134243; foo.val = 123123; Foo bar = new Foo(); assertTrue(dao.objectsEqual(foo, foo)); assertFalse(dao.objectsEqual(f... | @Override public boolean objectsEqual(T data1, T data2) throws SQLException { checkForInitialized(); for (FieldType fieldType : tableInfo.getFieldTypes()) { Object fieldObj1 = fieldType.extractJavaFieldValue(data1); Object fieldObj2 = fieldType.extractJavaFieldValue(data2); if (!fieldType.getDataPersister().dataIsEqual... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean objectsEqual(T data1, T data2) throws SQLException { checkForInitialized(); for (FieldType fieldType : tableInfo.getFieldTypes()) { Object fieldObj1 = fieldType.extractJavaFieldValue(data1); Object fieldObj2 = fieldType.extractJavaFieldValue(data2); if (!fiel... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean objectsEqual(T data1, T data2) throws SQLException { checkForInitialized(); for (FieldType fieldType : tableInfo.getFieldTypes()) { Object fieldObj1 = fieldType.extractJavaFieldValue(data1); Object fieldObj2 = fieldType.extractJavaFieldValue(data2); if (!fiel... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean objectsEqual(T data1, T data2) throws SQLException { checkForInitialized(); for (FieldType fieldType : tableInfo.getFieldTypes()) { Object fieldObj1 = fieldType.extractJavaFieldValue(data1); Object fieldObj2 = fieldType.extractJavaFieldValue(data2); if (!fiel... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean objectsEqual(T data1, T data2) throws SQLException { checkForInitialized(); for (FieldType fieldType : tableInfo.getFieldTypes()) { Object fieldObj1 = fieldType.extractJavaFieldValue(data1); Object fieldObj2 = fieldType.extractJavaFieldValue(data2); if (!fiel... |
@Test public void testIterator() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); int equal1 = 1231231232; foo1.equal = equal1; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); int equal2 = 1231232; foo2.equal = equal2; assertEquals(1, dao.create(foo2)); CloseableIter... | @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... |
@Test(expected = IllegalStateException.class) public void testIteratorNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.iterator(); } | @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... |
@Test public void testEquals() throws Exception { BindingParameter bp = BindingParameter.create("a", "b", null); BindingParameter bp2 = BindingParameter.create("a", "b", null); assertThat(bp.equals(bp2), equalTo(true)); assertThat(bp.equals(null), equalTo(false)); assertThat(bp.equals(new Object()), equalTo(false)); } | @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPath(), other.getPropertyPath()) &&... | BindingParameter { @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPath(), other.ge... | BindingParameter { @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPath(), other.ge... | BindingParameter { @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPath(), other.ge... | BindingParameter { @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPath(), other.ge... |
@Test(expected = IllegalStateException.class) public void testIteratorPreparedNoInit() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; dao.iterator((PreparedQuery<Foo>) null); } | @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } } | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... | BaseDaoImpl implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return iterator(DatabaseConnection.DEFAULT_RESULT_FLAGS); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connection... |
@Test public void testTableConfig() throws Exception { DatabaseTableConfig<Foo> config = DatabaseTableConfig.fromClass(connectionSource, Foo.class); BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, config) { }; assertSame(config, dao.getTableConfig()); } | public DatabaseTableConfig<T> getTableConfig() { return tableConfig; } | BaseDaoImpl implements Dao<T, ID> { public DatabaseTableConfig<T> getTableConfig() { return tableConfig; } } | BaseDaoImpl implements Dao<T, ID> { public DatabaseTableConfig<T> getTableConfig() { return tableConfig; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConf... | BaseDaoImpl implements Dao<T, ID> { public DatabaseTableConfig<T> getTableConfig() { return tableConfig; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConf... | BaseDaoImpl implements Dao<T, ID> { public DatabaseTableConfig<T> getTableConfig() { return tableConfig; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConf... |
@Test public void testIsUpdatable() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, false); assertTrue(dao.isUpdatable()); } | @Override public boolean isUpdatable() { return tableInfo.isUpdatable(); } | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isUpdatable() { return tableInfo.isUpdatable(); } } | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isUpdatable() { return tableInfo.isUpdatable(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> table... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isUpdatable() { return tableInfo.isUpdatable(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> table... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isUpdatable() { return tableInfo.isUpdatable(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> table... |
@Test public void testIsTableExists() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, false); assertFalse(dao.isTableExists()); TableUtils.createTable(connectionSource, Foo.class); assertTrue(dao.isTableExists()); TableUtils.dropTable(connectionSource, Foo.class, true); assertFalse(dao.isTableExists());... | @Override public boolean isTableExists() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return connection.isTableExists(tableInfo.getTableName()); } finally { connectionSource.releaseConnection(connection); } } | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isTableExists() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return connection.isTableExists(tableInfo.getTableName()); } finally { connectionSource.releas... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isTableExists() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return connection.isTableExists(tableInfo.getTableName()); } finally { connectionSource.releas... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isTableExists() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return connection.isTableExists(tableInfo.getTableName()); } finally { connectionSource.releas... | BaseDaoImpl implements Dao<T, ID> { @Override public boolean isTableExists() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return connection.isTableExists(tableInfo.getTableName()); } finally { connectionSource.releas... |
@Test public void testUpdateBuilder() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, Foo.class) { }; dao.updateBuilder(); } | @Override public UpdateBuilder<T, ID> updateBuilder() { checkForInitialized(); return new UpdateBuilder<T, ID>(databaseType, tableInfo, this); } | BaseDaoImpl implements Dao<T, ID> { @Override public UpdateBuilder<T, ID> updateBuilder() { checkForInitialized(); return new UpdateBuilder<T, ID>(databaseType, tableInfo, this); } } | BaseDaoImpl implements Dao<T, ID> { @Override public UpdateBuilder<T, ID> updateBuilder() { checkForInitialized(); return new UpdateBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... | BaseDaoImpl implements Dao<T, ID> { @Override public UpdateBuilder<T, ID> updateBuilder() { checkForInitialized(); return new UpdateBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... | BaseDaoImpl implements Dao<T, ID> { @Override public UpdateBuilder<T, ID> updateBuilder() { checkForInitialized(); return new UpdateBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... |
@Test public void testDeleteBuilder() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(connectionSource, Foo.class) { }; dao.deleteBuilder(); } | @Override public DeleteBuilder<T, ID> deleteBuilder() { checkForInitialized(); return new DeleteBuilder<T, ID>(databaseType, tableInfo, this); } | BaseDaoImpl implements Dao<T, ID> { @Override public DeleteBuilder<T, ID> deleteBuilder() { checkForInitialized(); return new DeleteBuilder<T, ID>(databaseType, tableInfo, this); } } | BaseDaoImpl implements Dao<T, ID> { @Override public DeleteBuilder<T, ID> deleteBuilder() { checkForInitialized(); return new DeleteBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... | BaseDaoImpl implements Dao<T, ID> { @Override public DeleteBuilder<T, ID> deleteBuilder() { checkForInitialized(); return new DeleteBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... | BaseDaoImpl implements Dao<T, ID> { @Override public DeleteBuilder<T, ID> deleteBuilder() { checkForInitialized(); return new DeleteBuilder<T, ID>(databaseType, tableInfo, this); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseD... |
@Test public void testDataClass() throws Exception { BaseDaoImpl<Foo, Integer> dao = new BaseDaoImpl<Foo, Integer>(Foo.class) { }; assertEquals(Foo.class, dao.getDataClass()); } | @Override public Class<T> getDataClass() { return dataClass; } | BaseDaoImpl implements Dao<T, ID> { @Override public Class<T> getDataClass() { return dataClass; } } | BaseDaoImpl implements Dao<T, ID> { @Override public Class<T> getDataClass() { return dataClass; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); pri... | BaseDaoImpl implements Dao<T, ID> { @Override public Class<T> getDataClass() { return dataClass; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); pri... | BaseDaoImpl implements Dao<T, ID> { @Override public Class<T> getDataClass() { return dataClass; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); pri... |
@Test public void testUpdateRaw() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); assertEquals(1, dao.create(foo2)); assertEquals(2, dao.queryForAll().size()); dao.updateRaw("DELETE FROM FOO WHERE " + Foo.ID_COLUMN_NAM... | @Override public int updateRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateRaw(connection, statement, arguments); } catch (SQLException e) { thr... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateRaw(connection, statement, argume... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateRaw(connection, statement, argume... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateRaw(connection, statement, argume... | BaseDaoImpl implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.updateRaw(connection, statement, argume... |
@Test public void testExecuteRaw() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); assertEquals(1, dao.create(foo2)); assertEquals(2, dao.queryForAll().size()); dao.executeRaw("TRUNCATE TABLE FOO"); assertEquals(0, dao... | @Override public int executeRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.executeRaw(connection, statement, arguments); } catch (SQLException e) { t... | BaseDaoImpl implements Dao<T, ID> { @Override public int executeRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.executeRaw(connection, statement, argu... | BaseDaoImpl implements Dao<T, ID> { @Override public int executeRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.executeRaw(connection, statement, argu... | BaseDaoImpl implements Dao<T, ID> { @Override public int executeRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.executeRaw(connection, statement, argu... | BaseDaoImpl implements Dao<T, ID> { @Override public int executeRaw(String statement, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName()); try { return statementExecutor.executeRaw(connection, statement, argu... |
@Test public void testExtractId() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo = new Foo(); assertEquals((Integer) foo.id, dao.extractId(foo)); } | @Override public ID extractId(T data) throws SQLException { checkForInitialized(); FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Class " + dataClass + " does not have an id field"); } @SuppressWarnings("unchecked") ID id = (ID) idField.extractJavaFieldValue(data); return id;... | BaseDaoImpl implements Dao<T, ID> { @Override public ID extractId(T data) throws SQLException { checkForInitialized(); FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Class " + dataClass + " does not have an id field"); } @SuppressWarnings("unchecked") ID id = (ID) idField.ext... | BaseDaoImpl implements Dao<T, ID> { @Override public ID extractId(T data) throws SQLException { checkForInitialized(); FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Class " + dataClass + " does not have an id field"); } @SuppressWarnings("unchecked") ID id = (ID) idField.ext... | BaseDaoImpl implements Dao<T, ID> { @Override public ID extractId(T data) throws SQLException { checkForInitialized(); FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Class " + dataClass + " does not have an id field"); } @SuppressWarnings("unchecked") ID id = (ID) idField.ext... | BaseDaoImpl implements Dao<T, ID> { @Override public ID extractId(T data) throws SQLException { checkForInitialized(); FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Class " + dataClass + " does not have an id field"); } @SuppressWarnings("unchecked") ID id = (ID) idField.ext... |
@Test public void testBindingException4() throws Exception { thrown.expect(BindingException.class); thrown.expectMessage("Parameter ':user.userBag.ite' can't be readable; " + "caused by: There is no getter/setter for property named 'ite' in 'class org.jfaster.mango.binding.FunctionalBindingParameterInvokerTest$UserBag'... | public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter); return invokerGroup; } catch (UnreachablePropertyException e) { throw new BindingE... | FunctionalBindingParameterInvoker implements BindingParameterInvoker { public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter); return invo... | FunctionalBindingParameterInvoker implements BindingParameterInvoker { public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter); return invo... | FunctionalBindingParameterInvoker implements BindingParameterInvoker { public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter); return invo... | FunctionalBindingParameterInvoker implements BindingParameterInvoker { public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter); return invo... |
@Test public void fetchPropertyMetas() throws Exception { Set<PropertyMeta> pms = Sets.newHashSet(BeanUtil.fetchPropertyMetas(A.class)); Set<PropertyMeta> set = Sets.newHashSet(); set.add(getPropertyMeta(A.class, "id", int.class)); set.add(getPropertyMeta(A.class, "uid", int.class)); set.add(getPropertyMeta(A.class, "n... | public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } | BeanUtil { public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } } | BeanUtil { public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } } | BeanUtil { public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz); } | BeanUtil { public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz); } |
@Test public void testCountOf() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); assertEquals(0, dao.countOf()); Foo foo = new Foo(); assertEquals(1, dao.create(foo)); assertEquals(1, dao.countOf()); assertEquals(1, dao.create(foo)); assertEquals(2, dao.countOf()); } | @Override public long countOf() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForCountStar(connection); } finally { connectionSource.releaseConnection(connection); } } | BaseDaoImpl implements Dao<T, ID> { @Override public long countOf() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForCountStar(connection); } finally { connectionSource.releaseConnection(... | BaseDaoImpl implements Dao<T, ID> { @Override public long countOf() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForCountStar(connection); } finally { connectionSource.releaseConnection(... | BaseDaoImpl implements Dao<T, ID> { @Override public long countOf() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForCountStar(connection); } finally { connectionSource.releaseConnection(... | BaseDaoImpl implements Dao<T, ID> { @Override public long countOf() throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForCountStar(connection); } finally { connectionSource.releaseConnection(... |
@Test public void testQueryForEq() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); assertEquals(0, dao.countOf()); Foo foo1 = new Foo(); foo1.val = 1231231; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = foo1.val + 1; assertEquals(1, dao.create(foo2)); List<Foo> results = dao... | @Override public List<T> queryForEq(String fieldName, Object value) throws SQLException { return queryBuilder().where().eq(fieldName, value).query(); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) throws SQLException { return queryBuilder().where().eq(fieldName, value).query(); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) throws SQLException { return queryBuilder().where().eq(fieldName, value).query(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) throws SQLException { return queryBuilder().where().eq(fieldName, value).query(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) throws SQLException { return queryBuilder().where().eq(fieldName, value).query(); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected... |
@Test public void testQueryForMatching() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); assertEquals(0, dao.countOf()); Foo foo1 = new Foo(); int val = 1231231; foo1.val = val; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = val + 1; assertEquals(1, dao.create(foo2)); Foo mat... | @Override public List<T> queryForMatching(T matchObj) throws SQLException { return queryForMatching(matchObj, false); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) throws SQLException { return queryForMatching(matchObj, false); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) throws SQLException { return queryForMatching(matchObj, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource c... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) throws SQLException { return queryForMatching(matchObj, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource c... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) throws SQLException { return queryForMatching(matchObj, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSource c... |
@Test public void testQueryForMatchingArgs() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); assertEquals(0, dao.countOf()); Foo foo1 = new Foo(); int val = 1231231; foo1.val = val; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = val + 1; assertEquals(1, dao.create(foo2)); Foo... | @Override public List<T> queryForMatchingArgs(T matchObj) throws SQLException { return queryForMatching(matchObj, true); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) throws SQLException { return queryForMatching(matchObj, true); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) throws SQLException { return queryForMatching(matchObj, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSourc... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) throws SQLException { return queryForMatching(matchObj, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSourc... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) throws SQLException { return queryForMatching(matchObj, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected BaseDaoImpl(ConnectionSourc... |
@Test public void testQueryForFieldValues() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); assertEquals(0, dao.countOf()); Foo foo1 = new Foo(); foo1.val = 1231231; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = foo1.val + 1; assertEquals(1, dao.create(foo2)); Map<String, Ob... | @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, false); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, false); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected ... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected ... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, false); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protected ... |
@Test public void testQueryForFieldValuesArgs() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Map<String, Object> fieldValues = new HashMap<String, Object>(); fieldValues.put(Foo.STRING_COLUMN_NAME, "this id has a quote '"); dao.queryForFieldValuesArgs(fieldValues); } | @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, true); } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, true); } } | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protecte... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protecte... | BaseDaoImpl implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) throws SQLException { return queryForFieldValues(fieldValues, true); } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> dataClass); protecte... |
@Test public void testForeignCollectionAutoRefresh() throws Exception { createDao(ForeignCollectionAutoRefresh.class, false); } | static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; } | BaseDaoImpl implements Dao<T, ID> { static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; } } | BaseDaoImpl implements Dao<T, ID> { static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> da... | BaseDaoImpl implements Dao<T, ID> { static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> da... | BaseDaoImpl implements Dao<T, ID> { static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { return new BaseDaoImpl<T, ID>(connectionSource, clazz) { }; } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(ConnectionSource connectionSource, Class<T> da... |
@Test public void testCreateOrUpdate() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); int equal1 = 21313; foo1.equal = equal1; CreateOrUpdateStatus status = dao.createOrUpdate(foo1); assertTrue(status.isCreated()); assertFalse(status.isUpdated()); assertEquals(1, status.get... | @Override public CreateOrUpdateStatus createOrUpdate(T data) throws SQLException { if (data == null) { return new CreateOrUpdateStatus(false, false, 0); } ID id = extractId(data); if (id == null || !idExists(id)) { int numRows = create(data); return new CreateOrUpdateStatus(true, false, numRows); } else { int numRows =... | BaseDaoImpl implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) throws SQLException { if (data == null) { return new CreateOrUpdateStatus(false, false, 0); } ID id = extractId(data); if (id == null || !idExists(id)) { int numRows = create(data); return new CreateOrUpdateStatus(true, fal... | BaseDaoImpl implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) throws SQLException { if (data == null) { return new CreateOrUpdateStatus(false, false, 0); } ID id = extractId(data); if (id == null || !idExists(id)) { int numRows = create(data); return new CreateOrUpdateStatus(true, fal... | BaseDaoImpl implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) throws SQLException { if (data == null) { return new CreateOrUpdateStatus(false, false, 0); } ID id = extractId(data); if (id == null || !idExists(id)) { int numRows = create(data); return new CreateOrUpdateStatus(true, fal... | BaseDaoImpl implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) throws SQLException { if (data == null) { return new CreateOrUpdateStatus(false, false, 0); } ID id = extractId(data); if (id == null || !idExists(id)) { int numRows = create(data); return new CreateOrUpdateStatus(true, fal... |
@Test public void testQueryForSameId() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); foo1.equal = 198412893; assertEquals(1, dao.create(foo1)); Foo fooResult = dao.queryForSameId(foo1); assertEquals(foo1.id, fooResult.id); assertEquals(foo1.equal, fooResult.equal); } | @Override public T queryForSameId(T data) throws SQLException { checkForInitialized(); if (data == null) { return null; } ID id = extractId(data); if (id == null) { return null; } else { return queryForId(id); } } | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForSameId(T data) throws SQLException { checkForInitialized(); if (data == null) { return null; } ID id = extractId(data); if (id == null) { return null; } else { return queryForId(id); } } } | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForSameId(T data) throws SQLException { checkForInitialized(); if (data == null) { return null; } ID id = extractId(data); if (id == null) { return null; } else { return queryForId(id); } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(Con... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForSameId(T data) throws SQLException { checkForInitialized(); if (data == null) { return null; } ID id = extractId(data); if (id == null) { return null; } else { return queryForId(id); } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(Con... | BaseDaoImpl implements Dao<T, ID> { @Override public T queryForSameId(T data) throws SQLException { checkForInitialized(); if (data == null) { return null; } ID id = extractId(data); if (id == null) { return null; } else { return queryForId(id); } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl(Con... |
@Test public void testCreateIfNotExists() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); foo1.equal = 198412893; Foo fooResult = dao.createIfNotExists(foo1); assertSame(foo1, fooResult); fooResult = dao.createIfNotExists(foo1); assertNotSame(foo1, fooResult); assertEquals(f... | @Override public T createIfNotExists(T data) throws SQLException { if (data == null) { return null; } T existing = queryForSameId(data); if (existing == null) { create(data); return data; } else { return existing; } } | BaseDaoImpl implements Dao<T, ID> { @Override public T createIfNotExists(T data) throws SQLException { if (data == null) { return null; } T existing = queryForSameId(data); if (existing == null) { create(data); return data; } else { return existing; } } } | BaseDaoImpl implements Dao<T, ID> { @Override public T createIfNotExists(T data) throws SQLException { if (data == null) { return null; } T existing = queryForSameId(data); if (existing == null) { create(data); return data; } else { return existing; } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl... | BaseDaoImpl implements Dao<T, ID> { @Override public T createIfNotExists(T data) throws SQLException { if (data == null) { return null; } T existing = queryForSameId(data); if (existing == null) { create(data); return data; } else { return existing; } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl... | BaseDaoImpl implements Dao<T, ID> { @Override public T createIfNotExists(T data) throws SQLException { if (data == null) { return null; } T existing = queryForSameId(data); if (existing == null) { create(data); return data; } else { return existing; } } protected BaseDaoImpl(Class<T> dataClass); protected BaseDaoImpl... |
@Test public void testNewInvocationContext() throws Exception { List<Annotation> empty = Collections.emptyList(); ParameterDescriptor p0 = ParameterDescriptor.create(0, String.class, empty, "name"); ParameterDescriptor p1 = ParameterDescriptor.create(1, int.class, empty, "id"); List<ParameterDescriptor> pds = Arrays.as... | public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; } | InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } re... | InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } re... | InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } re... | InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } re... |
@Test public void testQueryRawValue() throws Exception { Dao<Foo, Object> dao = createDao(Foo.class, true); assertEquals(1, dao.create(new Foo())); assertEquals(1, dao.queryRawValue("select max(" + Foo.ID_COLUMN_NAME + ") from foo")); assertEquals(1, dao.create(new Foo())); assertEquals(2, dao.queryRawValue("select max... | @Override public long queryRawValue(String query, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForLong(connection, query, arguments); } catch (SQLException e) { thro... | BaseDaoImpl implements Dao<T, ID> { @Override public long queryRawValue(String query, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForLong(connection, query, argumen... | BaseDaoImpl implements Dao<T, ID> { @Override public long queryRawValue(String query, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForLong(connection, query, argumen... | BaseDaoImpl implements Dao<T, ID> { @Override public long queryRawValue(String query, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForLong(connection, query, argumen... | BaseDaoImpl implements Dao<T, ID> { @Override public long queryRawValue(String query, String... arguments) throws SQLException { checkForInitialized(); DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName()); try { return statementExecutor.queryForLong(connection, query, argumen... |
@Test public void testStuff() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); LruObjectCache cache = new LruObjectCache(2); dao.setObjectCache(cache); Foo foo1 = new Foo(); int val = 12312321; foo1.val = val; assertEquals(1, dao.create(foo1)); assertEquals(1, cache.size(Foo.class)); Foo result = ... | @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } | LruObjectCache implements ObjectCache { @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } } | LruObjectCache implements ObjectCache { @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } LruObjectCache(int capacity); } | LruObjectCache implements ObjectCache { @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @Override T get... | LruObjectCache implements ObjectCache { @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @Override T get... |
@Test public void testClear() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); LruObjectCache cache = new LruObjectCache(2); dao.setObjectCache(cache); Foo foo = new Foo(); int val = 12312321; foo.val = val; assertEquals(1, dao.create(foo)); assertEquals(1, cache.size(Foo.class)); Foo result = dao... | @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } | LruObjectCache implements ObjectCache { @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } } | LruObjectCache implements ObjectCache { @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } LruObjectCache(int capacity); } | LruObjectCache implements ObjectCache { @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @Override T get(Class<T> clazz, ID id)... | LruObjectCache implements ObjectCache { @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @Override T get(Class<T> clazz, ID id)... |
@Test public void testContains() throws Exception { Dao<Eager, Integer> eagerDao = createDao(Eager.class, true); Dao<Foreign, Integer> foreignDao = createDao(Foreign.class, true); Eager eager = new Eager(); assertEquals(1, eagerDao.create(eager)); Foreign f0 = new Foreign(); f0.eager = eager; assertEquals(1, foreignDao... | @Override public boolean contains(Object o) { return results.contains(o); } | EagerForeignCollection extends BaseForeignCollection<T, ID> implements CloseableWrappedIterable<T>,
Serializable { @Override public boolean contains(Object o) { return results.contains(o); } } | EagerForeignCollection extends BaseForeignCollection<T, ID> implements CloseableWrappedIterable<T>,
Serializable { @Override public boolean contains(Object o) { return results.contains(o); } EagerForeignCollection(Dao<T, ID> dao, Object parent, Object parentId, FieldType foreignFieldType,
String orderColumn, boole... | EagerForeignCollection extends BaseForeignCollection<T, ID> implements CloseableWrappedIterable<T>,
Serializable { @Override public boolean contains(Object o) { return results.contains(o); } EagerForeignCollection(Dao<T, ID> dao, Object parent, Object parentId, FieldType foreignFieldType,
String orderColumn, boole... | EagerForeignCollection extends BaseForeignCollection<T, ID> implements CloseableWrappedIterable<T>,
Serializable { @Override public boolean contains(Object o) { return results.contains(o); } EagerForeignCollection(Dao<T, ID> dao, Object parent, Object parentId, FieldType foreignFieldType,
String orderColumn, boole... |
@Test(expected = IllegalArgumentException.class) public void testCreateDaoNull() throws Exception { DaoManager.createDao(null, Foo.class); } | public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSourc... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... |
@Test(expected = IllegalArgumentException.class) public void testLookupDaoNull() { DaoManager.lookupDao(null, Foo.class); } | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?>... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... |
@Test public void testLookupDaoUnknown() { assertNull(DaoManager.lookupDao(connectionSource, getClass())); } | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?>... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... |
@Test(expected = IllegalArgumentException.class) public void testCreateDaoTableNull() throws Exception { DaoManager.createDao(null, new DatabaseTableConfig<Foo>()); } | public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSourc... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... |
@Test(expected = IllegalArgumentException.class) public void testLookupDaoTableNull() { DaoManager.lookupDao(null, new DatabaseTableConfig<Foo>()); } | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?>... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... |
@Test public void testRegisterDao() throws Exception { Dao<RegisterClass, Void> dao = DaoManager.lookupDao(connectionSource, RegisterClass.class); assertNull(dao); Dao<? extends RegisterClass, Object> daoImpl = BaseDaoImpl.createDao(connectionSource, RegisterClass.class); DaoManager.registerDao(connectionSource, daoImp... | public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } synchr... | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } synchr... |
@Test public void testGetNullableBindingValue() throws Exception { DefaultInvocationContext ctx = DefaultInvocationContext.create(); UserBag userBag = new UserBag(); userBag.setName("ash"); User user = new User(); user.setUserBag(userBag); user.setId(100); ctx.addParameter("userId", 9527); ctx.addParameter("user", user... | @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterName(); if (!parameterNameToValueMap.containsKey(parameterName)) { throw... | DefaultInvocationContext implements InvocationContext { @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterName(); if (!par... | DefaultInvocationContext implements InvocationContext { @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterName(); if (!par... | DefaultInvocationContext implements InvocationContext { @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterName(); if (!par... | DefaultInvocationContext implements InvocationContext { @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterName(); if (!par... |
@Test(expected = IllegalArgumentException.class) public void testRegisterNull() { DaoManager.registerDao(null, null); } | public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } } | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } synchr... | DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); } synchr... |
@Test public void testLookupTableDaoUnknown() { assertNull(DaoManager.lookupDao(connectionSource, new DatabaseTableConfig<DaoManagerTest>(DaoManagerTest.class, new ArrayList<DatabaseFieldConfig>()))); } | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz); Dao<?, ?>... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSource, claz... |
@Test public void testDaoClassGenericDaoMethod() throws Exception { GenericDao<GenericBaz, String> bazdao = DaoManager.createDao(connectionSource, GenericBaz.class); assertSame(GenericBaz.class.getName(), bazdao.doGenericAction()); GenericDao<GenericBar, Void> bardao = DaoManager.createDao(connectionSource, GenericBar.... | public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connectionSourc... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... | DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(co... |
@Test public void testIfAllMethodsAreThere() { List<String> failedMessages = new ArrayList<String>(); List<Method> runtimeMethods = new ArrayList<Method>(Arrays.asList(RuntimeExceptionDao.class.getDeclaredMethods())); List<Method> daoMethods = new ArrayList<Method>(Arrays.asList(Dao.class.getDeclaredMethods())); daoMet... | @Override public CloseableIterator<T> iterator() { return dao.iterator(); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connec... | RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connec... |
@Test public void testCreateDao() throws Exception { createDao(Foo.class, true); RuntimeExceptionDao<Foo, String> dao = RuntimeExceptionDao.createDao(connectionSource, Foo.class); assertEquals(0, dao.countOf()); } | public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz); return new RuntimeExceptionDao<T, ID>(castDao); } | RuntimeExceptionDao implements Dao<T, ID> { public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz); return new RuntimeExceptionDao<T... | RuntimeExceptionDao implements Dao<T, ID> { public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz); return new RuntimeExceptionDao<T... | RuntimeExceptionDao implements Dao<T, ID> { public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz); return new RuntimeExceptionDao<T... | RuntimeExceptionDao implements Dao<T, ID> { public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz); return new RuntimeExceptionDao<T... |
@Test(expected = RuntimeException.class) public void testQueryForIdThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForId(isA(String.class))).andT... | @Override public T queryForId(ID id) { try { return dao.queryForId(id); } catch (SQLException e) { logMessage(e, "queryForId threw exception on: " + id); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForId(ID id) { try { return dao.queryForId(id); } catch (SQLException e) { logMessage(e, "queryForId threw exception on: " + id); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForId(ID id) { try { return dao.queryForId(id); } catch (SQLException e) { logMessage(e, "queryForId threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForId(ID id) { try { return dao.queryForId(id); } catch (SQLException e) { logMessage(e, "queryForId threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Connec... | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForId(ID id) { try { return dao.queryForId(id); } catch (SQLException e) { logMessage(e, "queryForId threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Connec... |
@Test(expected = RuntimeException.class) public void testQueryForFirstPreparedThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForFirst(null)).and... | @Override public T queryForFirst(PreparedQuery<T> preparedQuery) { try { return dao.queryForFirst(preparedQuery); } catch (SQLException e) { logMessage(e, "queryForFirst threw exception on: " + preparedQuery); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) { try { return dao.queryForFirst(preparedQuery); } catch (SQLException e) { logMessage(e, "queryForFirst threw exception on: " + preparedQuery); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) { try { return dao.queryForFirst(preparedQuery); } catch (SQLException e) { logMessage(e, "queryForFirst threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> ... | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) { try { return dao.queryForFirst(preparedQuery); } catch (SQLException e) { logMessage(e, "queryForFirst threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> ... | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForFirst(PreparedQuery<T> preparedQuery) { try { return dao.queryForFirst(preparedQuery); } catch (SQLException e) { logMessage(e, "queryForFirst threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> ... |
@Test(expected = RuntimeException.class) public void testQueryForAllThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForAll()).andThrow(new SQLExc... | @Override public List<T> queryForAll() { try { return dao.queryForAll(); } catch (SQLException e) { logMessage(e, "queryForAll threw exception"); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForAll() { try { return dao.queryForAll(); } catch (SQLException e) { logMessage(e, "queryForAll threw exception"); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForAll() { try { return dao.queryForAll(); } catch (SQLException e) { logMessage(e, "queryForAll threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForAll() { try { return dao.queryForAll(); } catch (SQLException e) { logMessage(e, "queryForAll threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSour... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForAll() { try { return dao.queryForAll(); } catch (SQLException e) { logMessage(e, "queryForAll threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSour... |
@Test(expected = RuntimeException.class) public void testQueryForEqThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForEq(null, null)).andThrow(ne... | @Override public List<T> queryForEq(String fieldName, Object value) { try { return dao.queryForEq(fieldName, value); } catch (SQLException e) { logMessage(e, "queryForEq threw exception on: " + fieldName); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) { try { return dao.queryForEq(fieldName, value); } catch (SQLException e) { logMessage(e, "queryForEq threw exception on: " + fieldName); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) { try { return dao.queryForEq(fieldName, value); } catch (SQLException e) { logMessage(e, "queryForEq threw exception on: " + fieldName); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao)... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) { try { return dao.queryForEq(fieldName, value); } catch (SQLException e) { logMessage(e, "queryForEq threw exception on: " + fieldName); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao)... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForEq(String fieldName, Object value) { try { return dao.queryForEq(fieldName, value); } catch (SQLException e) { logMessage(e, "queryForEq threw exception on: " + fieldName); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao)... |
@Test(expected = RuntimeException.class) public void testQueryForMatchingThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForMatching(null)).andTh... | @Override public List<T> queryForMatching(T matchObj) { try { return dao.queryForMatching(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatching threw exception on: " + matchObj); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) { try { return dao.queryForMatching(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatching threw exception on: " + matchObj); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) { try { return dao.queryForMatching(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatching threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) { try { return dao.queryForMatching(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatching threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Ru... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatching(T matchObj) { try { return dao.queryForMatching(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatching threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Ru... |
@Test public void testGetBindingValue() throws Exception { DefaultInvocationContext ctx = DefaultInvocationContext.create(); ctx.addParameter("userId", 9527); BindingParameterInvoker userIdInvoker = FunctionalBindingParameterInvoker.create(User.class, BindingParameter.create("userId", "", null)); assertThat(ctx.getBind... | @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } return value; } | DefaultInvocationContext implements InvocationContext { @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } return value; ... | DefaultInvocationContext implements InvocationContext { @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } return value; ... | DefaultInvocationContext implements InvocationContext { @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } return value; ... | DefaultInvocationContext implements InvocationContext { @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } return value; ... |
@Test(expected = RuntimeException.class) public void testQueryForMatchingArgsThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForMatchingArgs(null... | @Override public List<T> queryForMatchingArgs(T matchObj) { try { return dao.queryForMatchingArgs(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatchingArgs threw exception on: " + matchObj); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) { try { return dao.queryForMatchingArgs(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatchingArgs threw exception on: " + matchObj); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) { try { return dao.queryForMatchingArgs(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatchingArgs threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) { try { return dao.queryForMatchingArgs(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatchingArgs threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForMatchingArgs(T matchObj) { try { return dao.queryForMatchingArgs(matchObj); } catch (SQLException e) { logMessage(e, "queryForMatchingArgs threw exception on: " + matchObj); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao... |
@Test(expected = RuntimeException.class) public void testQueryForFieldsValuesThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForFieldValues(null)... | @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) { try { return dao.queryForFieldValues(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValues threw exception"); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) { try { return dao.queryForFieldValues(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValues threw exception"); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) { try { return dao.queryForFieldValues(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValues threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) { try { return dao.queryForFieldValues(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValues threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValues(Map<String, Object> fieldValues) { try { return dao.queryForFieldValues(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValues threw exception"); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID... |
@Test(expected = RuntimeException.class) public void testQueryForFieldsValuesArgsThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForFieldValuesAr... | @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) { try { return dao.queryForFieldValuesArgs(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValuesArgs threw exception"); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) { try { return dao.queryForFieldValuesArgs(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValuesArgs threw exception"); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) { try { return dao.queryForFieldValuesArgs(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValuesArgs threw exception"); throw new RuntimeException(e); } } RuntimeExceptionD... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) { try { return dao.queryForFieldValuesArgs(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValuesArgs threw exception"); throw new RuntimeException(e); } } RuntimeExceptionD... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues) { try { return dao.queryForFieldValuesArgs(fieldValues); } catch (SQLException e) { logMessage(e, "queryForFieldValuesArgs threw exception"); throw new RuntimeException(e); } } RuntimeExceptionD... |
@Test(expected = RuntimeException.class) public void testQueryForSameIdThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.queryForSameId(null)).andThrow(... | @Override public T queryForSameId(T data) { try { return dao.queryForSameId(data); } catch (SQLException e) { logMessage(e, "queryForSameId threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForSameId(T data) { try { return dao.queryForSameId(data); } catch (SQLException e) { logMessage(e, "queryForSameId threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForSameId(T data) { try { return dao.queryForSameId(data); } catch (SQLException e) { logMessage(e, "queryForSameId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForSameId(T data) { try { return dao.queryForSameId(data); } catch (SQLException e) { logMessage(e, "queryForSameId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID>... | RuntimeExceptionDao implements Dao<T, ID> { @Override public T queryForSameId(T data) { try { return dao.queryForSameId(data); } catch (SQLException e) { logMessage(e, "queryForSameId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID>... |
@Test(expected = RuntimeException.class) public void testQueryThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.query(null)).andThrow(new SQLException("... | @Override public List<T> query(PreparedQuery<T> preparedQuery) { try { return dao.query(preparedQuery); } catch (SQLException e) { logMessage(e, "query threw exception on: " + preparedQuery); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) { try { return dao.query(preparedQuery); } catch (SQLException e) { logMessage(e, "query threw exception on: " + preparedQuery); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) { try { return dao.query(preparedQuery); } catch (SQLException e) { logMessage(e, "query threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) { try { return dao.query(preparedQuery); } catch (SQLException e) { logMessage(e, "query threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Runti... | RuntimeExceptionDao implements Dao<T, ID> { @Override public List<T> query(PreparedQuery<T> preparedQuery) { try { return dao.query(preparedQuery); } catch (SQLException e) { logMessage(e, "query threw exception on: " + preparedQuery); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Runti... |
@Test(expected = RuntimeException.class) public void testCreateThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.create((Foo) null)).andThrow(new SQLExc... | @Override public int create(T data) { try { return dao.create(data); } catch (SQLException e) { logMessage(e, "create threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int create(T data) { try { return dao.create(data); } catch (SQLException e) { logMessage(e, "create threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int create(T data) { try { return dao.create(data); } catch (SQLException e) { logMessage(e, "create threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int create(T data) { try { return dao.create(data); } catch (SQLException e) { logMessage(e, "create threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int create(T data) { try { return dao.create(data); } catch (SQLException e) { logMessage(e, "create threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... |
@Test(expected = RuntimeException.class) public void testCreateIfNotExistsThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.createIfNotExists(null)).and... | @Override public T createIfNotExists(T data) { try { return dao.createIfNotExists(data); } catch (SQLException e) { logMessage(e, "createIfNotExists threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T createIfNotExists(T data) { try { return dao.createIfNotExists(data); } catch (SQLException e) { logMessage(e, "createIfNotExists threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T createIfNotExists(T data) { try { return dao.createIfNotExists(data); } catch (SQLException e) { logMessage(e, "createIfNotExists threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public T createIfNotExists(T data) { try { return dao.createIfNotExists(data); } catch (SQLException e) { logMessage(e, "createIfNotExists threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionD... | RuntimeExceptionDao implements Dao<T, ID> { @Override public T createIfNotExists(T data) { try { return dao.createIfNotExists(data); } catch (SQLException e) { logMessage(e, "createIfNotExists threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionD... |
@Test(expected = RuntimeException.class) public void testCreateOrUpdateThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.createOrUpdate(null)).andThrow(... | @Override public CreateOrUpdateStatus createOrUpdate(T data) { try { return dao.createOrUpdate(data); } catch (SQLException e) { logMessage(e, "createOrUpdate threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) { try { return dao.createOrUpdate(data); } catch (SQLException e) { logMessage(e, "createOrUpdate threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) { try { return dao.createOrUpdate(data); } catch (SQLException e) { logMessage(e, "createOrUpdate threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) { try { return dao.createOrUpdate(data); } catch (SQLException e) { logMessage(e, "createOrUpdate threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Runtime... | RuntimeExceptionDao implements Dao<T, ID> { @Override public CreateOrUpdateStatus createOrUpdate(T data) { try { return dao.createOrUpdate(data); } catch (SQLException e) { logMessage(e, "createOrUpdate threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static Runtime... |
@Test(expected = RuntimeException.class) public void testUpdateThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.update((Foo) null)).andThrow(new SQLExc... | @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... |
@Test(expected = RuntimeException.class) public void testUpdateIdThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.updateId(null, null)).andThrow(new SQ... | @Override public int updateId(T data, ID newId) { try { return dao.updateId(data, newId); } catch (SQLException e) { logMessage(e, "updateId threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateId(T data, ID newId) { try { return dao.updateId(data, newId); } catch (SQLException e) { logMessage(e, "updateId threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateId(T data, ID newId) { try { return dao.updateId(data, newId); } catch (SQLException e) { logMessage(e, "updateId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateId(T data, ID newId) { try { return dao.updateId(data, newId); } catch (SQLException e) { logMessage(e, "updateId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateId(T data, ID newId) { try { return dao.updateId(data, newId); } catch (SQLException e) { logMessage(e, "updateId threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID... |
@Test public void testSetBindingValue() throws Exception { DefaultInvocationContext ctx = DefaultInvocationContext.create(); ctx.addParameter("userId", 9527); BindingParameterInvoker userIdInvoker = FunctionalBindingParameterInvoker.create(User.class, BindingParameter.create("userId", "", null)); assertThat(ctx.getBind... | @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } | DefaultInvocationContext implements InvocationContext { @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } } | DefaultInvocationContext implements InvocationContext { @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } private DefaultInvocationContext(); } | DefaultInvocationContext implements InvocationContext { @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } private DefaultInvocationContext(); static DefaultInvocationContext create(); @Override void addParameter(String par... | DefaultInvocationContext implements InvocationContext { @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } private DefaultInvocationContext(); static DefaultInvocationContext create(); @Override void addParameter(String par... |
@Test(expected = RuntimeException.class) public void testUpdatePreparedThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.update((PreparedUpdate<Foo>) nu... | @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int update(T data) { try { return dao.update(data); } catch (SQLException e) { logMessage(e, "update threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... |
@Test(expected = RuntimeException.class) public void testRefreshThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.refresh(null)).andThrow(new SQLExcepti... | @Override public int refresh(T data) { try { return dao.refresh(data); } catch (SQLException e) { logMessage(e, "refresh threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int refresh(T data) { try { return dao.refresh(data); } catch (SQLException e) { logMessage(e, "refresh threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int refresh(T data) { try { return dao.refresh(data); } catch (SQLException e) { logMessage(e, "refresh threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int refresh(T data) { try { return dao.refresh(data); } catch (SQLException e) { logMessage(e, "refresh threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Connecti... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int refresh(T data) { try { return dao.refresh(data); } catch (SQLException e) { logMessage(e, "refresh threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Connecti... |
@Test(expected = RuntimeException.class) public void testDeleteThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.delete((Foo) null)).andThrow(new SQLExc... | @Override public int delete(T data) { try { return dao.delete(data); } catch (SQLException e) { logMessage(e, "delete threw exception on: " + data); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int delete(T data) { try { return dao.delete(data); } catch (SQLException e) { logMessage(e, "delete threw exception on: " + data); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int delete(T data) { try { return dao.delete(data); } catch (SQLException e) { logMessage(e, "delete threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int delete(T data) { try { return dao.delete(data); } catch (SQLException e) { logMessage(e, "delete threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int delete(T data) { try { return dao.delete(data); } catch (SQLException e) { logMessage(e, "delete threw exception on: " + data); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionS... |
@Test(expected = RuntimeException.class) public void testDeleteByIdThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.deleteById(null)).andThrow(new SQLE... | @Override public int deleteById(ID id) { try { return dao.deleteById(id); } catch (SQLException e) { logMessage(e, "deleteById threw exception on: " + id); throw new RuntimeException(e); } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int deleteById(ID id) { try { return dao.deleteById(id); } catch (SQLException e) { logMessage(e, "deleteById threw exception on: " + id); throw new RuntimeException(e); } } } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int deleteById(ID id) { try { return dao.deleteById(id); } catch (SQLException e) { logMessage(e, "deleteById threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); } | RuntimeExceptionDao implements Dao<T, ID> { @Override public int deleteById(ID id) { try { return dao.deleteById(id); } catch (SQLException e) { logMessage(e, "deleteById threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Conn... | RuntimeExceptionDao implements Dao<T, ID> { @Override public int deleteById(ID id) { try { return dao.deleteById(id); } catch (SQLException e) { logMessage(e, "deleteById threw exception on: " + id); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(Conn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.