void breakIt(BreakMode breakMode, String operation) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException { if (breakMode == BreakMode.NONE) { return; } else if (breakMode == BreakMode.NETWORK) { throw new ConnectException("Network error (simulated error)"); } else if (breakMode == BreakMode.IO) { throw new FileNotFoundException("IO error (simulated error)"); } else if (breakMode == BreakMode.SCHEMA) { throw new SchemaViolationException("Schema violation (simulated error)"); } else if (breakMode == BreakMode.CONFLICT) { throw new ConflictException("Conflict (simulated error)"); } else if (breakMode == BreakMode.GENERIC) { // The connector will react with generic exception throw new IllegalArgumentException("Generic error (simulated error)"); } else if (breakMode == BreakMode.RUNTIME) { // The connector will just pass this up throw new IllegalStateException("Generic error (simulated error)"); } else if (breakMode == BreakMode.UNSUPPORTED) { throw new UnsupportedOperationException("Not supported (simulated error)"); } else if (breakMode == BreakMode.ASSERTION_ERROR) { throw new AssertionError("Assertion error"); } else { // This is a real error. Use this strange thing to make sure it passes up throw new RuntimeException("Unknown "+operation+" break mode "+getBreakMode); } }
throw new ConnectorIOException(e.getMessage(), e); } catch (ConflictException e) { log.error(e, e.getMessage()); throw new AlreadyExistsException(e); } catch (InterruptedException e) {
throw new SchemaViolationException("Schema violation (simulated error)"); } else if (modifyBreakMode == BreakMode.CONFLICT) { throw new ConflictException("Conflict (simulated error)"); } else if (modifyBreakMode == BreakMode.GENERIC) {