@Test public void generateCheckSum() throws Exception { Change change = createClassUnderTest(); if (change == null) { return; } CheckSum checkSum = change.generateCheckSum(); assertNotNull(checkSum); assertEquals(CheckSum.getCurrentVersion(), checkSum.getVersion()); assertTrue(checkSum.toString().startsWith(CheckSum.getCurrentVersion()+":")); Map<String, String> seenCheckSums = new HashMap<String, String>(); for (Field field : change.getClass().getDeclaredFields()) { field.setAccessible(true); if (field.getName().startsWith("$VR") || field.getName().equals("serialVersionUID")) { } else if (field.getName().equals("associatedWith")) { } else if (String.class.isAssignableFrom(field.getType())) { field.set(change, "asdghasdgasdg"); checkThatChecksumIsNew(change, seenCheckSums, field); field.set(change, "gsgasdgasdggasdg sdg a"); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (Boolean.class.isAssignableFrom(field.getType())) { field.set(change, Boolean.TRUE); checkThatChecksumIsNew(change, seenCheckSums, field); field.set(change, Boolean.FALSE); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (Integer.class.isAssignableFrom(field.getType())) { field.set(change, 6532); checkThatChecksumIsNew(change, seenCheckSums, field); field.set(change, -52352); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (DatabaseFunction.class.isAssignableFrom(field.getType())) { field.set(change, new DatabaseFunction("FUNC1")); checkThatChecksumIsNew(change, seenCheckSums, field); field.set(change, new DatabaseFunction("FUNC 2")); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (BigInteger.class.isAssignableFrom(field.getType())) { field.set(change, new BigInteger("6532")); checkThatChecksumIsNew(change, seenCheckSums, field); field.set(change, new BigInteger("-52352")); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (List.class.isAssignableFrom(field.getType())) { ColumnConfig column1 = new ColumnConfig(); ((List) field.get(change)).add(column1); column1.setName("ghsdgasdg"); checkThatChecksumIsNew(change, seenCheckSums, field); column1.setType("gasdgasdg"); checkThatChecksumIsNew(change, seenCheckSums, field); ColumnConfig column2 = new ColumnConfig(); ((List) field.get(change)).add(column2); column2.setName("87682346asgasdg"); checkThatChecksumIsNew(change, seenCheckSums, field); } else if (field.getName().equalsIgnoreCase("changeLogParameters")) { } else { throw new RuntimeException("Unknown field type: "+field.getType()+" for "+field.getName()); } } }
public CheckSum generateCheckSum() { return CheckSum.compute(new StringChangeLogSerializer().serialize(this)); }
AbstractChange implements Change { public CheckSum generateCheckSum() { return CheckSum.compute(new StringChangeLogSerializer().serialize(this)); } }
AbstractChange implements Change { public CheckSum generateCheckSum() { return CheckSum.compute(new StringChangeLogSerializer().serialize(this)); } protected  AbstractChange(String changeName, String changeDescription, int priority); }
AbstractChange implements Change { public CheckSum generateCheckSum() { return CheckSum.compute(new StringChangeLogSerializer().serialize(this)); } protected  AbstractChange(String changeName, String changeDescription, int priority); ChangeMetaData getChangeMetaData(); ChangeSet getChangeSet(); void setChangeSet(ChangeSet changeSet); boolean requiresUpdatedDatabaseMetadata(Database database); boolean supports(Database database); Warnings warn(Database database); ValidationErrors validate(Database database); SqlStatement[] generateRollbackStatements(Database database); boolean supportsRollback(Database database); CheckSum generateCheckSum(); void setResourceAccessor(ResourceAccessor resourceAccessor); ResourceAccessor getResourceAccessor(); void init(); Set<DatabaseObject> getAffectedDatabaseObjects(Database database); void setChangeLogParameters(ChangeLogParameters changeLogParameters); }
AbstractChange implements Change { public CheckSum generateCheckSum() { return CheckSum.compute(new StringChangeLogSerializer().serialize(this)); } protected  AbstractChange(String changeName, String changeDescription, int priority); ChangeMetaData getChangeMetaData(); ChangeSet getChangeSet(); void setChangeSet(ChangeSet changeSet); boolean requiresUpdatedDatabaseMetadata(Database database); boolean supports(Database database); Warnings warn(Database database); ValidationErrors validate(Database database); SqlStatement[] generateRollbackStatements(Database database); boolean supportsRollback(Database database); CheckSum generateCheckSum(); void setResourceAccessor(ResourceAccessor resourceAccessor); ResourceAccessor getResourceAccessor(); void init(); Set<DatabaseObject> getAffectedDatabaseObjects(Database database); void setChangeLogParameters(ChangeLogParameters changeLogParameters);  }