Skip to content

Instantly share code, notes, and snippets.

@ttddyy
ttddyy / xenon-release-perform.sh
Created March 22, 2016 22:14
Perform release for xenon
#! /bin/sh -xe
# Perform release for xenon
# - create branch and tag in gerrit
# - deploy artifacts to OSS Sonatype staging repo
#
# TODO: change to receive args and validate
#
XENON_LOCAL_REPO=/Users/ttsuyukubo/repo/vmw/xenon-release
RELEASE_VERSION=0.7.5
@ttddyy
ttddyy / xenon-sync-check.sh
Created April 9, 2016 05:20
Check xenon artifacts sync status in maven central
#! /bin/sh
# Check xenon artifacts sync status in maven central
# Tip: use watch command to periodically run this command
# > watch -n 30 confirm-central-sync.sh 0.7.6
if [ "$#" -ne 1 ]; then
echo "Usage: $0 VERSION-TO-CHECK" >&2
exit 1
fi
@ttddyy
ttddyy / TestContext.java
Created August 3, 2016 04:30
test wait for async framework(vmware/xenon)
public class TestContext {
private CountDownLatch latch;
private LocalDateTime expireAt;
private volatile Throwable error;
public TestContext(int count) {
this(count, XenonTestConfig.timeoutStrategy.getTimeout());
}
public TestContext(int count, Duration duration) {
public class MyLogEntryCreator extends DefaultQueryLogEntryCreator {
private boolean writeDataSourcename = false;
private boolean writeConnectionId = true;
public String getLogEntry(String sessionId, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
StringBuilder sb = new StringBuilder();
sb.append("SessionId=" + sessionId);
sb.append(" ");
sb.append(super.getLogEntry(execInfo, queryInfoList, this.writeDataSourcename, this.writeConnectionId));
@ttddyy
ttddyy / pointcut.java
Created February 4, 2019 22:54
Wrap result of ConnectionFactory#create()
class Pointcut {
// pointcut for ConnectionFactory#create() method
public Publisher<? extends Connection> pointcut() {
Publisher<? extends Connection> result = null; // actual result of "ConnectionFactory#create()"
ProxyFactory proxyFactory = null; // need to construct
// return wrapped one
return Flux.from(result)
@ttddyy
ttddyy / ByteBuddyProxyFactory.java
Created February 7, 2019 06:58
ProxyFactory implementation with Byte Buddy
package io.r2dbc.examples;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import io.r2dbc.proxy.callback.BatchCallbackHandler;
import io.r2dbc.proxy.callback.CallbackHandler;
import io.r2dbc.proxy.callback.ConnectionCallbackHandler;
import io.r2dbc.proxy.callback.ConnectionFactoryCallbackHandler;
import io.r2dbc.proxy.callback.ProxyConfig;
@ttddyy
ttddyy / Application.java
Created May 2, 2019 00:58
bind parameter converter sample
/**
* @author Tadaya Tsuyukubo
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setWebApplicationType(WebApplicationType.NONE);
app.run(args);
@ttddyy
ttddyy / gist:4b3beb9806ded3b02c2b909e5044b989
Created January 17, 2020 21:19
ConcurrentModificationException with "r2dbc-postgresql=0.8.0"
java.util.ConcurrentModificationException: null
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134) ~[na:na]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ SQL "INSERT INTO city (name, country) VALUES ($1, $2)" [DatabaseClient]
Stack trace:
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134) ~[na:na]
at io.r2dbc.postgresql.IndefiniteStatementCache.getName(IndefiniteStatementCache.java:49) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
at io.r2dbc.postgresql.ExtendedQueryPostgresqlStatement.execute(ExtendedQueryPostgresqlStatement.java:184) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
at io.r2dbc.postgresql.ExtendedQueryPostgresqlStatement.execute(ExtendedQueryPostgresqlStatement.java:123) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
@ttddyy
ttddyy / PropertyValidationListener.java
Created November 8, 2020 22:45
Check the usage of deprecated properties at start up
package com.example.analysis;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ttddyy
ttddyy / MyImageNameSubstitutor.java
Created November 13, 2020 00:29
MyImageNameSubstitutor.java
@Slf4j
public class MyImageNameSubstitutor extends ImageNameSubstitutor {
public static final String ENV_VAR_KEY = "MY_TESTCONTAINERS_REGISTRY";
public static final String SYSTEM_PROP_KEY = "my.testcontainers.registry";
public static final String DEFAULT_REGISTRY = "sample.com/";
protected String registryUrl;