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 testCancelWithNoFuture() { TestScheduledRunnable testScheduledRunnable = new TestScheduledRunnable(); testScheduledRunnable.cancel(); } | @Override public void cancel() { if (future != null) { future.cancel(false); } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void cancel() { if (future != null) { future.cancel(false); } } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void cancel() { if (future != null) { future.cancel(false); } } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void cancel() { if (future != null) { future.cancel(false); } } void scheduleWithFixedDelay(ScheduledExecutorService scheduledExecutor, long period,
TimeUnit unit); void scheduleWithFixedDelay(ScheduledExecutorService scheduledExecutor,
... | ScheduledRunnable implements Runnable, Cancellable { @Override public void cancel() { if (future != null) { future.cancel(false); } } void scheduleWithFixedDelay(ScheduledExecutorService scheduledExecutor, long period,
TimeUnit unit); void scheduleWithFixedDelay(ScheduledExecutorService scheduledExecutor,
... |
@Test public void testExceptionalScheduledRunnable() { ExceptionalScheduledRunnable testScheduledRunnable = new ExceptionalScheduledRunnable(); testScheduledRunnable.run(); } | @Override public void run() { try { runInternal(); } catch (TerminateSubsequentExecutionsException e) { logger.debug(e.getMessage(), e); throw e; } catch (Throwable t) { logger.error(t.getMessage(), t); } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void run() { try { runInternal(); } catch (TerminateSubsequentExecutionsException e) { logger.debug(e.getMessage(), e); throw e; } catch (Throwable t) { logger.error(t.getMessage(), t); } } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void run() { try { runInternal(); } catch (TerminateSubsequentExecutionsException e) { logger.debug(e.getMessage(), e); throw e; } catch (Throwable t) { logger.error(t.getMessage(), t); } } } | ScheduledRunnable implements Runnable, Cancellable { @Override public void run() { try { runInternal(); } catch (TerminateSubsequentExecutionsException e) { logger.debug(e.getMessage(), e); throw e; } catch (Throwable t) { logger.error(t.getMessage(), t); } } void scheduleWithFixedDelay(ScheduledExecutorService schedu... | ScheduledRunnable implements Runnable, Cancellable { @Override public void run() { try { runInternal(); } catch (TerminateSubsequentExecutionsException e) { logger.debug(e.getMessage(), e); throw e; } catch (Throwable t) { logger.error(t.getMessage(), t); } } void scheduleWithFixedDelay(ScheduledExecutorService schedu... |
@Test public void shouldMaskJvmArgs() { assertThat(SystemProperties.maskJvmArgs(ImmutableList.of("-Xmx1g", "-Dtest=one"), ImmutableList.<String>of())).containsExactly("-Xmx1g", "-Dtest=one"); assertThat(SystemProperties.maskJvmArgs(ImmutableList.of("-Xmx1g", "-Dtest=one"), ImmutableList.<String>of("test"))).containsExa... | public static List<String> maskJvmArgs(List<String> jvmArgs, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return jvmArgs; } List<Pattern> maskSystemPropertyPatterns = buildPatternList(maskSystemProperties); List<String> maskedJvmArgs = Lists.newArrayList(); for (String arg : jvmArgs) { mas... | SystemProperties { public static List<String> maskJvmArgs(List<String> jvmArgs, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return jvmArgs; } List<Pattern> maskSystemPropertyPatterns = buildPatternList(maskSystemProperties); List<String> maskedJvmArgs = Lists.newArrayList(); for (String a... | SystemProperties { public static List<String> maskJvmArgs(List<String> jvmArgs, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return jvmArgs; } List<Pattern> maskSystemPropertyPatterns = buildPatternList(maskSystemProperties); List<String> maskedJvmArgs = Lists.newArrayList(); for (String a... | SystemProperties { public static List<String> maskJvmArgs(List<String> jvmArgs, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return jvmArgs; } List<Pattern> maskSystemPropertyPatterns = buildPatternList(maskSystemProperties); List<String> maskedJvmArgs = Lists.newArrayList(); for (String a... | SystemProperties { public static List<String> maskJvmArgs(List<String> jvmArgs, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return jvmArgs; } List<Pattern> maskSystemPropertyPatterns = buildPatternList(maskSystemProperties); List<String> maskedJvmArgs = Lists.newArrayList(); for (String a... |
@Test public void shouldMaskSystemProperties() { assertThat(SystemProperties .maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of()) .get("test")).isEqualTo("one"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("test")).get("test")).i... | public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHas... | SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemPrope... | SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemPrope... | SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemPrope... | SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemPrope... |
@Test public void shouldNotMask() { List<Pattern> maskPatterns = ImmutableList.of(Pattern.compile(".*password.*")); String requestQueryString = "test=one&xpassworry=nomask&test=two"; String maskRequestQueryString = ServletMessageSupplier.maskRequestQueryString(requestQueryString, maskPatterns); assertThat(maskRequestQu... | static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = new StringBuilder(requestQueryString.length()); boolean existMaskedParameters =... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... |
@Test public void testWithNullManifest() { String version = Version.getVersion((Manifest) null); assertThat(version).isEqualTo("unknown"); } | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithNoImplementationVersion() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); String version = Version.getVersion(manifest); assertThat(version).isEqualTo("unknown"); } | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithNonSnapshotVersion() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2"); String version = Version.getVersion(manifest); as... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithSnapshotVersion() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2-SNAPSHOT"); when(attributes.getValue("Build-Commit")) .... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithNoneBuildCommit() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2-SNAPSHOT"); when(attributes.getValue("Build-Commit")).t... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithInvalidBuildCommit() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2-SNAPSHOT"); when(attributes.getValue("Build-Commit")... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithMissingBuildTime() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2-SNAPSHOT"); when(attributes.getValue("Build-Commit")).... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testWithInvalidBuildCommitAndMissingBuildTime() { Manifest manifest = mock(Manifest.class); Attributes attributes = mock(Attributes.class); when(manifest.getMainAttributes()).thenReturn(attributes); when(attributes.getValue("Implementation-Version")).thenReturn("0.1.2-SNAPSHOT"); when(attributes.getVa... | public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); } | Version { public static String getVersion(Class<?> baseClass) { Manifest manifest; try { manifest = getManifest(baseClass); } catch (IOException e) { logger.error(e.getMessage(), e); return UNKNOWN_VERSION; } return getVersion(manifest); } private Version(); static String getVersion(Class<?> baseClass); static final S... |
@Test public void testClassWithNoClassFile() throws IOException { assertThat(Version.getManifest(long.class)).isNull(); } | @VisibleForTesting static @Nullable Manifest getManifest(Class<?> clazz) throws IOException { URL classURL = clazz.getResource(clazz.getSimpleName() + ".class"); if (classURL == null) { logger.warn("url for class is unexpectedly null: {}", clazz); return null; } String externalForm = classURL.toExternalForm(); if (!ext... | Version { @VisibleForTesting static @Nullable Manifest getManifest(Class<?> clazz) throws IOException { URL classURL = clazz.getResource(clazz.getSimpleName() + ".class"); if (classURL == null) { logger.warn("url for class is unexpectedly null: {}", clazz); return null; } String externalForm = classURL.toExternalForm()... | Version { @VisibleForTesting static @Nullable Manifest getManifest(Class<?> clazz) throws IOException { URL classURL = clazz.getResource(clazz.getSimpleName() + ".class"); if (classURL == null) { logger.warn("url for class is unexpectedly null: {}", clazz); return null; } String externalForm = classURL.toExternalForm()... | Version { @VisibleForTesting static @Nullable Manifest getManifest(Class<?> clazz) throws IOException { URL classURL = clazz.getResource(clazz.getSimpleName() + ".class"); if (classURL == null) { logger.warn("url for class is unexpectedly null: {}", clazz); return null; } String externalForm = classURL.toExternalForm()... | Version { @VisibleForTesting static @Nullable Manifest getManifest(Class<?> clazz) throws IOException { URL classURL = clazz.getResource(clazz.getSimpleName() + ".class"); if (classURL == null) { logger.warn("url for class is unexpectedly null: {}", clazz); return null; } String externalForm = classURL.toExternalForm()... |
@Test public void shouldMaskStrange() { List<Pattern> maskPatterns = ImmutableList.of(Pattern.compile(".*password.*")); String requestQueryString = "test=one&&&===&=&xpasswordy=mask=me&&&==&test=two"; String maskRequestQueryString = ServletMessageSupplier.maskRequestQueryString(requestQueryString, maskPatterns); assert... | static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = new StringBuilder(requestQueryString.length()); boolean existMaskedParameters =... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... |
@Test public void test() { assertThat(GrpcCommon.convertFromV09AgentRollupId("a/b/c")).isEqualTo("a::b::c::"); assertThat(GrpcCommon.convertFromV09AgentRollupId(" a/b/c ")).isEqualTo("a::b::c::"); assertThat(GrpcCommon.convertFromV09AgentRollupId("a / b/c")).isEqualTo("a::b::c::"); assertThat(GrpcCommon.convertFromV09A... | static String convertFromV09AgentRollupId(String v09AgentRollupId) { return v09AgentRollupId.replaceAll(" */ *", "::").trim() + "::"; } | GrpcCommon { static String convertFromV09AgentRollupId(String v09AgentRollupId) { return v09AgentRollupId.replaceAll(" */ *", "::").trim() + "::"; } } | GrpcCommon { static String convertFromV09AgentRollupId(String v09AgentRollupId) { return v09AgentRollupId.replaceAll(" */ *", "::").trim() + "::"; } GrpcCommon(AgentConfigDao agentConfigDao, V09AgentRollupDao v09AgentRollupDao); } | GrpcCommon { static String convertFromV09AgentRollupId(String v09AgentRollupId) { return v09AgentRollupId.replaceAll(" */ *", "::").trim() + "::"; } GrpcCommon(AgentConfigDao agentConfigDao, V09AgentRollupDao v09AgentRollupDao); } | GrpcCommon { static String convertFromV09AgentRollupId(String v09AgentRollupId) { return v09AgentRollupId.replaceAll(" */ *", "::").trim() + "::"; } GrpcCommon(AgentConfigDao agentConfigDao, V09AgentRollupDao v09AgentRollupDao); } |
@Test public void shouldNotMaskStrange() { List<Pattern> maskPatterns = ImmutableList.of(Pattern.compile(".*password.*")); String requestQueryString = "test=one&&&===&=&xpassworry=no=mask&&&==&test=two"; String maskRequestQueryString = ServletMessageSupplier.maskRequestQueryString(requestQueryString, maskPatterns); ass... | static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = new StringBuilder(requestQueryString.length()); boolean existMaskedParameters =... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... | ServletMessageSupplier extends MessageSupplier implements ServletRequestInfo { static @Nullable String maskRequestQueryString(@Nullable String requestQueryString, List<Pattern> maskPatterns) { if (requestQueryString == null) { return null; } if (maskPatterns.isEmpty()) { return requestQueryString; } StringBuilder sb = ... |
@Test public void test() throws Exception { List<Trace.Entry> entries = Lists.newArrayList(); entries.add(Trace.Entry.newBuilder().setDepth(0).build()); entries.add(Trace.Entry.newBuilder().setDepth(1).build()); String json = TraceCommonService.entriesToJson(entries); assertThat(json).isEqualTo("[{\"startOffsetNanos\":... | @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } finally { jg.close(); } re... | TraceCommonService { @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } final... | TraceCommonService { @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } final... | TraceCommonService { @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } final... | TraceCommonService { @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } final... |
@Test public void shouldCreateJsonServiceExceptionResponse() throws Exception { Exception e = new JsonServiceException(HttpResponseStatus.PRECONDITION_FAILED, new IllegalStateException("An ignored message")); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateJsonServiceExceptionResponseWithMessage() throws Exception { Exception e = new JsonServiceException(HttpResponseStatus.PRECONDITION_FAILED, "A message"); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock(Authentication.class), e... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateJsonServiceExceptionResponseFromInvocationTargetException() throws Exception { Exception e = new InvocationTargetException( new JsonServiceException(HttpResponseStatus.PRECONDITION_FAILED, new IllegalStateException("An ignored message"))); CommonResponse httpResponse = HTTP_SERVER_HANDLER.... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateJsonServiceExceptionResponseWithMessageFromInvocationTargetException() throws Exception { Exception e = new InvocationTargetException( new JsonServiceException(HttpResponseStatus.PRECONDITION_FAILED, "A message")); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromExcept... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateSqlTimeoutResponse() throws Exception { Exception e = new SQLException("", "", H2_STATEMENT_WAS_CANCELED); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock(Authentication.class), e); String content = ((ByteBuf) httpResponse.get... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateNonTimeoutSqlExceptionResponse() throws Exception { Exception e = new SQLException("Another message", "", H2_STATEMENT_WAS_CANCELED + 1); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock(Authentication.class), e); String conten... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateExceptionResponse() throws Exception { Exception e = new Exception("Banother message"); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock(Authentication.class), e); String content = ((ByteBuf) httpResponse.getContent()).toString... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void shouldCreateWrappedExceptionResponse() throws Exception { Exception e = new Exception(new Exception(new Exception("Wrapped message"))); CommonResponse httpResponse = HTTP_SERVER_HANDLER.newHttpResponseFromException( mock(CommonRequest.class), mock(Authentication.class), e); String content = ((ByteBuf)... | CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if (e instanceof J... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... | CommonHandler { CommonResponse newHttpResponseFromException(CommonRequest request, Authentication authentication, Exception exception) throws Exception { Exception e = exception; if (e instanceof InvocationTargetException) { Throwable cause = e.getCause(); if (cause instanceof Exception) { e = (Exception) cause; } } if... |
@Test public void testWithoutDefaults() throws Exception { SmtpConfigDto configDto = ImmutableSmtpConfigDto.builder() .host("localhost") .username("") .passwordExists(false) .fromEmailAddress("from@example.org") .fromDisplayName("From Example") .version("1234") .testEmailRecipient("to@example.org") .build(); adminJsonS... | @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) { configDtoWithoutNe... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... |
@Test public void testWithDefaultFrom() throws Exception { SmtpConfigDto configDto = ImmutableSmtpConfigDto.builder() .host("localhost") .username("") .passwordExists(false) .fromEmailAddress("") .fromDisplayName("From Example") .version("1234") .testEmailRecipient("to@example.org") .build(); adminJsonService.sendTestE... | @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) { configDtoWithoutNe... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... |
@Test public void testWithDefaultFromAndDefaultDisplayName() throws Exception { SmtpConfigDto configDto = ImmutableSmtpConfigDto.builder() .host("localhost") .username("") .passwordExists(false) .fromEmailAddress("") .fromDisplayName("") .version("1234") .testEmailRecipient("to@example.org") .build(); adminJsonService.... | @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) { configDtoWithoutNe... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... | AdminJsonService { @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp") String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException { SmtpConfigDto configDtoWithoutNewPassword; String passwordOverride; String newPassword = configDto.newPassword(); if (newPassword.isEmpty()) {... |
@Test public void shouldNotFindServletResponseClass() { assertThat(ResponseInvoker.getServletResponseClass(Object.class)).isNull(); } | static @Nullable Class<?> getServletResponseClass(Class<?> clazz) { try { return Class.forName("javax.servlet.ServletResponse", false, clazz.getClassLoader()); } catch (ClassNotFoundException e) { logger.warn(e.getMessage(), e); } return null; } | ResponseInvoker { static @Nullable Class<?> getServletResponseClass(Class<?> clazz) { try { return Class.forName("javax.servlet.ServletResponse", false, clazz.getClassLoader()); } catch (ClassNotFoundException e) { logger.warn(e.getMessage(), e); } return null; } } | ResponseInvoker { static @Nullable Class<?> getServletResponseClass(Class<?> clazz) { try { return Class.forName("javax.servlet.ServletResponse", false, clazz.getClassLoader()); } catch (ClassNotFoundException e) { logger.warn(e.getMessage(), e); } return null; } ResponseInvoker(Class<?> clazz); } | ResponseInvoker { static @Nullable Class<?> getServletResponseClass(Class<?> clazz) { try { return Class.forName("javax.servlet.ServletResponse", false, clazz.getClassLoader()); } catch (ClassNotFoundException e) { logger.warn(e.getMessage(), e); } return null; } ResponseInvoker(Class<?> clazz); } | ResponseInvoker { static @Nullable Class<?> getServletResponseClass(Class<?> clazz) { try { return Class.forName("javax.servlet.ServletResponse", false, clazz.getClassLoader()); } catch (ClassNotFoundException e) { logger.warn(e.getMessage(), e); } return null; } ResponseInvoker(Class<?> clazz); } |
@Test public void shouldNotFindGetContentTypeMethod() { assertThat(new ResponseInvoker(Object.class).hasGetContentTypeMethod()).isFalse(); } | boolean hasGetContentTypeMethod() { return getContentTypeMethod != null; } | ResponseInvoker { boolean hasGetContentTypeMethod() { return getContentTypeMethod != null; } } | ResponseInvoker { boolean hasGetContentTypeMethod() { return getContentTypeMethod != null; } ResponseInvoker(Class<?> clazz); } | ResponseInvoker { boolean hasGetContentTypeMethod() { return getContentTypeMethod != null; } ResponseInvoker(Class<?> clazz); } | ResponseInvoker { boolean hasGetContentTypeMethod() { return getContentTypeMethod != null; } ResponseInvoker(Class<?> clazz); } |
@Test public void should() { assertThat(ResourceMethodMeta.combine(null, null)).isEqualTo("/"); assertThat(ResourceMethodMeta.combine("", null)).isEqualTo("/"); assertThat(ResourceMethodMeta.combine(null, "")).isEqualTo("/"); assertThat(ResourceMethodMeta.combine("", "")).isEqualTo("/"); assertThat(ResourceMethodMeta.c... | static String combine(@Nullable String classPath, @Nullable String methodPath) { if (classPath == null || classPath.isEmpty() || classPath.equals("/")) { return normalize(methodPath); } if (methodPath == null || methodPath.isEmpty() || methodPath.equals("/")) { return normalize(classPath); } return normalize(classPath)... | ResourceMethodMeta { static String combine(@Nullable String classPath, @Nullable String methodPath) { if (classPath == null || classPath.isEmpty() || classPath.equals("/")) { return normalize(methodPath); } if (methodPath == null || methodPath.isEmpty() || methodPath.equals("/")) { return normalize(classPath); } return... | ResourceMethodMeta { static String combine(@Nullable String classPath, @Nullable String methodPath) { if (classPath == null || classPath.isEmpty() || classPath.equals("/")) { return normalize(methodPath); } if (methodPath == null || methodPath.isEmpty() || methodPath.equals("/")) { return normalize(classPath); } return... | ResourceMethodMeta { static String combine(@Nullable String classPath, @Nullable String methodPath) { if (classPath == null || classPath.isEmpty() || classPath.equals("/")) { return normalize(methodPath); } if (methodPath == null || methodPath.isEmpty() || methodPath.equals("/")) { return normalize(classPath); } return... | ResourceMethodMeta { static String combine(@Nullable String classPath, @Nullable String methodPath) { if (classPath == null || classPath.isEmpty() || classPath.equals("/")) { return normalize(methodPath); } if (methodPath == null || methodPath.isEmpty() || methodPath.equals("/")) { return normalize(classPath); } return... |
@Test public void shouldNotSendMailForTransactionAlert() throws Exception { setupForTransaction(999999); AlertingService alertingService = new AlertingService(configRepository, incidentRepository, aggregateRepository, gaugeValueRepository, rollupLevelService, mailService, httpClient, newLockSet(), newLockSet(), Clock.s... | public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricService.getMetricValue... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... |
@Test public void testEmpty() { Object[] args = RateLimitedLogger.newArgsWithCountSinceLastWarning(new Object[] {}, 0); assertThat(args).containsExactly(0); } | @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable) { System.arraycopy(... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... |
@Test public void testSingle() { Object[] args = RateLimitedLogger.newArgsWithCountSinceLastWarning(new Object[] {1}, 0); assertThat(args).containsExactly(1, 0); } | @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable) { System.arraycopy(... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... |
@Test public void testSingleException() { Exception exception = new Exception(); Object[] args = RateLimitedLogger.newArgsWithCountSinceLastWarning(new Object[] {exception}, 0); assertThat(args).containsExactly(0, exception); } | @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable) { System.arraycopy(... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... |
@Test public void testMultiple() { Object[] args = RateLimitedLogger.newArgsWithCountSinceLastWarning(new Object[] {1, 2}, 0); assertThat(args).containsExactly(1, 2, 0); } | @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable) { System.arraycopy(... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... |
@Test public void testMultipleException() { Exception exception = new Exception(); Object[] args = RateLimitedLogger.newArgsWithCountSinceLastWarning(new Object[] {1, exception}, 0); assertThat(args).containsExactly(1, 0, exception); } | @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable) { System.arraycopy(... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... | RateLimitedLogger { @VisibleForTesting static @Nullable Object[] newArgsWithCountSinceLastWarning( Object[] args, int countSinceLastWarning) { if (args.length == 0) { return new Object[] {countSinceLastWarning}; } @Nullable Object[] argsPlus = new Object[args.length + 1]; if (args[args.length - 1] instanceof Throwable)... |
@Test public void shouldSendMailForGaugeAlert() throws Exception { setupForGauge(500); AlertingService alertingService = new AlertingService(configRepository, incidentRepository, aggregateRepository, gaugeValueRepository, rollupLevelService, mailService, httpClient, newLockSet(), newLockSet(), Clock.systemClock()); ale... | public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricService.getMetricValue... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... |
@Test public void testNullVersion() { assertThat(JavaVersion.parseIsJava6(null)).isFalse(); } | @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } |
@Test public void testCorrectVersion() { assertThat(JavaVersion.parseIsJava6("1.6")).isTrue(); assertThat(JavaVersion.parseIsJava6("1.6.0")).isTrue(); assertThat(JavaVersion.parseIsJava6("1.6.0_45")).isTrue(); } | @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } |
@Test public void testIncorrectVersion() { assertThat(JavaVersion.parseIsJava6("1.5")).isFalse(); assertThat(JavaVersion.parseIsJava6("1.7")).isFalse(); assertThat(JavaVersion.parseIsJava6("1.7.0")).isFalse(); assertThat(JavaVersion.parseIsJava6("1.8.0")).isFalse(); } | @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } | JavaVersion { @VisibleForTesting static boolean parseIsJava6(@Nullable String javaVersion) { return javaVersion != null && javaVersion.startsWith("1.6"); } private JavaVersion(); static boolean isJava6(); static boolean isGreaterThanOrEqualToJava9(); static boolean isIbmJvm(); static boolean isJRockitJvm(); } |
@Test public void testCollectAggregates() throws Exception { CollectorProxy collectorProxy = new CollectorProxy(); AggregateReader aggregateReader1 = mock(AggregateReader.class); AggregateReader aggregateReader2 = mock(AggregateReader.class); AggregateReader aggregateReader3 = mock(AggregateReader.class); collectorProx... | @Override public void collectAggregates(AggregateReader aggregateReader) throws Exception { if (instance == null) { earlyAggregateReaders.offer(aggregateReader); if (instance != null) { earlyAggregateReaders.remove(aggregateReader); instance.collectAggregates(aggregateReader); } } else { instance.collectAggregates(aggr... | CollectorProxy implements Collector { @Override public void collectAggregates(AggregateReader aggregateReader) throws Exception { if (instance == null) { earlyAggregateReaders.offer(aggregateReader); if (instance != null) { earlyAggregateReaders.remove(aggregateReader); instance.collectAggregates(aggregateReader); } } ... | CollectorProxy implements Collector { @Override public void collectAggregates(AggregateReader aggregateReader) throws Exception { if (instance == null) { earlyAggregateReaders.offer(aggregateReader); if (instance != null) { earlyAggregateReaders.remove(aggregateReader); instance.collectAggregates(aggregateReader); } } ... | CollectorProxy implements Collector { @Override public void collectAggregates(AggregateReader aggregateReader) throws Exception { if (instance == null) { earlyAggregateReaders.offer(aggregateReader); if (instance != null) { earlyAggregateReaders.remove(aggregateReader); instance.collectAggregates(aggregateReader); } } ... | CollectorProxy implements Collector { @Override public void collectAggregates(AggregateReader aggregateReader) throws Exception { if (instance == null) { earlyAggregateReaders.offer(aggregateReader); if (instance != null) { earlyAggregateReaders.remove(aggregateReader); instance.collectAggregates(aggregateReader); } } ... |
@Test public void testCollectGaugeValues() throws Exception { CollectorProxy collectorProxy = new CollectorProxy(); @SuppressWarnings("unchecked") List<GaugeValue> gaugeValues1 = mock(List.class); @SuppressWarnings("unchecked") List<GaugeValue> gaugeValues2 = mock(List.class); @SuppressWarnings("unchecked") List<GaugeV... | @Override public void collectGaugeValues(List<GaugeValue> gaugeValues) throws Exception { if (instance == null) { earlyGaugeValues.offer(gaugeValues); if (instance != null) { earlyGaugeValues.remove(gaugeValues); instance.collectGaugeValues(gaugeValues); } } else { instance.collectGaugeValues(gaugeValues); } } | CollectorProxy implements Collector { @Override public void collectGaugeValues(List<GaugeValue> gaugeValues) throws Exception { if (instance == null) { earlyGaugeValues.offer(gaugeValues); if (instance != null) { earlyGaugeValues.remove(gaugeValues); instance.collectGaugeValues(gaugeValues); } } else { instance.collect... | CollectorProxy implements Collector { @Override public void collectGaugeValues(List<GaugeValue> gaugeValues) throws Exception { if (instance == null) { earlyGaugeValues.offer(gaugeValues); if (instance != null) { earlyGaugeValues.remove(gaugeValues); instance.collectGaugeValues(gaugeValues); } } else { instance.collect... | CollectorProxy implements Collector { @Override public void collectGaugeValues(List<GaugeValue> gaugeValues) throws Exception { if (instance == null) { earlyGaugeValues.offer(gaugeValues); if (instance != null) { earlyGaugeValues.remove(gaugeValues); instance.collectGaugeValues(gaugeValues); } } else { instance.collect... | CollectorProxy implements Collector { @Override public void collectGaugeValues(List<GaugeValue> gaugeValues) throws Exception { if (instance == null) { earlyGaugeValues.offer(gaugeValues); if (instance != null) { earlyGaugeValues.remove(gaugeValues); instance.collectGaugeValues(gaugeValues); } } else { instance.collect... |
@Test public void testCollectTrace() throws Exception { CollectorProxy collectorProxy = new CollectorProxy(); TraceReader traceReader1 = mock(TraceReader.class); TraceReader traceReader2 = mock(TraceReader.class); TraceReader traceReader3 = mock(TraceReader.class); collectorProxy.collectTrace(traceReader1); collectorPr... | @Override public void collectTrace(TraceReader traceReader) throws Exception { if (instance == null) { earlyTraceReaders.offer(traceReader); if (instance != null) { earlyTraceReaders.remove(traceReader); instance.collectTrace(traceReader); } } else { instance.collectTrace(traceReader); } } | CollectorProxy implements Collector { @Override public void collectTrace(TraceReader traceReader) throws Exception { if (instance == null) { earlyTraceReaders.offer(traceReader); if (instance != null) { earlyTraceReaders.remove(traceReader); instance.collectTrace(traceReader); } } else { instance.collectTrace(traceRead... | CollectorProxy implements Collector { @Override public void collectTrace(TraceReader traceReader) throws Exception { if (instance == null) { earlyTraceReaders.offer(traceReader); if (instance != null) { earlyTraceReaders.remove(traceReader); instance.collectTrace(traceReader); } } else { instance.collectTrace(traceRead... | CollectorProxy implements Collector { @Override public void collectTrace(TraceReader traceReader) throws Exception { if (instance == null) { earlyTraceReaders.offer(traceReader); if (instance != null) { earlyTraceReaders.remove(traceReader); instance.collectTrace(traceReader); } } else { instance.collectTrace(traceRead... | CollectorProxy implements Collector { @Override public void collectTrace(TraceReader traceReader) throws Exception { if (instance == null) { earlyTraceReaders.offer(traceReader); if (instance != null) { earlyTraceReaders.remove(traceReader); instance.collectTrace(traceReader); } } else { instance.collectTrace(traceRead... |
@Test public void testLog() throws Exception { CollectorProxy collectorProxy = new CollectorProxy(); LogEvent logEvent1 = LogEvent.newBuilder() .setMessage("one") .build(); LogEvent logEvent2 = LogEvent.newBuilder() .setMessage("two") .build(); LogEvent logEvent3 = LogEvent.newBuilder() .setMessage("three") .build(); c... | @Override public void log(LogEvent logEvent) throws Exception { if (instance == null) { earlyLogEvents.offer(logEvent); if (instance != null) { earlyLogEvents.remove(logEvent); instance.log(logEvent); } } else { instance.log(logEvent); } } | CollectorProxy implements Collector { @Override public void log(LogEvent logEvent) throws Exception { if (instance == null) { earlyLogEvents.offer(logEvent); if (instance != null) { earlyLogEvents.remove(logEvent); instance.log(logEvent); } } else { instance.log(logEvent); } } } | CollectorProxy implements Collector { @Override public void log(LogEvent logEvent) throws Exception { if (instance == null) { earlyLogEvents.offer(logEvent); if (instance != null) { earlyLogEvents.remove(logEvent); instance.log(logEvent); } } else { instance.log(logEvent); } } } | CollectorProxy implements Collector { @Override public void log(LogEvent logEvent) throws Exception { if (instance == null) { earlyLogEvents.offer(logEvent); if (instance != null) { earlyLogEvents.remove(logEvent); instance.log(logEvent); } } else { instance.log(logEvent); } } @Override void init(File confDir, @Nullab... | CollectorProxy implements Collector { @Override public void log(LogEvent logEvent) throws Exception { if (instance == null) { earlyLogEvents.offer(logEvent); if (instance != null) { earlyLogEvents.remove(logEvent); instance.log(logEvent); } } else { instance.log(logEvent); } } @Override void init(File confDir, @Nullab... |
@Test public void shouldCaptureNonCounterGauge() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("test:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .build(); when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString())) .thenReturn... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldNotSendMailForGaugeAlert() throws Exception { setupForGauge(499); AlertingService alertingService = new AlertingService(configRepository, incidentRepository, aggregateRepository, gaugeValueRepository, rollupLevelService, mailService, httpClient, newLockSet(), newLockSet(), Clock.systemClock()); ... | public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricService.getMetricValue... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... |
@Test public void shouldNotCaptureCounterGauge() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("test:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", true)) .build(); when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString())) .thenReturn(... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldCaptureCounterGauge() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("test:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", true)) .build(); when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString())) .thenReturn(555... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleInvalidMBeanObjectName() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("invalid mbean object name") .build(); List<GaugeValue> gaugeValues = gaugeCollector.collectGaugeValues(gaugeConfig); assertThat(gaugeValues).isEmpty(); verify(logger).debu... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(c... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanInstanceNotFoundAfterLoggingDelay() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(cl... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanInstanceNotFoundBeforeAndAfterLoggingDelay() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build()... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanAttributeNotFound() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(lazyPlatformMBeanS... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanAttributeOtherException() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(lazyPlatform... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanAttributeNotANumber() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(lazyPlatformMBea... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldHandleMBeanAttributeNotANumberOrString() throws Exception { GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder() .mbeanObjectName("xyz:aaa=bbb") .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false)) .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false)) .build(); when(lazyPlat... | @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName); } catch (MalformedObjectNameException e)... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... | GaugeCollector extends ScheduledRunnable { @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig) throws Exception { String mbeanObjectName = gaugeConfig.mbeanObjectName(); ObjectName objectName; try { objectName = ObjectName.getInstance(mbeanObjectName... |
@Test public void shouldSendMailForLowerBoundGaugeAlert() throws Exception { setupForGauge(500); AlertingService alertingService = new AlertingService(configRepository, incidentRepository, aggregateRepository, gaugeValueRepository, rollupLevelService, mailService, httpClient, newLockSet(), newLockSet(), Clock.systemClo... | public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricService.getMetricValue... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... |
@Test public void testUpgradeToCollectorAddress() { List<String> lines = ImmutableList.of("before=test", "collector.host=localhost", "collector.port=8181", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "collector.addre... | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressBothEmpty() { List<String> lines = ImmutableList.of("before=test", "collector.host=", "collector.port=", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "collector.address="... | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressBothMissing() { List<String> lines = ImmutableList.of("before=test", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "after=test"); } | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressOnlyHostEmpty() { List<String> lines = ImmutableList.of("before=test", "collector.host=", "collector.port=8181", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "collector.a... | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressOnlyPortEmpty() { List<String> lines = ImmutableList.of("before=test", "collector.host=localhost", "collector.port=", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "collec... | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressOnlyHostMissing() { List<String> lines = ImmutableList.of("before=test", "collector.port=8181", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "after=test"); } | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressOnlyPortMissing() { List<String> lines = ImmutableList.of("before=test", "collector.host=localhost", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).containsExactly("before=test", "collector.address=local... | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testUpgradeToCollectorAddressNotNeeded() { List<String> lines = ImmutableList.of("before=test", "collector.address=xyz:1234", "after=test"); List<String> newLines = MainEntryPoint.upgradeToCollectorAddressIfNeeded(lines); assertThat(newLines).isEqualTo(lines); } | private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } } | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... | MainEntryPoint { private static void upgradeToCollectorAddressIfNeeded(File propFile) throws IOException { List<String> lines = readPropertiesFile(propFile); List<String> newLines = upgradeToCollectorAddressIfNeeded(lines); if (!newLines.equals(lines)) { writePropertiesFile(propFile, newLines); } } private MainEntryPo... |
@Test public void testSorting() { List<PluginDescriptor> pluginDescriptors = Lists.newArrayList(); pluginDescriptors.add(pluginDescriptorWithName("Zzz")); pluginDescriptors.add(pluginDescriptorWithName("Yyy Plugin")); pluginDescriptors.add(pluginDescriptorWithName("Xxx plugin")); pluginDescriptors.add(pluginDescriptorW... | public abstract String name(); | PluginDescriptor { public abstract String name(); } | PluginDescriptor { public abstract String name(); } | PluginDescriptor { public abstract String name(); abstract String id(); abstract String name(); abstract ImmutableList<PropertyDescriptor> properties(); @JsonProperty("instrumentation") abstract ImmutableList<InstrumentationConfig> instrumentationConfigs(); abstract ImmutableList<String> aspects(); static PluginDescri... | PluginDescriptor { public abstract String name(); abstract String id(); abstract String name(); abstract ImmutableList<PropertyDescriptor> properties(); @JsonProperty("instrumentation") abstract ImmutableList<InstrumentationConfig> instrumentationConfigs(); abstract ImmutableList<String> aspects(); static PluginDescri... |
@Test public void shouldEscape() { assertThat(CentralCollector.escapeHostName("")).isEqualTo(""); assertThat(CentralCollector.escapeHostName("abc")).isEqualTo("abc"); assertThat(CentralCollector.escapeHostName("a:b:c")).isEqualTo("a:b:c"); assertThat(CentralCollector.escapeHostName(":a:b:c:")).isEqualTo("\\:a:b:c:"); a... | @VisibleForTesting static String escapeHostName(String hostName) { hostName = hostName.replace("\\", "\\\\"); if (hostName.startsWith(":")) { hostName = "\\" + hostName; } while (hostName.contains("::")) { hostName = hostName.replace("::", ":\\:"); } return hostName; } | CentralCollector implements Collector { @VisibleForTesting static String escapeHostName(String hostName) { hostName = hostName.replace("\\", "\\\\"); if (hostName.startsWith(":")) { hostName = "\\" + hostName; } while (hostName.contains("::")) { hostName = hostName.replace("::", ":\\:"); } return hostName; } } | CentralCollector implements Collector { @VisibleForTesting static String escapeHostName(String hostName) { hostName = hostName.replace("\\", "\\\\"); if (hostName.startsWith(":")) { hostName = "\\" + hostName; } while (hostName.contains("::")) { hostName = hostName.replace("::", ":\\:"); } return hostName; } CentralCol... | CentralCollector implements Collector { @VisibleForTesting static String escapeHostName(String hostName) { hostName = hostName.replace("\\", "\\\\"); if (hostName.startsWith(":")) { hostName = "\\" + hostName; } while (hostName.contains("::")) { hostName = hostName.replace("::", ":\\:"); } return hostName; } CentralCol... | CentralCollector implements Collector { @VisibleForTesting static String escapeHostName(String hostName) { hostName = hostName.replace("\\", "\\\\"); if (hostName.startsWith(":")) { hostName = "\\" + hostName; } while (hostName.contains("::")) { hostName = hostName.replace("::", ":\\:"); } return hostName; } CentralCol... |
@Test public void shouldNotSendMailForLowerBoundGaugeAlert() throws Exception { setupForGauge(501); AlertingService alertingService = new AlertingService(configRepository, incidentRepository, aggregateRepository, gaugeValueRepository, rollupLevelService, mailService, httpClient, newLockSet(), newLockSet(), Clock.system... | public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricService.getMetricValue... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... | AlertingService { public void checkMetricAlert(String centralDisplay, String agentRollupId, String agentRollupDisplay, AlertConfig alertConfig, MetricCondition metricCondition, long endTime) throws Exception { long startTime = endTime - SECONDS.toMillis(metricCondition.getTimePeriodSeconds()); Number value = metricServ... |
@Test public void testNonParseable() { assertThat(LiveJvmServiceImpl.parseProcessId("")).isNull(); assertThat(LiveJvmServiceImpl.parseProcessId("x")).isNull(); assertThat(LiveJvmServiceImpl.parseProcessId("x:y")).isNull(); assertThat(LiveJvmServiceImpl.parseProcessId("@y")).isNull(); assertThat(LiveJvmServiceImpl.parse... | @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessage(), e); return null; } } else { return null; }... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... |
@Test public void testParseable() { assertThat(LiveJvmServiceImpl.parseProcessId("123456@host")).isEqualTo(123456); } | @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessage(), e); return null; } } else { return null; }... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... | LiveJvmServiceImpl implements LiveJvmService { @VisibleForTesting static @Nullable Long parseProcessId(String runtimeName) { int index = runtimeName.indexOf('@'); if (index > 0) { String pid = runtimeName.substring(0, index); try { return Long.parseLong(pid); } catch (NumberFormatException e) { logger.debug(e.getMessag... |
@Test public void shouldReturnNullMethodWhenClassIsNull() { assertThat(Reflection.getMethod(null, null)).isNull(); } | public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); static @Nullable Method getMethod(@Nullable ... | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); static @Nullable Method getMethod(@Nullable ... |
@Test public void shouldReturnNullMethodWhenMethodNotFound() { assertThat(Reflection.getMethod(String.class, "thereWillNeverBeMethodWithThisName")) .isNull(); } | public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); } | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); static @Nullable Method getMethod(@Nullable ... | Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName); } catch (Exception e) { logger.debug(e.getMessage(), e); return null; } } private Reflection(); static @Nullable Method getMethod(@Nullable ... |
@Test void objectMethods() { assertEquals(translate, translate); assertEquals(translate.hashCode(), translate.hashCode()); final Translate other = new InternationalizationServiceFactory(Locale::getDefault) .create(Translate.class, Translate.class.getClassLoader()); assertNotSame(translate, other); } | public <T> T create(final Class<T> api, final ClassLoader loader) { if (Mode.mode != Mode.UNSAFE) { if (!api.isInterface()) { throw new IllegalArgumentException(api + " is not an interface"); } if (Stream .of(api.getMethods()) .filter(m -> m.getDeclaringClass() != Object.class) .anyMatch(m -> m.getReturnType() != Strin... | InternationalizationServiceFactory { public <T> T create(final Class<T> api, final ClassLoader loader) { if (Mode.mode != Mode.UNSAFE) { if (!api.isInterface()) { throw new IllegalArgumentException(api + " is not an interface"); } if (Stream .of(api.getMethods()) .filter(m -> m.getDeclaringClass() != Object.class) .any... | InternationalizationServiceFactory { public <T> T create(final Class<T> api, final ClassLoader loader) { if (Mode.mode != Mode.UNSAFE) { if (!api.isInterface()) { throw new IllegalArgumentException(api + " is not an interface"); } if (Stream .of(api.getMethods()) .filter(m -> m.getDeclaringClass() != Object.class) .any... | InternationalizationServiceFactory { public <T> T create(final Class<T> api, final ClassLoader loader) { if (Mode.mode != Mode.UNSAFE) { if (!api.isInterface()) { throw new IllegalArgumentException(api + " is not an interface"); } if (Stream .of(api.getMethods()) .filter(m -> m.getDeclaringClass() != Object.class) .any... | InternationalizationServiceFactory { public <T> T create(final Class<T> api, final ClassLoader loader) { if (Mode.mode != Mode.UNSAFE) { if (!api.isInterface()) { throw new IllegalArgumentException(api + " is not an interface"); } if (Stream .of(api.getMethods()) .filter(m -> m.getDeclaringClass() != Object.class) .any... |
@Test void configurationInjection() { final Supplier<MyConfig> config = injector.inject(new InjectedConfig()).config; assertNotNull(config); final MyConfig configuration = config.get(); assertEquals("ok", configuration.getValue()); } | @Override public <T> T inject(final T instance) { if (instance == null) { return null; } doInject(instance.getClass(), unwrap(instance)); return instance; } | InjectorImpl implements Serializable, Injector { @Override public <T> T inject(final T instance) { if (instance == null) { return null; } doInject(instance.getClass(), unwrap(instance)); return instance; } } | InjectorImpl implements Serializable, Injector { @Override public <T> T inject(final T instance) { if (instance == null) { return null; } doInject(instance.getClass(), unwrap(instance)); return instance; } } | InjectorImpl implements Serializable, Injector { @Override public <T> T inject(final T instance) { if (instance == null) { return null; } doInject(instance.getClass(), unwrap(instance)); return instance; } @Override T inject(final T instance); } | InjectorImpl implements Serializable, Injector { @Override public <T> T inject(final T instance) { if (instance == null) { return null; } doInject(instance.getClass(), unwrap(instance)); return instance; } @Override T inject(final T instance); } |
@Test void nullDoesntFail() { assertNull(new LocalConfigurationService(singletonList(systemProperties), "LocalConfigurationServiceTest") .get("test.foo.missing")); } | @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .findFirst() .orElse(null)); } | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... |
@Test void read() { System.setProperty("LocalConfigurationServiceTest.test.foo", "1"); try { assertEquals("1", new LocalConfigurationService(singletonList(systemProperties), "LocalConfigurationServiceTest") .get("test.foo")); } finally { System.clearProperty("LocalConfigurationServiceTest.test.foo"); } } | private String read(final LocalConfiguration d, final String entryKey) { return ofNullable(d.get(entryKey)).orElseGet(() -> d.get(entryKey.replace('.', '_'))); } | LocalConfigurationService implements LocalConfiguration, Serializable { private String read(final LocalConfiguration d, final String entryKey) { return ofNullable(d.get(entryKey)).orElseGet(() -> d.get(entryKey.replace('.', '_'))); } } | LocalConfigurationService implements LocalConfiguration, Serializable { private String read(final LocalConfiguration d, final String entryKey) { return ofNullable(d.get(entryKey)).orElseGet(() -> d.get(entryKey.replace('.', '_'))); } } | LocalConfigurationService implements LocalConfiguration, Serializable { private String read(final LocalConfiguration d, final String entryKey) { return ofNullable(d.get(entryKey)).orElseGet(() -> d.get(entryKey.replace('.', '_'))); } @Override String get(final String key); @Override Set<String> keys(); } | LocalConfigurationService implements LocalConfiguration, Serializable { private String read(final LocalConfiguration d, final String entryKey) { return ofNullable(d.get(entryKey)).orElseGet(() -> d.get(entryKey.replace('.', '_'))); } @Override String get(final String key); @Override Set<String> keys(); } |
@Test void readGlobal() { System.setProperty("test.foo.LocalConfigurationServiceTest", "1"); try { assertEquals("1", new LocalConfigurationService(singletonList(systemProperties), "LocalConfigurationServiceTest") .get("test.foo.LocalConfigurationServiceTest")); } finally { System.clearProperty("test.foo.LocalConfigurat... | @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .findFirst() .orElse(null)); } | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public String get(final String key) { return rawDelegates .stream() .map(d -> read(d, plugin + "." + key)) .filter(Objects::nonNull) .findFirst() .orElseGet(() -> rawDelegates .stream() .map(d -> read(d, key)) .filter(Objects::nonNull) .f... |
@Test void keys() { System.setProperty("LocalConfigurationServiceTest.test.foo", "1"); System.setProperty("LocalConfigurationServiceTest.test.bar", "1"); try { assertEquals(Stream.of("test.foo", "test.bar").collect(toSet()), new LocalConfigurationService(singletonList(systemProperties), "LocalConfigurationServiceTest")... | @Override public Set<String> keys() { return rawDelegates .stream() .flatMap(d -> d.keys().stream()) .flatMap(k -> !k.startsWith(plugin + '.') ? Stream.of(k) : Stream.of(k, k.substring(plugin.length() + 1))) .collect(toSet()); } | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public Set<String> keys() { return rawDelegates .stream() .flatMap(d -> d.keys().stream()) .flatMap(k -> !k.startsWith(plugin + '.') ? Stream.of(k) : Stream.of(k, k.substring(plugin.length() + 1))) .collect(toSet()); } } | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public Set<String> keys() { return rawDelegates .stream() .flatMap(d -> d.keys().stream()) .flatMap(k -> !k.startsWith(plugin + '.') ? Stream.of(k) : Stream.of(k, k.substring(plugin.length() + 1))) .collect(toSet()); } } | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public Set<String> keys() { return rawDelegates .stream() .flatMap(d -> d.keys().stream()) .flatMap(k -> !k.startsWith(plugin + '.') ? Stream.of(k) : Stream.of(k, k.substring(plugin.length() + 1))) .collect(toSet()); } @Override String g... | LocalConfigurationService implements LocalConfiguration, Serializable { @Override public Set<String> keys() { return rawDelegates .stream() .flatMap(d -> d.keys().stream()) .flatMap(k -> !k.startsWith(plugin + '.') ? Stream.of(k) : Stream.of(k, k.substring(plugin.length() + 1))) .collect(toSet()); } @Override String g... |
@Test void visit() { final Collection<String> visited = new ArrayList<>(); final AtomicInteger out = new AtomicInteger(); assertEquals(3, service .visit(RecordVisitor.class .cast(Proxy .newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] { RecordVisitor.class }, (proxy, method, args) -> { vi... | @Override public <T> T visit(final RecordVisitor<T> visitor, final Record record) { final AtomicReference<T> out = new AtomicReference<>(); record.getSchema().getEntries().forEach(entry -> { switch (entry.getType()) { case INT: visitor.onInt(entry, record.getOptionalInt(entry.getName())); break; case LONG: visitor.onLo... | RecordServiceImpl implements RecordService, Serializable { @Override public <T> T visit(final RecordVisitor<T> visitor, final Record record) { final AtomicReference<T> out = new AtomicReference<>(); record.getSchema().getEntries().forEach(entry -> { switch (entry.getType()) { case INT: visitor.onInt(entry, record.getOp... | RecordServiceImpl implements RecordService, Serializable { @Override public <T> T visit(final RecordVisitor<T> visitor, final Record record) { final AtomicReference<T> out = new AtomicReference<>(); record.getSchema().getEntries().forEach(entry -> { switch (entry.getType()) { case INT: visitor.onInt(entry, record.getOp... | RecordServiceImpl implements RecordService, Serializable { @Override public <T> T visit(final RecordVisitor<T> visitor, final Record record) { final AtomicReference<T> out = new AtomicReference<>(); record.getSchema().getEntries().forEach(entry -> { switch (entry.getType()) { case INT: visitor.onInt(entry, record.getOp... | RecordServiceImpl implements RecordService, Serializable { @Override public <T> T visit(final RecordVisitor<T> visitor, final Record record) { final AtomicReference<T> out = new AtomicReference<>(); record.getSchema().getEntries().forEach(entry -> { switch (entry.getType()) { case INT: visitor.onInt(entry, record.getOp... |
@Test void buildRecord() { final Schema customSchema = factory .newSchemaBuilder(baseSchema) .withEntry(factory.newEntryBuilder().withName("custom").withType(STRING).withNullable(true).build()) .build(); final List<Collection<String>> spy = asList(new LinkedList<>(), new LinkedList<>()); final Record noCustomRecord = s... | @Override public Record create(final Schema schema, final Record fallbackRecord, final BiFunction<Schema.Entry, Record.Builder, Boolean> customHandler, final BiConsumer<Record.Builder, Boolean> beforeFinish) { return fallbackRecord .getSchema() .getEntries() .stream() .collect(toRecord(schema, fallbackRecord, customHan... | RecordServiceImpl implements RecordService, Serializable { @Override public Record create(final Schema schema, final Record fallbackRecord, final BiFunction<Schema.Entry, Record.Builder, Boolean> customHandler, final BiConsumer<Record.Builder, Boolean> beforeFinish) { return fallbackRecord .getSchema() .getEntries() .s... | RecordServiceImpl implements RecordService, Serializable { @Override public Record create(final Schema schema, final Record fallbackRecord, final BiFunction<Schema.Entry, Record.Builder, Boolean> customHandler, final BiConsumer<Record.Builder, Boolean> beforeFinish) { return fallbackRecord .getSchema() .getEntries() .s... | RecordServiceImpl implements RecordService, Serializable { @Override public Record create(final Schema schema, final Record fallbackRecord, final BiFunction<Schema.Entry, Record.Builder, Boolean> customHandler, final BiConsumer<Record.Builder, Boolean> beforeFinish) { return fallbackRecord .getSchema() .getEntries() .s... | RecordServiceImpl implements RecordService, Serializable { @Override public Record create(final Schema schema, final Record fallbackRecord, final BiFunction<Schema.Entry, Record.Builder, Boolean> customHandler, final BiConsumer<Record.Builder, Boolean> beforeFinish) { return fallbackRecord .getSchema() .getEntries() .s... |
@Test void mustRemoved() { final boolean[] mustRemoved = new boolean[] { false }; this.interval = 100; this.simulateCurrent = 100L; final String v1 = cache.computeIfAbsent(String.class, "key1", (Element e) -> mustRemoved[0], () -> "value1"); final String v2 = cache.computeIfAbsent(String.class, "key1", () -> "value2");... | @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (maxSize > 0 && this.cache.size() >= maxSize) { this.clean... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... |
@Test void localTimeout() throws InterruptedException { final String v1 = cache.computeIfAbsent(String.class, "key1", 200L, () -> "value1"); final String v2 = cache.computeIfAbsent(String.class, "key1", 200L, () -> "value2"); final String valueKey2 = cache.computeIfAbsent(String.class, "key2", -1L, () -> "valueKey2"); ... | @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (maxSize > 0 && this.cache.size() >= maxSize) { this.clean... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... |
@Test void timeoutAuto() { this.interval = 200; final CountDownLatch latch = new CountDownLatch(1); final long start = System.currentTimeMillis(); String value = cache.computeIfAbsent(String.class, "foo", (Element e) -> { latch.countDown(); return true; }, () -> "bar"); assertEquals("bar", value); final String v2 = cac... | @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (maxSize > 0 && this.cache.size() >= maxSize) { this.clean... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... |
@Test void convertListObject(final JsonBuilderFactory jsonBuilderFactory, final JsonProvider jsonProvider, final RecordBuilderFactory recordBuilderFactory, final RecordConverters converter) throws Exception { try (final Jsonb jsonb = JsonbBuilder.create()) { final Record record = converter .toRecord(new RecordConverter... | public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data); } if (JsonObject.class.isInstance(data))... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... |
@Test public void evictionAuto() { this.defaultMaxSize = 10; for (int i = 0; i < 20; i++) { cache.computeIfAbsent(String.class, "k" + i, (Element e) -> false, -1L, () -> "val"); } Assertions.assertEquals(10, this.cacheSize()); } | @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (maxSize > 0 && this.cache.size() >= maxSize) { this.clean... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... | LocalCacheService implements LocalCache, Serializable { @Override public <T> T computeIfAbsent(final Class<T> expectedClass, final String key, final Predicate<Element> toRemove, final long timeoutMs, final Supplier<T> value) { final Integer maxSize = this.getConfigValue(CacheConfiguration::getDefaultMaxSize, -1); if (m... |
@Test void parseQuery() throws UnsupportedEncodingException { assertEquals(emptyMap(), DSLParser.parse("foo: assertEquals(singletonMap("a", "b"), DSLParser.parse("foo: final String url = "jdbc: assertEquals(singletonMap("configuration.url", url), DSLParser.parse("foo: assertEquals(new HashMap<String, String>() { { put(... | private static Map<String, String> parseQuery(final String query) { final Map<String, String> parameters = new HashMap<>(); if (query == null || query.trim().isEmpty()) { return parameters; } final byte[] bytes = query.getBytes(StandardCharsets.UTF_8); int pos = 0; int end = bytes.length; String name; String value; whi... | DSLParser { private static Map<String, String> parseQuery(final String query) { final Map<String, String> parameters = new HashMap<>(); if (query == null || query.trim().isEmpty()) { return parameters; } final byte[] bytes = query.getBytes(StandardCharsets.UTF_8); int pos = 0; int end = bytes.length; String name; Strin... | DSLParser { private static Map<String, String> parseQuery(final String query) { final Map<String, String> parameters = new HashMap<>(); if (query == null || query.trim().isEmpty()) { return parameters; } final byte[] bytes = query.getBytes(StandardCharsets.UTF_8); int pos = 0; int end = bytes.length; String name; Strin... | DSLParser { private static Map<String, String> parseQuery(final String query) { final Map<String, String> parameters = new HashMap<>(); if (query == null || query.trim().isEmpty()) { return parameters; } final byte[] bytes = query.getBytes(StandardCharsets.UTF_8); int pos = 0; int end = bytes.length; String name; Strin... | DSLParser { private static Map<String, String> parseQuery(final String query) { final Map<String, String> parameters = new HashMap<>(); if (query == null || query.trim().isEmpty()) { return parameters; } final byte[] bytes = query.getBytes(StandardCharsets.UTF_8); int pos = 0; int end = bytes.length; String name; Strin... |
@Test void complexTree() { try (final ComponentManager manager = new ComponentManager(new File("target/foo"), "deps.txt", null)) { final String plugin = manager.addPlugin(jarLocation(RepositoryModelBuilderTest.class).getAbsolutePath()); final RepositoryModel model = manager.findPlugin(plugin).orElseThrow(IllegalArgumen... | private ConfigKey getKey(final String family, final Map<String, String> meta) { final String configName = meta.get("tcomp::configurationtype::name"); final String configType = meta.get("tcomp::configurationtype::type"); return new ConfigKey(family, configName, configType); } | RepositoryModelBuilder { private ConfigKey getKey(final String family, final Map<String, String> meta) { final String configName = meta.get("tcomp::configurationtype::name"); final String configType = meta.get("tcomp::configurationtype::type"); return new ConfigKey(family, configName, configType); } } | RepositoryModelBuilder { private ConfigKey getKey(final String family, final Map<String, String> meta) { final String configName = meta.get("tcomp::configurationtype::name"); final String configType = meta.get("tcomp::configurationtype::type"); return new ConfigKey(family, configName, configType); } } | RepositoryModelBuilder { private ConfigKey getKey(final String family, final Map<String, String> meta) { final String configName = meta.get("tcomp::configurationtype::name"); final String configType = meta.get("tcomp::configurationtype::type"); return new ConfigKey(family, configName, configType); } RepositoryModel cr... | RepositoryModelBuilder { private ConfigKey getKey(final String family, final Map<String, String> meta) { final String configName = meta.get("tcomp::configurationtype::name"); final String configType = meta.get("tcomp::configurationtype::type"); return new ConfigKey(family, configName, configType); } RepositoryModel cr... |
@Test void notRootConfig() { final PropertyEditorRegistry registry = new PropertyEditorRegistry(); final RepositoryModel model = new RepositoryModelBuilder() .create(new ComponentManager.AllServices(emptyMap()), singleton(new ComponentFamilyMeta("test", emptyList(), "noicon", "test", "test") { { final ParameterMeta sto... | public RepositoryModel create(final ComponentManager.AllServices services, final Collection<ComponentFamilyMeta> familyMetas, final MigrationHandlerFactory migrationHandlerFactory) { final List<Family> families = familyMetas .stream() .map(familyMeta -> createConfigForFamily(services, migrationHandlerFactory, familyMet... | RepositoryModelBuilder { public RepositoryModel create(final ComponentManager.AllServices services, final Collection<ComponentFamilyMeta> familyMetas, final MigrationHandlerFactory migrationHandlerFactory) { final List<Family> families = familyMetas .stream() .map(familyMeta -> createConfigForFamily(services, migration... | RepositoryModelBuilder { public RepositoryModel create(final ComponentManager.AllServices services, final Collection<ComponentFamilyMeta> familyMetas, final MigrationHandlerFactory migrationHandlerFactory) { final List<Family> families = familyMetas .stream() .map(familyMeta -> createConfigForFamily(services, migration... | RepositoryModelBuilder { public RepositoryModel create(final ComponentManager.AllServices services, final Collection<ComponentFamilyMeta> familyMetas, final MigrationHandlerFactory migrationHandlerFactory) { final List<Family> families = familyMetas .stream() .map(familyMeta -> createConfigForFamily(services, migration... | RepositoryModelBuilder { public RepositoryModel create(final ComponentManager.AllServices services, final Collection<ComponentFamilyMeta> familyMetas, final MigrationHandlerFactory migrationHandlerFactory) { final List<Family> families = familyMetas .stream() .map(familyMeta -> createConfigForFamily(services, migration... |
@Test void testGetInputFlows() { PartitionMapperFlowsFactory factory = new PartitionMapperFlowsFactory(); Assertions.assertTrue(factory.getInputFlows().isEmpty()); } | @Override public Collection<String> getInputFlows() { return Collections.emptySet(); } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return Collections.emptySet(); } } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return Collections.emptySet(); } } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return Collections.emptySet(); } @Override Collection<String> getInputFlows(); @Override Collection<String> getOutputFlows(); } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return Collections.emptySet(); } @Override Collection<String> getInputFlows(); @Override Collection<String> getOutputFlows(); } |
@Test void testGetOutputFlows() { PartitionMapperFlowsFactory factory = new PartitionMapperFlowsFactory(); Collection<String> outputs = factory.getOutputFlows(); Assertions.assertEquals(1, outputs.size()); Assertions.assertTrue(outputs.contains("__default__")); } | @Override public Collection<String> getOutputFlows() { return Collections.singleton(Branches.DEFAULT_BRANCH); } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return Collections.singleton(Branches.DEFAULT_BRANCH); } } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return Collections.singleton(Branches.DEFAULT_BRANCH); } } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return Collections.singleton(Branches.DEFAULT_BRANCH); } @Override Collection<String> getInputFlows(); @Override Collection<String> getOutputFlows(); } | PartitionMapperFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return Collections.singleton(Branches.DEFAULT_BRANCH); } @Override Collection<String> getInputFlows(); @Override Collection<String> getOutputFlows(); } |
@Test void testGetInputFlows() { final ProcessorFlowsFactory factory = new ProcessorFlowsFactory(TestProcessor.class); final Collection<String> inputs = factory.getInputFlows(); assertEquals(2, inputs.size()); assertTrue(inputs.contains("__default__")); assertTrue(inputs.contains("REJECT")); } | @Override public Collection<String> getInputFlows() { return getListener() .map(m -> Stream.of(m.getParameters())) .orElseGet(() -> getAfterGroup().map(it -> Stream.of(it.getParameters())).orElseGet(Stream::empty)) .filter(this::isInput) .map(this::mapInputName) .collect(toList()); } | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return getListener() .map(m -> Stream.of(m.getParameters())) .orElseGet(() -> getAfterGroup().map(it -> Stream.of(it.getParameters())).orElseGet(Stream::empty)) .filter(this::isInput) .map(this::mapInputName) .collect(... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return getListener() .map(m -> Stream.of(m.getParameters())) .orElseGet(() -> getAfterGroup().map(it -> Stream.of(it.getParameters())).orElseGet(Stream::empty)) .filter(this::isInput) .map(this::mapInputName) .collect(... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return getListener() .map(m -> Stream.of(m.getParameters())) .orElseGet(() -> getAfterGroup().map(it -> Stream.of(it.getParameters())).orElseGet(Stream::empty)) .filter(this::isInput) .map(this::mapInputName) .collect(... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getInputFlows() { return getListener() .map(m -> Stream.of(m.getParameters())) .orElseGet(() -> getAfterGroup().map(it -> Stream.of(it.getParameters())).orElseGet(Stream::empty)) .filter(this::isInput) .map(this::mapInputName) .collect(... |
@Test void testGetOutputFlows() { final ProcessorFlowsFactory factory = new ProcessorFlowsFactory(TestProcessor.class); final Collection<String> outputs = factory.getOutputFlows(); assertEquals(2, outputs.size()); assertTrue(outputs.contains("__default__")); assertTrue(outputs.contains("OUTPUT")); } | @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).distinct().collect(toList()); } | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... |
@Test void testGetMergeOutputFlows() { final ProcessorFlowsFactory factory = new ProcessorFlowsFactory(TestProcessorMergeOutputs.class); final Collection<String> outputs = factory.getOutputFlows(); assertEquals(2, outputs.size()); assertTrue(outputs.contains("__default__")); assertTrue(outputs.contains("OUTPUT")); } | @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).distinct().collect(toList()); } | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... | ProcessorFlowsFactory implements FlowsFactory { @Override public Collection<String> getOutputFlows() { return concat( getListener() .map(listener -> concat(getReturnedBranches(listener), getOutputParameters(listener))) .orElseGet(Stream::empty), getAfterGroup().map(this::getOutputParameters).orElseGet(Stream::empty)).d... |
@Test void split() { final QueueMapper mapper = new QueueMapper("test", "test", "test", null); try { mapper.setState(new JobStateAware.State()); } catch (final NullPointerException npe) { } final List<Mapper> split = mapper.split(mapper.assess()); assertEquals(1, split.size()); assertEquals(mapper, split.iterator().nex... | @Override public List<Mapper> split(final long desiredSize) { return singletonList(this); } | QueueMapper implements Mapper, JobStateAware, Supplier<DIPipeline>, Delegated { @Override public List<Mapper> split(final long desiredSize) { return singletonList(this); } } | QueueMapper implements Mapper, JobStateAware, Supplier<DIPipeline>, Delegated { @Override public List<Mapper> split(final long desiredSize) { return singletonList(this); } QueueMapper(final String plugin, final String family, final String name,
final PTransform<PBegin, PCollection<Record>> transform); } | QueueMapper implements Mapper, JobStateAware, Supplier<DIPipeline>, Delegated { @Override public List<Mapper> split(final long desiredSize) { return singletonList(this); } QueueMapper(final String plugin, final String family, final String name,
final PTransform<PBegin, PCollection<Record>> transform); Strin... | QueueMapper implements Mapper, JobStateAware, Supplier<DIPipeline>, Delegated { @Override public List<Mapper> split(final long desiredSize) { return singletonList(this); } QueueMapper(final String plugin, final String family, final String name,
final PTransform<PBegin, PCollection<Record>> transform); Strin... |
@Test void bigDecimalsInArray(final JsonBuilderFactory jsonBuilderFactory, final JsonProvider jsonProvider, final RecordBuilderFactory recordBuilderFactory, final RecordConverters converter) throws Exception { final BigDecimal pos1 = new BigDecimal("48.8480275637"); final BigDecimal pos2 = new BigDecimal("2.25369456784... | public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data); } if (JsonObject.class.isInstance(data))... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... | RecordConverters implements Serializable { public <T> Record toRecord(final MappingMetaRegistry registry, final T data, final Supplier<Jsonb> jsonbProvider, final Supplier<RecordBuilderFactory> recordBuilderProvider) { if (data == null) { return null; } if (Record.class.isInstance(data)) { return Record.class.cast(data... |
@Test(timeout = 60000) public void input() { INPUT_OUTPUTS.clear(); final PipelineResult result; try (final LoopState state = LoopState.newTracker(null)) { IntStream.range(0, 2).forEach(i -> state.push(new RowStruct(i))); pipeline.apply(InMemoryQueueIO.from(state)).apply(ParDo.of(new DoFn<Record, Void>() { @ProcessElem... | public static PTransform<PBegin, PCollection<Record>> from(final LoopState state) { return Read.from(new UnboundedQueuedInput(state.id)); } | InMemoryQueueIO { public static PTransform<PBegin, PCollection<Record>> from(final LoopState state) { return Read.from(new UnboundedQueuedInput(state.id)); } } | InMemoryQueueIO { public static PTransform<PBegin, PCollection<Record>> from(final LoopState state) { return Read.from(new UnboundedQueuedInput(state.id)); } } | InMemoryQueueIO { public static PTransform<PBegin, PCollection<Record>> from(final LoopState state) { return Read.from(new UnboundedQueuedInput(state.id)); } static PTransform<PBegin, PCollection<Record>> from(final LoopState state); static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state); ... | InMemoryQueueIO { public static PTransform<PBegin, PCollection<Record>> from(final LoopState state) { return Read.from(new UnboundedQueuedInput(state.id)); } static PTransform<PBegin, PCollection<Record>> from(final LoopState state); static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state); ... |
@Test(timeout = 60000) public void output() { final Collection<Record> objects = new ArrayList<>(); try (final LoopState state = LoopState.newTracker(null)) { pipeline .apply(Create.of(IntStream.range(0, 5).mapToObj(RowStruct::new).collect(toList()))) .setCoder(SerializableCoder.of(RowStruct.class)) .apply(ParDo.of(new... | public static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state) { return new QueuedOutputTransform(state.id); } | InMemoryQueueIO { public static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state) { return new QueuedOutputTransform(state.id); } } | InMemoryQueueIO { public static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state) { return new QueuedOutputTransform(state.id); } } | InMemoryQueueIO { public static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state) { return new QueuedOutputTransform(state.id); } static PTransform<PBegin, PCollection<Record>> from(final LoopState state); static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state); } | InMemoryQueueIO { public static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state) { return new QueuedOutputTransform(state.id); } static PTransform<PBegin, PCollection<Record>> from(final LoopState state); static PTransform<PCollection<Record>, PCollection<Void>> to(final LoopState state); ... |
@Test void openapi(final WebTarget target) throws IOException { final ProjectModel projectModel = new ProjectModel(); projectModel.setBuildType("maven"); projectModel.setPackageBase("com.test.openapi"); projectModel.setFamily("SimpleAPI"); try (final InputStream openapiJson = Thread.currentThread().getContextClassLoade... | @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"... | ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orEl... | ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orEl... | ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orEl... | ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orEl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.