@Test
public void makeSureStoreIdIsEnforced() throws Exception
{
// Create data set X on server A
DbRepresentation initialDataSetRepresentation = createInitialDataSet( serverPath );
ServerInterface server = startServer( serverPath );
// Grab initial backup from server A
OnlineBackup backup = OnlineBackup.from( "localhost" );
backup.full( backupPath );
assertEquals( initialDataSetRepresentation, DbRepresentation.of( backupPath ) );
shutdownServer( server );
// Create data set X+Y on server B
createInitialDataSet( otherServerPath );
addMoreData( otherServerPath );
server = startServer( otherServerPath );
// Try to grab incremental backup from server B.
// Data should be OK, but store id check should prevent that.
try
{
backup.incremental( backupPath );
fail( "Shouldn't work" );
}
catch ( ComException e )
{ // Good
}
shutdownServer( server );
// Just make sure incremental backup can be received properly from
// server A, even after a failed attempt from server B
DbRepresentation furtherRepresentation = addMoreData( serverPath );
server = startServer( serverPath );
backup.incremental( backupPath );
assertEquals( furtherRepresentation, DbRepresentation.of( backupPath ) );
shutdownServer( server );
}