Package com.dbdeploy.scripts

Examples of com.dbdeploy.scripts.ChangeScript


    assertEquals("1, 2, 4, 7..10, 12", prettyPrinter.format(Arrays.asList(1L, 2L, 4L, 7L, 8L, 9L, 10L, 12L)));
  }

  @Test
  public void canFormatAChangeScriptList() throws Exception {
    ChangeScript change1 = new ChangeScript(1);
    ChangeScript change3 = new ChangeScript(3);
    assertEquals("1, 3", prettyPrinter.formatChangeScriptList(Arrays.asList(change1, change3)));
  }
View Full Code Here


    @Before
  public void setUp() {
    controller = new Controller(availableChangeScriptsProvider, appliedChangesProvider, applier, undoApplier);

    change1 = new ChangeScript(1);
    change2 = new ChangeScript(2);
    change3 = new ChangeScript(3);

        when(availableChangeScriptsProvider.getAvailableChangeScripts())
        .thenReturn(Arrays.asList(change1, change2, change3));
  }
View Full Code Here

public class ChangeScriptRepositoryTest {

  @Test
  public void shouldReturnAnOrderedListOfChangeScripts() throws Exception {
    ChangeScript one = new ChangeScript(1);
    ChangeScript two = new ChangeScript(2);
    ChangeScript three = new ChangeScript(3);
    ChangeScript four = new ChangeScript(4);
   
    ChangeScriptRepository repository = new ChangeScriptRepository(Arrays.asList( three, two, four, one ));
   
    List<ChangeScript> list = repository.getOrderedListOfDoChangeScripts();
    assertThat(4, equalTo(list.size()));
View Full Code Here

    assertSame(four, list.get(3));
  }
 
  @Test
  public void shouldThrowWhenChangeScriptListContainsDuplicates() throws Exception {
    ChangeScript two = new ChangeScript(2);
    ChangeScript three = new ChangeScript(3);
    ChangeScript anotherTwo = new ChangeScript(2);
   
    try {
      new ChangeScriptRepository(Arrays.asList(three, two, anotherTwo));
      fail("expected exception");
    } catch (DuplicateChangeScriptException ex) {
View Full Code Here

    }
  }

  @Test
    public void shouldAllowChangeScriptsThatStartFromZero() throws Exception {
        ChangeScript zero = new ChangeScript(0);
        ChangeScript four = new ChangeScript(4);

        ChangeScriptRepository repository = new ChangeScriptRepository(Arrays.asList( zero, four ));

        List<ChangeScript> list = repository.getOrderedListOfDoChangeScripts();
        assertThat(2, equalTo(list.size()));
View Full Code Here

  }

  @Test
  public void shouldRethrowSqlExceptionsWithInformationAboutWhatStringFailed() throws Exception {
    when(splitter.split("split; content")).thenReturn(Arrays.asList("split", "content"));
    ChangeScript script = new StubChangeScript(1, "script", "split; content");

    doThrow(new SQLException("dummy exception")).when(queryExecuter).execute("split");

    try {
      applier.applyChangeScript(script);
View Full Code Here

    verify(queryExecuter, never()).execute("content");
  }

  @Test
  public void shouldInsertToSchemaVersionTable() throws Exception {
    ChangeScript changeScript = new ChangeScript(1, "script.sql");

    applier.insertToSchemaVersionTable(changeScript);

        verify(schemaVersionManager).recordScriptApplied(changeScript);
View Full Code Here

  private void runIntegratedTestAndConfirmOutputResults(String syntaxName) throws Exception {

    StringWriter writer = new StringWriter();

    ChangeScript changeOne = new StubChangeScript(1, "001_change.sql", "-- contents of change script 1");
    ChangeScript changeTwo = new StubChangeScript(2, "002_change.sql", "-- contents of change script 2");

    List<ChangeScript> changeScripts = Arrays.asList(changeOne, changeTwo);
    ChangeScriptRepository changeScriptRepository = new ChangeScriptRepository(changeScripts);

View Full Code Here

TOP

Related Classes of com.dbdeploy.scripts.ChangeScript

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.