View Javadoc

1   package liquibase.statementexecute;
2   
3   import liquibase.statement.SqlStatement;
4   import liquibase.statement.core.CreateDatabaseChangeLogLockTableStatement;
5   import liquibase.statement.core.UnlockDatabaseChangeLogStatement;
6   import liquibase.database.Database;
7   import liquibase.database.core.H2Database;
8   import liquibase.database.core.HsqlDatabase;
9   import liquibase.database.core.InformixDatabase;
10  import liquibase.database.core.MSSQLDatabase;
11  import liquibase.database.core.MaxDBDatabase;
12  import liquibase.database.core.PostgresDatabase;
13  
14  import java.util.List;
15  import java.util.Arrays;
16  
17  import org.junit.Test;
18  
19  public class UnlockDatabaseChangeLogExecuteTest extends AbstractExecuteTest {
20      @Override
21      protected List<? extends SqlStatement> setupStatements(Database database) {
22          return Arrays.asList(new CreateDatabaseChangeLogLockTableStatement());
23      }
24      
25      @Test
26      public void generateSql() throws Exception {
27          this.statementUnderTest = new UnlockDatabaseChangeLogStatement();
28          assertCorrect("update [dbo].[databasechangeloglock] set [locked] = 0, [lockedby] = null, [lockgranted] = null where [id] = 1", MSSQLDatabase.class);
29          assertCorrect("update [databasechangeloglock] set [locked] = 'f', [lockedby] = null, [lockgranted] = null where [id] = 1", InformixDatabase.class);
30          assertCorrect("update [databasechangeloglock] set [locked] = false, [lockedby] = null, [lockgranted] = null where [id] = 1", PostgresDatabase.class, HsqlDatabase.class, H2Database.class, MaxDBDatabase.class);
31          assertCorrectOnRest("update [databasechangeloglock] set [locked] = 0, [lockedby] = null, [lockgranted] = null where [id] = 1");
32      }
33  }