Skip to content

Commit

Permalink
Fixed unit test so that multiple runs won't invalidate the results
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Apr 22, 2008
1 parent 8cdb5b3 commit 53fbce4
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -25,6 +25,7 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down Expand Up @@ -138,17 +139,18 @@ public void validateTestTableTriggers() throws Exception {
assert match : "Received " + csvString + ", Expected the string to end with " + EXPECTED_INSERT1_CSV_ENDSWITH;
}

@SuppressWarnings("unchecked")
@Test(groups = "continuous", dependsOnMethods = "validateTestTableTriggers")
public void testInitialLoadSql() throws Exception {
IConfigurationService service = (IConfigurationService) getSymmetricEngine().getApplicationContext().getBean(
"configurationService");
service.getTriggerFor(TEST_TRIGGERS_TABLE, TestConstants.TEST_ROOT_NODE_GROUP);
String sql = getDbDialect(getSymmetricEngine()).createInitalLoadSqlFor(new Node("1", null, "1.0"),
service.getTriggerFor(TEST_TRIGGERS_TABLE, TestConstants.TEST_ROOT_NODE_GROUP));
String csvString = (String) getJdbcTemplate(getSymmetricEngine()).queryForObject(sql, String.class);
boolean match = false;
match = csvString.endsWith(EXPECTED_INSERT1_CSV_ENDSWITH);
assert match : "Received " + csvString + ", Expected the string to end with " + EXPECTED_INSERT1_CSV_ENDSWITH;
List<String> csvStrings = getJdbcTemplate(getSymmetricEngine()).queryForList(sql, String.class);
Assert.assertTrue(csvStrings.size() > 0);
String csvString = csvStrings.get(0);
Assert.assertTrue(csvString.endsWith(EXPECTED_INSERT1_CSV_ENDSWITH), "Received " + csvString + ", Expected the string to end with " + EXPECTED_INSERT1_CSV_ENDSWITH);
}

@Test(groups = "continuous", dependsOnMethods = "testInitialLoadSql")
Expand Down

0 comments on commit 53fbce4

Please sign in to comment.