target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testOpen_exception() { doReturn(Single.error(new IOException())).when(rxShell).open(); RxCmdShell rxCmdShell = new RxCmdShell(builder, rxShell); rxCmdShell.open().test().awaitDone(1, TimeUnit.SECONDS).assertError(IOException.class); verify(rxShell).open(); verify(rxShellSession, never()).outputLines()...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Override public ...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
@Test public void testCancel() { RxCmdShell shell = new RxCmdShell(builder, rxShell); RxCmdShell.Session session1 = shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().values().get(0); session1.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(true); session1.cancel().test().a...
public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); }
RxCmdShell { public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); } }
RxCmdShell { public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell);...
RxCmdShell { public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell);...
RxCmdShell { public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell);...
@Test public void testClose() throws IOException { RxCmdShell shell = new RxCmdShell(builder, rxShell); RxCmdShell.Session session1 = shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().values().get(0); session1.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(true); session1...
public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); }
RxCmdShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); } }
RxCmdShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell); }
RxCmdShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell); syn...
RxCmdShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); } @SuppressWarnings("unused") private RxCmdShell(); RxCmdShell(Builder builder, RxShell rxShell); syn...
@Test public void testReinit_exception() { RxCmdShell shell = new RxCmdShell(builder, rxShell); doReturn(Single.error(new IOException())).when(rxShell).open(); shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertError(IOException.class); doReturn(Single.just(rxShellSession)).when(rxShell).open(); shell.open().test...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Override public ...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
@Test public void testEnvironmentSetting() throws IOException { final HashMap<String, String> envMap = new HashMap<>(); envMap.put("key", "value"); when(builder.getEnvironment()).thenReturn(envMap); RxCmdShell shell = new RxCmdShell(builder, rxShell); shell.open().test().awaitCount(1).assertNoErrors(); verify(rxShellSe...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Override public ...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
@Test public void testWaitFor() throws InterruptedException { RxCmdShell shell = new RxCmdShell(builder, rxShell); RxCmdShell.Session session = shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().values().get(0); assertThat(session.waitFor().test().await(1, TimeUnit.SECONDS), is(false)); waitForEmitter....
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Override public ...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
RxCmdShell { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { session = Single .create((SingleOnSubscribe<Session>) emitter -> rxShell.open().subscribe(new SingleObserver<RxShell.Session>() { @Override public void onSubscribe(Disposable d) { } @Ove...
@Test public void testIsIdle() { processor.isIdle().test().assertValueCount(1).assertNotComplete().assertValue(true); processor.attach(session); processor.isIdle().test().assertValueCount(1).assertNotComplete().assertValue(true); processor.submit(Cmd.builder("sleep 400").build()).subscribe(); await().atMost(1, TimeUnit...
public Observable<Boolean> isIdle() { return idlePub.doOnEach(n -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("isIdle: %s", n);}); }
CmdProcessor { public Observable<Boolean> isIdle() { return idlePub.doOnEach(n -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("isIdle: %s", n);}); } }
CmdProcessor { public Observable<Boolean> isIdle() { return idlePub.doOnEach(n -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("isIdle: %s", n);}); } CmdProcessor(Harvester.Factory factory); }
CmdProcessor { public Observable<Boolean> isIdle() { return idlePub.doOnEach(n -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("isIdle: %s", n);}); } CmdProcessor(Harvester.Factory factory); Single<Cmd.Result> submit(Cmd cmd); synchronized void attach(RxShell.Session session); Observable<Boolean> isIdle(); }
CmdProcessor { public Observable<Boolean> isIdle() { return idlePub.doOnEach(n -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("isIdle: %s", n);}); } CmdProcessor(Harvester.Factory factory); Single<Cmd.Result> submit(Cmd cmd); synchronized void attach(RxShell.Session session); Observable<Boolean> isIdle(); }
@Test public void testEqualsHash() { final SuApp app1 = new SuApp(SuBinary.Type.NONE, "pkg", "vname", 1, "/path"); final SuApp app2 = new SuApp(SuBinary.Type.NONE, "pkg", "vname", 1, "/path"); final SuApp app3 = new SuApp(SuBinary.Type.NONE, "", "vname", 1, "/path"); assertThat(app1, is(app2)); assertThat(app2, is(not(...
@Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (versionName != null ? versionName.hashCode() : 0); result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0); result = 31 * result + (apkPath...
SuApp { @Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (versionName != null ? versionName.hashCode() : 0); result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0); result = 31 * result + ...
SuApp { @Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (versionName != null ? versionName.hashCode() : 0); result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0); result = 31 * result + ...
SuApp { @Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (versionName != null ? versionName.hashCode() : 0); result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0); result = 31 * result + ...
SuApp { @Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (versionName != null ? versionName.hashCode() : 0); result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0); result = 31 * result + ...
@Test public void testKill() { ApiWrap.setSDKInt(26); when(processtoKill.isAlive()).thenReturn(true); when(processtoKill.toString()).thenReturn("Process[pid=1234, hasExited=false]"); ProcessKiller killer = new RootKiller(processFactory); psProcess.addCmdListener(line -> { if (line.startsWith("ps")) { psProcess.printDat...
public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matcher(process.toString()); if (!matcher.ma...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
@Test public void testKill_dontKillTheDead() throws IOException { ApiWrap.setSDKInt(26); when(processtoKill.isAlive()).thenReturn(false); ProcessKiller killer = new RootKiller(processFactory); assertThat(killer.kill(processtoKill), is(true)); verify(processFactory, never()).start(any()); }
public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matcher(process.toString()); if (!matcher.ma...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
@Test public void testKill_cantFindProcessPid() throws IOException { ApiWrap.setSDKInt(26); when(processtoKill.isAlive()).thenReturn(true); ProcessKiller killer = new RootKiller(processFactory); when(processtoKill.toString()).thenReturn(""); assertThat(psProcess.getLastCommandRaw(), is(nullValue())); assertThat(killer....
public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matcher(process.toString()); if (!matcher.ma...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
RootKiller implements ProcessKiller { public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } Matcher matcher = PID_PATTERN.matche...
@Test public void testOpen() { RxProcess rxProcess = new RxProcess(processFactory, processKiller, "sh"); rxProcess.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertValue(false); TestObserver<RxProcess.Session> sessionObs = rxProcess.open().test().awaitCount(1).assertNoErrors().assertComplete(); rxProcess.isAlive()...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinally((Action) ...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
@Test public void testOpen_initial_exception() throws IOException, InterruptedException { when(processFactory.start(any())).thenThrow(new IOException()); RxProcess rxProcess = new RxProcess(processFactory, processKiller, "sh"); final TestObserver<RxProcess.Session> sessionObs = rxProcess.open().test(); sessionObs.await...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinally((Action) ...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
@Test public void testExitCode() throws InterruptedException { RxProcess rxProcess = new RxProcess(processFactory, processKiller, "sh"); RxProcess.Session session = rxProcess.open().test().awaitCount(1).assertNoErrors().values().get(0); assertThat(session.waitFor().test().await(1, TimeUnit.SECONDS), is(false)); session...
public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinally((Action) ...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
RxProcess { public synchronized Single<Session> open() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("open()"); if (session == null) { this.session = Single .create(new SingleOnSubscribe<Session>() { WeakReference<Process> debugRef; @Override public void subscribe(SingleEmitter<Session> emitter) { processCreator .doFinal...
@Test public void testClose() { RxProcess rxProcess = new RxProcess(processFactory, processKiller, "sh"); rxProcess.close().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertComplete(); rxProcess.open().test().awaitCount(1).assertNoErrors(); assertThat(mockProcesses.get(0).isAlive(), is(true)); rxProcess.clo...
public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); }
RxProcess { public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); } }
RxProcess { public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); } RxProcess(ProcessFactory processFactory, ProcessKiller processK...
RxProcess { public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); } RxProcess(ProcessFactory processFactory, ProcessKiller processK...
RxProcess { public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); } RxProcess(ProcessFactory processFactory, ProcessKiller processK...
@Test public void testIsAlive_legacy() { ApiWrap.setSDKInt(16); doThrow(new IllegalThreadStateException()).when(process).exitValue(); assertThat(ProcessHelper.isAlive(process), is(true)); doReturn(0).when(process).exitValue(); assertThat(ProcessHelper.isAlive(process), is(false)); }
@SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } @SuppressLint("NewApi") static boolean isAlive(Process process); }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } @SuppressLint("NewApi") static boolean isAlive(Process process); }
@Test public void testIsAlive_oreo() { ApiWrap.setSDKInt(26); when(process.isAlive()).thenReturn(true); assertThat(ProcessHelper.isAlive(process), is(true)); when(process.isAlive()).thenReturn(false); assertThat(ProcessHelper.isAlive(process), is(false)); }
@SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } @SuppressLint("NewApi") static boolean isAlive(Process process); }
ProcessHelper { @SuppressLint("NewApi") public static boolean isAlive(Process process) { if (ApiWrap.hasOreo()) { return process.isAlive(); } else { try { process.exitValue(); return false; } catch (IllegalThreadStateException e) { return true; } } } @SuppressLint("NewApi") static boolean isAlive(Process process); }
@Test public void testKill_legacy() { ApiWrap.setSDKInt(16); when(process.exitValue()).thenThrow(new IllegalThreadStateException()); final ProcessKiller killer = new UserKiller(); killer.kill(process); verify(process).destroy(); }
@SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if (ApiWrap.hasOreo()) process.destroyFo...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
@Test public void testOpen_no_binary() { when(shell.open()).thenReturn(Single.error(new IOException())); Root.Builder builder = new Root.Builder(); assertThat(builder.shellBuilder(shellBuilder).suBinary(suBinary).build().blockingGet().getState(), is(Root.State.UNAVAILABLE)); }
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testKill_oreo() { ApiWrap.setSDKInt(26); when(process.isAlive()).thenReturn(true); final ProcessKiller killer = new UserKiller(); killer.kill(process); verify(process).destroyForcibly(); }
@SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if (ApiWrap.hasOreo()) process.destroyFo...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if...
@Test public void testStart() throws IOException { DefaultProcessFactory pf = new DefaultProcessFactory(); Process process = pf.start("id"); assertThat(process, is(not(nullValue()))); }
@Override public Process start(String... commands) throws IOException { return new ProcessBuilder(commands).start(); }
DefaultProcessFactory implements ProcessFactory { @Override public Process start(String... commands) throws IOException { return new ProcessBuilder(commands).start(); } }
DefaultProcessFactory implements ProcessFactory { @Override public Process start(String... commands) throws IOException { return new ProcessBuilder(commands).start(); } }
DefaultProcessFactory implements ProcessFactory { @Override public Process start(String... commands) throws IOException { return new ProcessBuilder(commands).start(); } @Override Process start(String... commands); }
DefaultProcessFactory implements ProcessFactory { @Override public Process start(String... commands) throws IOException { return new ProcessBuilder(commands).start(); } @Override Process start(String... commands); }
@Test public void testOpen_timeout() { when(shellSession.submit(any(Cmd.class))).thenAnswer(invocation -> { Cmd cmd = invocation.getArgument(0); if (cmd.getCommands().contains("id")) { return Single.just(new Cmd.Result(cmd, Cmd.ExitCode.OK, Collections.singletonList("uid=0(root) gid=0(root) groups=0(root) context=u:r:s...
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testCommand_rooted() { when(shellSession.submit(any(Cmd.class))).thenAnswer(invocation -> { Cmd cmd = invocation.getArgument(0); if (cmd.getCommands().contains("id")) { return Single.just(new Cmd.Result(cmd, Cmd.ExitCode.OK, Collections.singletonList("uid=0(root) gid=0(root) groups=0(root) context=u:r...
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testCommand_timeout() { when(shell.open()).thenReturn(Single.just(shellSession)); when(shellSession.submit(any(Cmd.class))).thenAnswer(invocation -> Single.just(new Cmd.Result(invocation.getArgument(0), Cmd.ExitCode.TIMEOUT, new ArrayList<>(), new ArrayList<>()))); Root.Builder builder = new Root.Buil...
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testRooted_kingoroot_workaround() { when(shellSession.submit(any(Cmd.class))).thenAnswer(invocation -> { Cmd cmd = invocation.getArgument(0); if (cmd.getCommands().contains("id")) { return Single.just(new Cmd.Result(cmd, Cmd.ExitCode.OUTOFRANGE, Collections.singletonList("uid=0(root) gid=0(root) group...
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testRooted_second_chance() { when(shellSession.submit(any(Cmd.class))).thenAnswer(invocation -> { Cmd cmd = invocation.getArgument(0); if (cmd.getCommands().contains("id")) { return Single.just(new Cmd.Result(cmd, Cmd.ExitCode.PROBLEM)); } else if (cmd.getCommands().contains("echo test > /cache/root_t...
public State getState() { return state; }
Root { public State getState() { return state; } }
Root { public State getState() { return state; } Root(State state); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { public State getState() { return state; } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testEqualsHash() { Root root1 = new Root(Root.State.ROOTED); Root root2 = new Root(Root.State.ROOTED); Root root3 = new Root(Root.State.DENIED); assertThat(root1, is(root2)); assertThat(root1.hashCode(), is(root2.hashCode())); assertThat(root1, is(not(root3))); assertThat(root1.hashCode(), is(not(root...
@Override public int hashCode() { return state.hashCode(); }
Root { @Override public int hashCode() { return state.hashCode(); } }
Root { @Override public int hashCode() { return state.hashCode(); } Root(State state); }
Root { @Override public int hashCode() { return state.hashCode(); } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Root { @Override public int hashCode() { return state.hashCode(); } Root(State state); State getState(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
@Test public void testMordernWar() { MordernWar war = spy(new MordernWar(mock(IntrepidEnemy.class))); testWarEvents(war); }
public MordernWar(Enemy enemy) { this.enemy = enemy; }
MordernWar implements War { public MordernWar(Enemy enemy) { this.enemy = enemy; } }
MordernWar implements War { public MordernWar(Enemy enemy) { this.enemy = enemy; } MordernWar(Enemy enemy); }
MordernWar implements War { public MordernWar(Enemy enemy) { this.enemy = enemy; } MordernWar(Enemy enemy); @Override Enemy getEnemy(); @Override void startWar(); @Override void combatting(); @Override void stopWar(); }
MordernWar implements War { public MordernWar(Enemy enemy) { this.enemy = enemy; } MordernWar(Enemy enemy); @Override Enemy getEnemy(); @Override void startWar(); @Override void combatting(); @Override void stopWar(); }
@Test public void testAncientWar() { final AncientWar war = spy(new AncientWar(mock(IntrepidEnemy.class))); testWarEvents(war); }
public AncientWar(Enemy enemy) { this.enemy = enemy; }
AncientWar implements War { public AncientWar(Enemy enemy) { this.enemy = enemy; } }
AncientWar implements War { public AncientWar(Enemy enemy) { this.enemy = enemy; } AncientWar(Enemy enemy); }
AncientWar implements War { public AncientWar(Enemy enemy) { this.enemy = enemy; } AncientWar(Enemy enemy); @Override Enemy getEnemy(); @Override void startWar(); @Override void combatting(); @Override void stopWar(); }
AncientWar implements War { public AncientWar(Enemy enemy) { this.enemy = enemy; } AncientWar(Enemy enemy); @Override Enemy getEnemy(); @Override void startWar(); @Override void combatting(); @Override void stopWar(); }
@Test public void sentenceByChinese() throws Exception { final Writer writer = new Writer(); testWriterCn(writer.sentenceByChinese(), "我是来自北京的小明。"); }
public CharacterComposite sentenceByChinese() { List<ChineseWord> words = new ArrayList<>(); words.add(new ChineseWord(Arrays.asList(new Character('我')))); words.add(new ChineseWord(Arrays.asList(new Character('是')))); words.add(new ChineseWord(Arrays.asList(new Character('来'), new Character('自')))); words.add(new Chin...
Writer { public CharacterComposite sentenceByChinese() { List<ChineseWord> words = new ArrayList<>(); words.add(new ChineseWord(Arrays.asList(new Character('我')))); words.add(new ChineseWord(Arrays.asList(new Character('是')))); words.add(new ChineseWord(Arrays.asList(new Character('来'), new Character('自')))); words.add...
Writer { public CharacterComposite sentenceByChinese() { List<ChineseWord> words = new ArrayList<>(); words.add(new ChineseWord(Arrays.asList(new Character('我')))); words.add(new ChineseWord(Arrays.asList(new Character('是')))); words.add(new ChineseWord(Arrays.asList(new Character('来'), new Character('自')))); words.add...
Writer { public CharacterComposite sentenceByChinese() { List<ChineseWord> words = new ArrayList<>(); words.add(new ChineseWord(Arrays.asList(new Character('我')))); words.add(new ChineseWord(Arrays.asList(new Character('是')))); words.add(new ChineseWord(Arrays.asList(new Character('来'), new Character('自')))); words.add...
Writer { public CharacterComposite sentenceByChinese() { List<ChineseWord> words = new ArrayList<>(); words.add(new ChineseWord(Arrays.asList(new Character('我')))); words.add(new ChineseWord(Arrays.asList(new Character('是')))); words.add(new ChineseWord(Arrays.asList(new Character('来'), new Character('自')))); words.add...
@Test public void sentenceByEnglish() throws Exception { final Writer writer = new Writer(); testWriter(writer.sentenceByEnglish(), "I am a student from London."); }
public CharacterComposite sentenceByEnglish() { List<EnglishWord> words = new ArrayList<>(); words.add(new EnglishWord(Arrays.asList(new Character('I')))); words.add(new EnglishWord(Arrays.asList(new Character('a'), new Character('m')))); words.add(new EnglishWord(Arrays.asList(new Character('a')))); words.add(new Engl...
Writer { public CharacterComposite sentenceByEnglish() { List<EnglishWord> words = new ArrayList<>(); words.add(new EnglishWord(Arrays.asList(new Character('I')))); words.add(new EnglishWord(Arrays.asList(new Character('a'), new Character('m')))); words.add(new EnglishWord(Arrays.asList(new Character('a')))); words.add...
Writer { public CharacterComposite sentenceByEnglish() { List<EnglishWord> words = new ArrayList<>(); words.add(new EnglishWord(Arrays.asList(new Character('I')))); words.add(new EnglishWord(Arrays.asList(new Character('a'), new Character('m')))); words.add(new EnglishWord(Arrays.asList(new Character('a')))); words.add...
Writer { public CharacterComposite sentenceByEnglish() { List<EnglishWord> words = new ArrayList<>(); words.add(new EnglishWord(Arrays.asList(new Character('I')))); words.add(new EnglishWord(Arrays.asList(new Character('a'), new Character('m')))); words.add(new EnglishWord(Arrays.asList(new Character('a')))); words.add...
Writer { public CharacterComposite sentenceByEnglish() { List<EnglishWord> words = new ArrayList<>(); words.add(new EnglishWord(Arrays.asList(new Character('I')))); words.add(new EnglishWord(Arrays.asList(new Character('a'), new Character('m')))); words.add(new EnglishWord(Arrays.asList(new Character('a')))); words.add...
@Test public void testPrototype() throws Exception { assertEquals(this.prototype.toString(), this.expectedString); final Object clone = this.prototype.clone(); assertNotNull(clone); assertSame(clone.getClass(), this.prototype.getClass()); assertNotSame(this.prototype, clone); }
@Override protected abstract Prototype clone() throws CloneNotSupportedException;
Prototype implements Cloneable { @Override protected abstract Prototype clone() throws CloneNotSupportedException; }
Prototype implements Cloneable { @Override protected abstract Prototype clone() throws CloneNotSupportedException; }
Prototype implements Cloneable { @Override protected abstract Prototype clone() throws CloneNotSupportedException; }
Prototype implements Cloneable { @Override protected abstract Prototype clone() throws CloneNotSupportedException; }
@Test public void shouldRunJdbcAvroJob() { BenchJdbcAvroJob.main( new String[] { "--targetParallelism=1", "--skipPartitionCheck", "--connectionUrl=" + CONNECTION_URL, "--username=", "--table=COFFEES", "--output=" + testDir.toString(), "--avroCodec=zstandard1", "--executions=2" }); assertThat(TestHelper.listDir(testDir....
public static void main(String[] cmdLineArgs) { try { create(cmdLineArgs).run(); } catch (Exception e) { ExceptionHandling.handleException(e); } }
BenchJdbcAvroJob { public static void main(String[] cmdLineArgs) { try { create(cmdLineArgs).run(); } catch (Exception e) { ExceptionHandling.handleException(e); } } }
BenchJdbcAvroJob { public static void main(String[] cmdLineArgs) { try { create(cmdLineArgs).run(); } catch (Exception e) { ExceptionHandling.handleException(e); } } BenchJdbcAvroJob(final PipelineOptions pipelineOptions); }
BenchJdbcAvroJob { public static void main(String[] cmdLineArgs) { try { create(cmdLineArgs).run(); } catch (Exception e) { ExceptionHandling.handleException(e); } } BenchJdbcAvroJob(final PipelineOptions pipelineOptions); static BenchJdbcAvroJob create(final String[] cmdLineArgs); void run(); static void main(String[]...
BenchJdbcAvroJob { public static void main(String[] cmdLineArgs) { try { create(cmdLineArgs).run(); } catch (Exception e) { ExceptionHandling.handleException(e); } } BenchJdbcAvroJob(final PipelineOptions pipelineOptions); static BenchJdbcAvroJob create(final String[] cmdLineArgs); void run(); static void main(String[]...
@Test public void shouldRunJdbcAvroJobSqlFile() throws IOException { Path outputPath = testDir.resolve("shouldRunJdbcAvroJobSqlFile"); JdbcAvroJob.main( new String[] { "--targetParallelism=1", "--partition=2025-02-28", "--skipPartitionCheck", "--exportTimeout=PT1M", "--connectionUrl=" + CONNECTION_URL, "--username=", "...
public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
@Test public void shouldRunAvroJobPreCommands() throws SQLException, ClassNotFoundException { Path outputPath = testDir.resolve("shouldRunAvroJobPreCommands"); JdbcAvroJob.main( new String[] { "--targetParallelism=1", "--partition=2025-02-28", "--skipPartitionCheck", "--exportTimeout=PT1M", "--connectionUrl=" + CONNECT...
public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
@Test(expected = IllegalArgumentException.class) public void shouldFailOnMissingInput() throws IOException, ClassNotFoundException { JdbcAvroJob.create(PipelineOptionsFactory.create()); }
public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipelineOptions(pip...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
@Test(expected = IllegalArgumentException.class) public void shouldFailOnEmptyInput() throws IOException, ClassNotFoundException { PipelineOptions pipelineOptions = PipelineOptionsFactory.create(); pipelineOptions.as(OutputOptions.class).setOutput(""); JdbcAvroJob.create(PipelineOptionsFactory.create()); }
public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipelineOptions(pip...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
JdbcAvroJob { public static JdbcAvroJob create(final PipelineOptions pipelineOptions, final String output) throws IOException, ClassNotFoundException { pipelineOptions.as(DirectOptions.class).setBlockOnRun(false); return new JdbcAvroJob( pipelineOptions, Pipeline.create(pipelineOptions), JdbcExportArgsFactory.fromPipel...
@Test public void shouldCreatePsqlAvroJob() throws IOException, ClassNotFoundException { PsqlAvroJob.create( new String[] { "--connectionUrl=jdbc:postgresql: "--table=foo", "--partition=2025-02-28", "--skipPartitionCheck", "--output=/fake" }); }
public static PsqlAvroJob create(final String[] cmdLineArgs) throws IOException, ClassNotFoundException { JdbcAvroJob job = JdbcAvroJob.create(cmdLineArgs); PsqlReplicationCheck.validateOptions(job.getJdbcExportArgs()); final PsqlReplicationCheck psqlReplicationCheck = PsqlReplicationCheck.create(job.getJdbcExportArgs(...
PsqlAvroJob { public static PsqlAvroJob create(final String[] cmdLineArgs) throws IOException, ClassNotFoundException { JdbcAvroJob job = JdbcAvroJob.create(cmdLineArgs); PsqlReplicationCheck.validateOptions(job.getJdbcExportArgs()); final PsqlReplicationCheck psqlReplicationCheck = PsqlReplicationCheck.create(job.getJ...
PsqlAvroJob { public static PsqlAvroJob create(final String[] cmdLineArgs) throws IOException, ClassNotFoundException { JdbcAvroJob job = JdbcAvroJob.create(cmdLineArgs); PsqlReplicationCheck.validateOptions(job.getJdbcExportArgs()); final PsqlReplicationCheck psqlReplicationCheck = PsqlReplicationCheck.create(job.getJ...
PsqlAvroJob { public static PsqlAvroJob create(final String[] cmdLineArgs) throws IOException, ClassNotFoundException { JdbcAvroJob job = JdbcAvroJob.create(cmdLineArgs); PsqlReplicationCheck.validateOptions(job.getJdbcExportArgs()); final PsqlReplicationCheck psqlReplicationCheck = PsqlReplicationCheck.create(job.getJ...
PsqlAvroJob { public static PsqlAvroJob create(final String[] cmdLineArgs) throws IOException, ClassNotFoundException { JdbcAvroJob job = JdbcAvroJob.create(cmdLineArgs); PsqlReplicationCheck.validateOptions(job.getJdbcExportArgs()); final PsqlReplicationCheck psqlReplicationCheck = PsqlReplicationCheck.create(job.getJ...
@Test public void shouldDecryptPasswordOnpasswordFileKmsEncryptedParameter() throws IOException { MockHttpTransport mockHttpTransport = new MockHttpTransport.Builder() .setLowLevelHttpResponse( new MockLowLevelHttpResponse() .setStatusCode(200) .setContentType(Json.MEDIA_TYPE) .setContent( JacksonFactory.getDefaultInst...
Optional<String> readPassword(final DBeamPipelineOptions options) throws IOException { FileSystems.setDefaultPipelineOptions(options); if (options.getPasswordFileKmsEncrypted() != null) { LOGGER.info("Decrypting password using KMS..."); return Optional.of( kmsDecrypter .decrypt(BeamHelper.readFromFile(options.getPasswo...
PasswordReader { Optional<String> readPassword(final DBeamPipelineOptions options) throws IOException { FileSystems.setDefaultPipelineOptions(options); if (options.getPasswordFileKmsEncrypted() != null) { LOGGER.info("Decrypting password using KMS..."); return Optional.of( kmsDecrypter .decrypt(BeamHelper.readFromFile(...
PasswordReader { Optional<String> readPassword(final DBeamPipelineOptions options) throws IOException { FileSystems.setDefaultPipelineOptions(options); if (options.getPasswordFileKmsEncrypted() != null) { LOGGER.info("Decrypting password using KMS..."); return Optional.of( kmsDecrypter .decrypt(BeamHelper.readFromFile(...
PasswordReader { Optional<String> readPassword(final DBeamPipelineOptions options) throws IOException { FileSystems.setDefaultPipelineOptions(options); if (options.getPasswordFileKmsEncrypted() != null) { LOGGER.info("Decrypting password using KMS..."); return Optional.of( kmsDecrypter .decrypt(BeamHelper.readFromFile(...
PasswordReader { Optional<String> readPassword(final DBeamPipelineOptions options) throws IOException { FileSystems.setDefaultPipelineOptions(options); if (options.getPasswordFileKmsEncrypted() != null) { LOGGER.info("Decrypting password using KMS..."); return Optional.of( kmsDecrypter .decrypt(BeamHelper.readFromFile(...
@Test public void shouldConfigureJobName() { PipelineOptions pipelineOptions = PipelineOptionsFactory.create(); pipelineOptions.setJobName(null); JobNameConfiguration.configureJobName(pipelineOptions, "some_db", "some_table"); Assert.assertEquals( "JdbcAvroJob", pipelineOptions.as(ApplicationNameOptions.class).getAppNa...
public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(options.getJobName())) ...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
@Test public void shouldConfigureJobNameWhenJobNameIsAuto() { PipelineOptions pipelineOptions = PipelineOptionsFactory.create(); pipelineOptions.setJobName("auto"); JobNameConfiguration.configureJobName(pipelineOptions, "some_db", "some_table"); Assert.assertEquals( "JdbcAvroJob", pipelineOptions.as(ApplicationNameOpti...
public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(options.getJobName())) ...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
@Test public void shouldConfigureJobNameWithEmptyTableName() { PipelineOptions pipelineOptions = PipelineOptionsFactory.create(); pipelineOptions.setJobName(null); JobNameConfiguration.configureJobName(pipelineOptions, "some_db", null); Assert.assertEquals( "JdbcAvroJob", pipelineOptions.as(ApplicationNameOptions.class...
public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(options.getJobName())) ...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
JobNameConfiguration { public static void configureJobName(final PipelineOptions options, final String... parts) { try { options.as(ApplicationNameOptions.class).setAppName("JdbcAvroJob"); } catch (Exception e) { LOGGER.warn("Unable to configure ApplicationName", e); } if (options.getJobName() == null || "auto".equals(...
@Test(expected = IllegalArgumentException.class) public void shouldFailOnNullTableName() { QueryBuilderArgs.create(null); }
public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablename(tableName)).build(); }
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
@Test public void shouldBeNotReplicationDelayedWhenReplicatedUntilEndOfPartition() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-08-01T00:00:00Z"); Period partitionPeriod = Period.ofDays(1); Assert.assertFalse( PsqlReplicationCheck.isReplicationDelayed(partit...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test(expected = IllegalArgumentException.class) public void shouldFailOnInvalidTableName() { QueryBuilderArgs.create("*invalid#name@!"); }
public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablename(tableName)).build(); }
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
@Test(expected = IllegalArgumentException.class) public void shouldFailOnTableNameWithDots() { QueryBuilderArgs.create("foo.bar"); }
public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablename(tableName)).build(); }
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
QueryBuilderArgs implements Serializable { public static QueryBuilderArgs create(final String tableName) { checkArgument(tableName != null, "TableName cannot be null"); checkArgument(checkTableName(tableName), "'table' must follow [a-zA-Z_][a-zA-Z0-9_]*"); return createBuilder().setBaseSqlQuery(QueryBuilder.fromTablena...
@Test public void shouldConfigureLimit() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions("--connectionUrl=jdbc:postgresql: Assert.assertEquals( Lists.newArrayList("SELECT * FROM some_table WHERE 1=1 LIMIT 7"), actual.buildQueries(null)); }
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionForFullIsoString() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-07-31T13:37:59Z"); Assert.assertEquals(Optional.of(Instant.parse("2027-07-31T13:37:59Z")), actual.partition()); }
public abstract Optional<Instant> partition();
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
@Test public void shouldConfigurePartitionForMonthlySchedule() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-05"); Assert.assertEquals(Optional.of(Instant.parse("2027-05-01T00:00:00Z")), actual.partition()); }
public abstract Optional<Instant> partition();
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
@Test public void shouldConfigurePartitionForHourlySchedule() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-05-02T23"); Assert.assertEquals(Optional.of(Instant.parse("2027-05-02T23:00:00Z")), actual.partition()); }
public abstract Optional<Instant> partition();
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); }
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
QueryBuilderArgs implements Serializable { public abstract Optional<Instant> partition(); abstract Optional<Long> limit(); abstract Optional<String> partitionColumn(); abstract Optional<Instant> partition(); abstract TemporalAmount partitionPeriod(); abstract Optional<String> splitColumn(); abstract Optional<Integer> ...
@Test public void shouldConfigurePartitionColumn() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-07-31 --partitionColumn=col"); Assert.assertEquals( Lists.newArrayList( "SELECT * FROM some_table WHERE 1=1 " + "AND col >= '2027-07-31' AND...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionColumnAndLimit() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-07-31 --partitionColumn=col --limit=5"); Assert.assertEquals( Lists.newArrayList( "SELECT * FROM some_table WHERE 1=1 " + "AND col >...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionColumnAndPartitionPeriod() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-07-31 --partitionColumn=col --partitionPeriod=P1M"); Assert.assertEquals( Lists.newArrayList( "SELECT * FROM some_table WH...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionColumnAndPartitionPeriodForHourly() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--partition=2027-07-31T00 --partitionColumn=col --partitionPeriod=PT1H"); Assert.assertEquals( Lists.newArrayList( "SELECT * FROM ...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldBeNotReplicationDelayedWhenReplicatedUntilEndTheNextDay() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-08-02T00:00:00Z"); Period partitionPeriod = Period.ofDays(1); Assert.assertFalse( PsqlReplicationCheck.isReplicationDelayed(partiti...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldConfigureLimitForSqlFile() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( String.format( "--connectionUrl=jdbc:postgresql: coffeesSqlQueryPath.toString())); Assert.assertEquals( Lists.newArrayList( "SELECT * FROM (SELECT * FROM COFFEES WHERE SIZE > 10) as user_sql_que...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionColumnAndLimitForSqlFile() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( String.format( "--connectionUrl=jdbc:postgresql: + "--sqlFile=%s --partition=2027-07-31 --partitionColumn=col --limit=7", coffeesSqlQueryPath.toString())); Assert.assertEquals(...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldConfigurePartitionColumnAndPartitionPeriodForSqlFile() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( String.format( "--connectionUrl=jdbc:postgresql: + "--sqlFile=%s --partition=2027-07-31 " + "--partitionColumn=col --partitionPeriod=P1M", coffeesSqlQueryPath.toStrin...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldCreateParallelQueries() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( "--connectionUrl=jdbc:postgresql: + "--splitColumn=ROWNUM --queryParallelism=5"); Assert.assertEquals( Lists.newArrayList("SELECT * FROM COFFEES WHERE 1=1" + " AND ROWNUM >= 1 AND ROWNUM <= 2"), ac...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldCreateParallelQueriesWithSqlFile() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( String.format( "--connectionUrl=jdbc:postgresql: + "--sqlFile=%s --splitColumn=ROWNUM --queryParallelism=5", coffeesSqlQueryPath.toString())); Assert.assertEquals( Lists.newArrayList( "S...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldCreateParallelQueriesWithPartitionColumn() throws IOException, SQLException { QueryBuilderArgs actual = parseOptions( String.format( "--connectionUrl=jdbc:postgresql: + "--sqlFile=%s --partition=2027-07-31 " + "--partitionColumn=col --partitionPeriod=P1M --limit=7", coffeesSqlQueryPath.toString(...
public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get(), this.partition().get(), partitionPeriod...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
QueryBuilderArgs implements Serializable { public List<String> buildQueries(final Connection connection) throws SQLException { QueryBuilder queryBuilder = this.baseSqlQuery(); if (this.partitionColumn().isPresent() && this.partition().isPresent()) { queryBuilder = configurePartitionCondition( this.partitionColumn().get...
@Test public void shouldBuildParallelQueriesGivenRangeAndParallelism3() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(100, 400, 3, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 100, 200), format("%s AND sp >= %s AND sp <...
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Test public void shouldBuildParallelQueriesGivenRangeThatDoesNotDivideEqually() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(100, 402, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 100, 161), format("%s AND sp >= %s...
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Test public void shouldBuildSingleQueryWhenParallelismIsMoreThanMaxMin() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 2, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 2)))); }
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Test public void shouldBuildSingleQueryWhenMaxMinIsTheSame() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 1, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 1)))); }
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Test public void shouldBeReplicationDelayedWhenReplicatedUpToPartitionStart() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-31T00:00:00Z"); Period partitionPeriod = Period.ofDays(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition, ...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldBuildSingleQueryWhenParallelismIsOne() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 10, 1, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 10)))); }
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Ignore @Test public void shouldBuildMultipleQueriesWhenQueryingFromTwoRows() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 2, 2, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 1, 2), format("%s AND sp >= %s AND sp <= ...
protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEn...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationConditi...
@Test public void shouldBeReplicationDelayedWhenReplicatedBeforePartitionStart() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-30T22:00:00Z"); Period partitionPeriod = Period.ofDays(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldBeReplicationDelayedWhenReplicatedInsidePartition() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-31T23:59:59Z"); Period partitionPeriod = Period.ofDays(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition, las...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldWorkWithMonthlyPartitionPeriod() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-31T23:59:59Z"); Period partitionPeriod = Period.ofMonths(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition, lastReplication, par...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldBeDelayedWithHourlyPartitionPeriod() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-31T00:59:59Z"); Duration partitionPeriod = Duration.ofHours(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition, lastReplicati...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldBeNotDelayedWithHourlyPartitionPeriod() { Instant partition = Instant.parse("2027-07-31T00:00:00Z"); Instant lastReplication = Instant.parse("2027-07-31T00:59:59Z"); Duration partitionPeriod = Duration.ofHours(1); Assert.assertTrue( PsqlReplicationCheck.isReplicationDelayed(partition, lastReplic...
public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } }
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
PsqlReplicationCheck { public boolean isReplicationDelayed() throws Exception { return isReplicationDelayed( this.jdbcExportArgs.queryBuilderArgs().partition().get(), queryReplication(), this.jdbcExportArgs.queryBuilderArgs().partitionPeriod()); } PsqlReplicationCheck(final JdbcExportArgs jdbcExportArgs, final String r...
@Test public void shouldRunJdbcAvroJob() throws IOException { Path outputPath = testDir.resolve("shouldRunJdbcAvroJob"); JdbcAvroJob.main( new String[] { "--targetParallelism=1", "--partition=2025-02-28", "--skipPartitionCheck", "--exportTimeout=PT1M", "--connectionUrl=" + CONNECTION_URL, "--username=", "--passwordFile...
public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } }
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
JdbcAvroJob { public static void main(String[] cmdLineArgs) { try { JdbcAvroJob.create(cmdLineArgs).runExport(); } catch (Exception e) { ExceptionHandling.handleException(e); } } JdbcAvroJob( final PipelineOptions pipelineOptions, final Pipeline pipeline, final JdbcExportArgs jdbcExportArgs, fin...
@Test public void testSha256() throws Exception { final Path file = fs.getPath("/", "file"); Files.write(file, new byte[] {0x00, 0x01, 0x02}); final HashCode hashCode = PathUtils.sha256(file); assertThat( hashCode.toString(), is("ae4b3280e56e2faf83f414a6e3dabe9d5fbe18976544c05fed121accb85b53fc")); }
public static HashCode sha256(final Path file) throws IOException { return MoreFiles.asByteSource(file).hash(Hashing.sha256()); }
PathUtils { public static HashCode sha256(final Path file) throws IOException { return MoreFiles.asByteSource(file).hash(Hashing.sha256()); } }
PathUtils { public static HashCode sha256(final Path file) throws IOException { return MoreFiles.asByteSource(file).hash(Hashing.sha256()); } private PathUtils(); }
PathUtils { public static HashCode sha256(final Path file) throws IOException { return MoreFiles.asByteSource(file).hash(Hashing.sha256()); } private PathUtils(); static HashCode sha256(final Path file); static void syncRecursive(final Path source, final Path target); static void removeRecursive(final Path path); }
PathUtils { public static HashCode sha256(final Path file) throws IOException { return MoreFiles.asByteSource(file).hash(Hashing.sha256()); } private PathUtils(); static HashCode sha256(final Path file); static void syncRecursive(final Path source, final Path target); static void removeRecursive(final Path path); }
@Test public void testEquivalentSubpath() throws Exception { final Path a = fs.getPath("/", "a", "b"); final Path b = fs.getPath("/", "a", "d"); final Path path = fs.getPath("/", "a", "b", "c"); final Path expectedOutput = fs.getPath("/", "a", "d", "c"); final Path actualOutput = PathUtils.equivalentSubpath(a, b, path)...
static Path equivalentSubpath(final Path a, final Path b, final Path path) { return b.resolve(a.relativize(path)); }
PathUtils { static Path equivalentSubpath(final Path a, final Path b, final Path path) { return b.resolve(a.relativize(path)); } }
PathUtils { static Path equivalentSubpath(final Path a, final Path b, final Path path) { return b.resolve(a.relativize(path)); } private PathUtils(); }
PathUtils { static Path equivalentSubpath(final Path a, final Path b, final Path path) { return b.resolve(a.relativize(path)); } private PathUtils(); static HashCode sha256(final Path file); static void syncRecursive(final Path source, final Path target); static void removeRecursive(final Path path); }
PathUtils { static Path equivalentSubpath(final Path a, final Path b, final Path path) { return b.resolve(a.relativize(path)); } private PathUtils(); static HashCode sha256(final Path file); static void syncRecursive(final Path source, final Path target); static void removeRecursive(final Path path); }
@Test public void testRemoveRecursive() throws Exception { final Path root = Files.createDirectory(fs.getPath("/", "root")); final Path unrelated = Files.write(root.resolve("unrelated"), new byte[] {0x0f}); final Path dir = Files.createDirectory(root.resolve("dir")); Files.write(dir.resolve("a"), new byte[] {0x00}); Fi...
public static void removeRecursive(final Path path) throws IOException { Files.walkFileTree( path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } @Override pu...
PathUtils { public static void removeRecursive(final Path path) throws IOException { Files.walkFileTree( path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } ...
PathUtils { public static void removeRecursive(final Path path) throws IOException { Files.walkFileTree( path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } ...
PathUtils { public static void removeRecursive(final Path path) throws IOException { Files.walkFileTree( path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } ...
PathUtils { public static void removeRecursive(final Path path) throws IOException { Files.walkFileTree( path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } ...
@Test public void testSyncRecursive() throws Exception { final Path root = Files.createDirectory(fs.getPath("/", "root")); final Path unrelated = Files.write(root.resolve("unrelated"), new byte[] {0x0f}); final Path dir = Files.createDirectory(root.resolve("dir")); Files.write(dir.resolve("a"), new byte[] {0x00}); File...
public static void syncRecursive(final Path source, final Path target) throws IOException { Files.walkFileTree( source, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory( final Path sourceDir, final BasicFileAttributes attrs) throws IOException { final Path targetDir = equivalentSubpath...
PathUtils { public static void syncRecursive(final Path source, final Path target) throws IOException { Files.walkFileTree( source, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory( final Path sourceDir, final BasicFileAttributes attrs) throws IOException { final Path targetDir = equiv...
PathUtils { public static void syncRecursive(final Path source, final Path target) throws IOException { Files.walkFileTree( source, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory( final Path sourceDir, final BasicFileAttributes attrs) throws IOException { final Path targetDir = equiv...
PathUtils { public static void syncRecursive(final Path source, final Path target) throws IOException { Files.walkFileTree( source, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory( final Path sourceDir, final BasicFileAttributes attrs) throws IOException { final Path targetDir = equiv...
PathUtils { public static void syncRecursive(final Path source, final Path target) throws IOException { Files.walkFileTree( source, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory( final Path sourceDir, final BasicFileAttributes attrs) throws IOException { final Path targetDir = equiv...
@Test(expected = ServletException.class) public void whenPostWithoutFile_reportFailure() throws Exception { servlet.doPost(createPostRequest(), response); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void afterReplace_configHasChangedSnakeCase() { assertThat(getReplacedConfiguration(SERVLET_CONFIG, WORK_MANAGER_CONFIG).getMetricsNameSnakeCase(), is(true)); assertThat(getReplacedConfiguration(WORK_MANAGER_CONFIG, SERVLET_CONFIG).getMetricsNameSnakeCase(), is(false)); }
boolean getMetricsNameSnakeCase() { return metricsNameSnakeCase; }
ExporterConfig { boolean getMetricsNameSnakeCase() { return metricsNameSnakeCase; } }
ExporterConfig { boolean getMetricsNameSnakeCase() { return metricsNameSnakeCase; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { boolean getMetricsNameSnakeCase() { return metricsNameSnakeCase; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObject response); MBe...
ExporterConfig { boolean getMetricsNameSnakeCase() { return metricsNameSnakeCase; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObject response); MBe...
@Test public void afterReplace_configHasChangedRestPort() { assertThat(getReplacedConfiguration(SERVLET_CONFIG, REST_PORT_CONFIG).getRestPort(), equalTo(1234)); assertThat(getReplacedConfiguration(REST_PORT_CONFIG, SERVLET_CONFIG).getRestPort(), nullValue()); }
public Integer getRestPort() { return restPort; }
ExporterConfig { public Integer getRestPort() { return restPort; } }
ExporterConfig { public Integer getRestPort() { return restPort; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public Integer getRestPort() { return restPort; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObject response); MBeanSelector[] getE...
ExporterConfig { public Integer getRestPort() { return restPort; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObject response); MBeanSelector[] getE...
@Test public void afterReplace_configHasChangedDomainQualifier() { assertThat(getReplacedConfiguration(SERVLET_CONFIG, DOMAIN_QUALIFIER_CONFIG).useDomainQualifier(), is(true)); assertThat(getReplacedConfiguration(DOMAIN_QUALIFIER_CONFIG, SERVLET_CONFIG).useDomainQualifier(), is(false)); }
boolean useDomainQualifier() { return useDomainQualifier && (domainName == null); }
ExporterConfig { boolean useDomainQualifier() { return useDomainQualifier && (domainName == null); } }
ExporterConfig { boolean useDomainQualifier() { return useDomainQualifier && (domainName == null); } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { boolean useDomainQualifier() { return useDomainQualifier && (domainName == null); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObje...
ExporterConfig { boolean useDomainQualifier() { return useDomainQualifier && (domainName == null); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector, JsonObje...
@Test public void afterReplaceWithEmptyConfig_configHasNoQueries() { ExporterConfig config = getReplacedConfiguration(SERVLET_CONFIG, ""); assertThat(config.getQueries(), arrayWithSize(0)); }
public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
@Test public void whenYamlContainsMergeableQueries_MergeThem() { ExporterConfig config = loadFromString(MERGEABLE_CONFIG); assertThat(config.toString(), equalTo(MERGED_CONFIG)); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null) sb.append(REST_...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
@Test public void afterAppendWithNewTopLevelQuery_configHasMultipleTopLevelQueries() { ExporterConfig config = getAppendedConfiguration(SERVLET_CONFIG, PARTITION_CONFIG); assertThat(config.getQueries(), arrayWithSize(2)); }
public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
@Test public void afterAppendWithMatchingTopLevelQuery_configHasMergedQueries() { ExporterConfig config = getAppendedConfiguration(SERVLET_CONFIG, WORK_MANAGER_CONFIG); assertThat(config.getQueries(), arrayWithSize(1)); }
public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
ExporterConfig { public MBeanSelector[] getQueries() { if (queries == null) return NO_QUERIES; return queries; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector select...
@Test public void whenConfigHasSingleValue_displayAsScalar() { ExporterConfig exporterConfig = loadFromString(CONFIG_WITH_SINGLE_VALUE); assertThat(exporterConfig.toString(), equalTo(CONFIG_WITH_SINGLE_VALUE)); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null) sb.append(REST_...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
ExporterConfig { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (querySyncConfiguration != null) sb.append(querySyncConfiguration); if (metricsNameSnakeCase) sb.append("metricsNameSnakeCase: true\n"); if (useDomainQualifier) sb.append(DOMAIN_QUALIFIER + ": true\n"); if (restPort != null...
@Test public void convertToSnakeCase() throws Exception { assertThat(SnakeCaseUtil.convert("simple"), equalTo("simple")); assertThat(SnakeCaseUtil.convert("already_snake_case"), equalTo("already_snake_case")); assertThat(SnakeCaseUtil.convert("isCamelCase"), equalTo("is_camel_case")); assertThat(SnakeCaseUtil.convert("...
static String convert(String s) { return SNAKE_CASE_PATTERN.matcher(s).replaceAll("$1_$2").toLowerCase(); }
SnakeCaseUtil { static String convert(String s) { return SNAKE_CASE_PATTERN.matcher(s).replaceAll("$1_$2").toLowerCase(); } }
SnakeCaseUtil { static String convert(String s) { return SNAKE_CASE_PATTERN.matcher(s).replaceAll("$1_$2").toLowerCase(); } }
SnakeCaseUtil { static String convert(String s) { return SNAKE_CASE_PATTERN.matcher(s).replaceAll("$1_$2").toLowerCase(); } static boolean isCompliant(String s); }
SnakeCaseUtil { static String convert(String s) { return SNAKE_CASE_PATTERN.matcher(s).replaceAll("$1_$2").toLowerCase(); } static boolean isCompliant(String s); }
@Test public void verifiesSnakeCase() throws Exception { assertThat(SnakeCaseUtil.isCompliant("simple"), is(true)); assertThat(SnakeCaseUtil.isCompliant("an_example_with_multiple_words"), is(true)); assertThat(SnakeCaseUtil.isCompliant("camelCaseWithMultipleWords"), is(false)); assertThat(SnakeCaseUtil.isCompliant("Pas...
public static boolean isCompliant(String s) { return s.equals(convert(s)); }
SnakeCaseUtil { public static boolean isCompliant(String s) { return s.equals(convert(s)); } }
SnakeCaseUtil { public static boolean isCompliant(String s) { return s.equals(convert(s)); } }
SnakeCaseUtil { public static boolean isCompliant(String s) { return s.equals(convert(s)); } static boolean isCompliant(String s); }
SnakeCaseUtil { public static boolean isCompliant(String s) { return s.equals(convert(s)); } static boolean isCompliant(String s); }
@Test public void afterSelectedFileHasBadBooleanValue_configurationIsUnchanged() throws Exception { LiveConfiguration.loadFromString(CONFIGURATION); servlet.doPost(createUploadRequest(createEncodedForm("append", ADDED_CONFIGURATION_WITH_BAD_BOOLEAN)), response); assertThat(LiveConfiguration.asString(), equalTo(CONFIGUR...
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenStringArrayValueIsStringArray_returnAsIs() throws Exception { Map<String,Object> map = ImmutableMap.of("values", STRING_ARRAY); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining(STRING_ARRAY)); }
@SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getComponentType...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
@Test public void whenStringArrayValueIsSingleObject_returnAsLengthOneArray() throws Exception { Map<String,Object> map = ImmutableMap.of("values", 33); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining("33")); }
@SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getComponentType...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
@Test public void whenStringArrayValueIsList_returnAsArray() throws Exception { Map<String,Object> map = ImmutableMap.of("values", Arrays.asList(7, 8, true)); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining("7", "8", "true")); }
@SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getComponentType...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getCo...
@Test public void queryFieldsMatchValues() { MBeanSelector selector = MBeanSelector.create( ImmutableMap.of(MBeanSelector.VALUES, EXPECTED_COMPONENT_VALUES)); assertThat(querySpec(selector), hasJsonPath("$.fields").withValues(EXPECTED_COMPONENT_VALUES)); }
public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
@Test public void whenKeySpecified_isIncludedInQueryFields() { MBeanSelector selector = MBeanSelector.create( ImmutableMap.of(MBeanSelector.VALUES, EXPECTED_COMPONENT_VALUES, MBeanSelector.KEY, "name")); assertThat(querySpec(selector), hasJsonPath("$.fields").includingValues("name")); }
public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
@Test public void whenTypeSpecified_standardFieldTypeIsIncludedInQueryFields() { MBeanSelector selector = MBeanSelector.create( ImmutableMap.of(MBeanSelector.VALUES, EXPECTED_COMPONENT_VALUES, MBeanSelector.TYPE, "OneTypeOnly")); assertThat(querySpec(selector), hasJsonPath("$.fields").includingValues(MBeanSelector.TYPE...
public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
@Test public void whenMapHasNestedElements_pathIncludesChildren() { MBeanSelector selector = MBeanSelector.create(ImmutableMap.of("servlets", ImmutableMap.of(MBeanSelector.VALUES, new String[] {"first", "second"}))); assertThat(querySpec(selector), hasJsonPath("$.children.servlets.fields").withValues("first", "second")...
public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
MBeanSelector { public static MBeanSelector create(Map<String, Object> map) { return new MBeanSelector(map); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String ge...
@Test public void whenMergingLeafElements_combineValues() { MBeanSelector selector1 = createLeaf("first", "second"); MBeanSelector selector2 = createLeaf("second", "third"); assertThat(querySpec(selector1.merge(selector2)), hasJsonPath("$.fields").withValues("first", "second", "third")); }
MBeanSelector merge(MBeanSelector selector) { return new MBeanSelector(this, selector); }
MBeanSelector { MBeanSelector merge(MBeanSelector selector) { return new MBeanSelector(this, selector); } }
MBeanSelector { MBeanSelector merge(MBeanSelector selector) { return new MBeanSelector(this, selector); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { MBeanSelector merge(MBeanSelector selector) { return new MBeanSelector(this, selector); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String getRequ...
MBeanSelector { MBeanSelector merge(MBeanSelector selector) { return new MBeanSelector(this, selector); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String getRequ...
@Test public void whenLeafElementsHaveMatchingAttributes_mayCombine() { MBeanSelector selector1 = createLeaf("type:Type1", "prefix:#_", "key:name", "keyName:numbers", "first", "second"); MBeanSelector selector2 = createLeaf("type:Type1", "prefix:#_", "key:name", "keyName:numbers", "second", "third"); assertThat(selecto...
boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet()) if (other.ne...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
@Test public void whenLeafElementsHaveMisMatchedAttributes_mayNotCombine() { assertThat(createLeaf("keyName:numbers", "first", "second").mayMergeWith(createLeaf("second", "third")), is(false)); assertThat(createLeaf("prefix:_", "key:Name").mayMergeWith(createLeaf("prefix:_", "aValue")), is(false)); assertThat(createLea...
boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet()) if (other.ne...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...
MBeanSelector { boolean mayMergeWith(MBeanSelector other) { if (!Objects.equals(keyName, other.keyName)) return false; if (!Objects.equals(key, other.key)) return false; if (!Objects.equals(type, other.type)) return false; if (!Objects.equals(prefix, other.prefix)) return false; for (String key : nestedSelectors.keySet...