/** * Pass through to {@link StagingDatabase}, replacing the namespace with the transaction * namespace. */ @Override public void removeConflict(@Nullable String namespace, String path) { database.removeConflict(txNamespace, path); }
conflictsDatabase().removeConflict(null, pattern); } else { repository.index().stage(subProgress((1.f / patterns.size()) * 100.f), diff,
conflictsDatabase().removeConflict(null, pattern); } else { repository.index().stage(subProgress((1.f / patterns.size()) * 100.f), diff,
/** * Pass through to {@link StagingDatabase}, replacing the namespace with the transaction * namespace. */ @Override public void removeConflict(@Nullable String namespace, String path) { database.removeConflict(txNamespace, path); }
@Test public void removeConflictExecutionException() throws SQLException { when(mockSource.getConnection().prepareStatement(anyString())) .thenThrow(new SQLException("propagate this message")); try { mockSourceConflicts.removeConflict(null, c1.getPath()); fail("expected RTE"); } catch (RuntimeException e) { assertTrue(e.getMessage().contains("propagate this message")); } verify(mockConnection, times(1)).setAutoCommit(eq(false)); verify(mockConnection, times(1)).rollback(); verify(mockConnection, times(1)).setAutoCommit(eq(true)); }
@Test public void removeConflictConnectException() throws SQLException { when(mockSource.getConnection()).thenThrow(new SQLException("connection error")); expected.expect(RuntimeException.class); expected.expectMessage("connection error"); mockSourceConflicts.removeConflict(null, c1.getPath()); }
@Test public void testRemoveConflict() { final String ns = UUID.randomUUID().toString(); add(null, c1, c3); add(ns, c2, c3); conflicts.removeConflict(ns, c1.getPath()); assertEquals(c1, conflicts.getConflict(null, c1.getPath()).get()); conflicts.removeConflict(null, c1.getPath()); assertFalse(conflicts.getConflict(null, c1.getPath()).isPresent()); assertFalse(conflicts.getConflict(ns, c1.getPath()).isPresent()); conflicts.removeConflict(null, c2.getPath()); assertEquals(c2, conflicts.getConflict(ns, c2.getPath()).get()); conflicts.removeConflict(ns, c2.getPath()); assertFalse(conflicts.getConflict(null, c2.getPath()).isPresent()); assertFalse(conflicts.getConflict(ns, c2.getPath()).isPresent()); assertTrue(conflicts.hasConflicts(null)); assertTrue(conflicts.hasConflicts(ns)); conflicts.removeConflict(null, c3.getPath()); assertFalse(conflicts.hasConflicts(null)); conflicts.removeConflict(ns, c3.getPath()); assertFalse(conflicts.hasConflicts(ns)); }
@Test public void testRemoveConflict() { final String ns = UUID.randomUUID().toString(); add(null, c1, c3); add(ns, c2, c3); conflicts.removeConflict(ns, c1.getPath()); assertEquals(c1, conflicts.getConflict(null, c1.getPath()).get()); conflicts.removeConflict(null, c1.getPath()); assertFalse(conflicts.getConflict(null, c1.getPath()).isPresent()); assertFalse(conflicts.getConflict(ns, c1.getPath()).isPresent()); conflicts.removeConflict(null, c2.getPath()); assertEquals(c2, conflicts.getConflict(ns, c2.getPath()).get()); conflicts.removeConflict(ns, c2.getPath()); assertFalse(conflicts.getConflict(null, c2.getPath()).isPresent()); assertFalse(conflicts.getConflict(ns, c2.getPath()).isPresent()); assertTrue(conflicts.hasConflicts(null)); assertTrue(conflicts.hasConflicts(ns)); conflicts.removeConflict(null, c3.getPath()); assertFalse(conflicts.hasConflicts(null)); conflicts.removeConflict(ns, c3.getPath()); assertFalse(conflicts.hasConflicts(ns)); }