@Test public void testSmellIdQuery() { List<Map<String, Object>> result; result = persistence.query(queries.smellIdQuery(projectId, smell)); assertTrue(result.isEmpty()); Smell anotherSmellType = new Smell("MIM", smell.instance, smell.file); executeSuccess(queries.smellInsertionStatement(projectId, smell)); result = persistence.query(queries.smellIdQuery(projectId, anotherSmellType)); assertTrue(result.isEmpty()); result = persistence.query(queries.smellIdQuery(projectId, smell)); assertFalse(result.isEmpty()); assertEquals(1, result.get(0).get("id")); smell.parent = anotherSmellType; result = persistence.query(queries.smellIdQuery(projectId, smell)); assertTrue(result.isEmpty()); anotherSmellType.id = createSmell(projectId, anotherSmellType, queries); executeSuccess(queries.smellInsertionStatement(projectId, smell)); result = persistence.query(queries.smellIdQuery(projectId, anotherSmellType)); assertFalse(result.isEmpty()); assertEquals(2, result.get(0).get("id")); result = persistence.query(queries.smellIdQuery(projectId, smell)); assertFalse(result.isEmpty()); assertEquals(3, result.get(0).get("id")); executeNothinhDone(queries.smellInsertionStatement(projectId, smell)); }
@Override public String smellIdQuery(int projectId, Smell smell) { String parentQuery = null; if (smell.parent != null) { if (smell.parent.id > -1) { parentQuery = String.valueOf(smell.parent.id); } else { parentQuery = "(" + smellIdQuery(projectId, smell.parent) + ")"; } } return smellIdQuery(projectId, smell.instance, smell.file, smell.type, parentQuery); }
JDBCSmellQueries extends JDBCQueriesHelper implements SmellQueries { @Override public String smellIdQuery(int projectId, Smell smell) { String parentQuery = null; if (smell.parent != null) { if (smell.parent.id > -1) { parentQuery = String.valueOf(smell.parent.id); } else { parentQuery = "(" + smellIdQuery(projectId, smell.parent) + ")"; } } return smellIdQuery(projectId, smell.instance, smell.file, smell.type, parentQuery); } }
JDBCSmellQueries extends JDBCQueriesHelper implements SmellQueries { @Override public String smellIdQuery(int projectId, Smell smell) { String parentQuery = null; if (smell.parent != null) { if (smell.parent.id > -1) { parentQuery = String.valueOf(smell.parent.id); } else { parentQuery = "(" + smellIdQuery(projectId, smell.parent) + ")"; } } return smellIdQuery(projectId, smell.instance, smell.file, smell.type, parentQuery); } JDBCSmellQueries(CommitQueries commitQueries); }
JDBCSmellQueries extends JDBCQueriesHelper implements SmellQueries { @Override public String smellIdQuery(int projectId, Smell smell) { String parentQuery = null; if (smell.parent != null) { if (smell.parent.id > -1) { parentQuery = String.valueOf(smell.parent.id); } else { parentQuery = "(" + smellIdQuery(projectId, smell.parent) + ")"; } } return smellIdQuery(projectId, smell.instance, smell.file, smell.type, parentQuery); } JDBCSmellQueries(CommitQueries commitQueries); @Override String smellInsertionStatement(int projectId, Smell smell); @Override String smellCategoryInsertionStatement(int projectId, String sha1, Smell smell, SmellCategory category); @Override String lostSmellCategoryInsertionStatement(int projectId, Smell smell, SmellCategory category, int since, int until); @Override String smellIdQuery(int projectId, Smell smell); @Override String commitSmellsQuery(int projectId, String commitId, String smellType); String lastSmellIdQuery(int projectId); String allRefactoredInstancesWithSha1(int projectId); String setAsDeleted(int projectId, int refactoringId, boolean deleted); }
JDBCSmellQueries extends JDBCQueriesHelper implements SmellQueries { @Override public String smellIdQuery(int projectId, Smell smell) { String parentQuery = null; if (smell.parent != null) { if (smell.parent.id > -1) { parentQuery = String.valueOf(smell.parent.id); } else { parentQuery = "(" + smellIdQuery(projectId, smell.parent) + ")"; } } return smellIdQuery(projectId, smell.instance, smell.file, smell.type, parentQuery); } JDBCSmellQueries(CommitQueries commitQueries); @Override String smellInsertionStatement(int projectId, Smell smell); @Override String smellCategoryInsertionStatement(int projectId, String sha1, Smell smell, SmellCategory category); @Override String lostSmellCategoryInsertionStatement(int projectId, Smell smell, SmellCategory category, int since, int until); @Override String smellIdQuery(int projectId, Smell smell); @Override String commitSmellsQuery(int projectId, String commitId, String smellType); String lastSmellIdQuery(int projectId); String allRefactoredInstancesWithSha1(int projectId); String setAsDeleted(int projectId, int refactoringId, boolean deleted);  }