Skip to content

Instantly share code, notes, and snippets.

View mp911de's full-sized avatar
🚑
I may be slow to respond…

Mark Paluch mp911de

🚑
I may be slow to respond…
View GitHub Profile
package com.example;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import java.net.UnknownHostException;
import java.util.Set;
import javax.annotation.PreDestroy;
package com.example;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import java.net.UnknownHostException;
import java.util.Set;
import javax.annotation.PreDestroy;
String id = "1";
long time = 12345L;
// CREATE TABLE timeentity (id varchar PRIMARY KEY, time time);
PreparedStatement prepare = session.prepare("INSERT INTO timeentity (id, time) values(?,?)");
BoundStatement boundStatement = prepare.bind(id, time);
session.execute(boundStatement); // works
Insert insert = QueryBuilder.insertInto("timeentity").value("id", id).value("time", time);
@mp911de
mp911de / ValidatingMongoEventListenerLazyDbRefTests-context.xml
Created June 2, 2016 15:21
Testcase to demonstrate the DATAMONGO-1393 issue
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<mongo:db-factory dbname="validation" />
<mongo:mapping-converter base-package="org.springframework.data.mongodb.core" />
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package example;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
/**
* @author Mark Paluch
*/
@mp911de
mp911de / SpringDataRedisTests.java
Last active July 1, 2016 11:43
Self-contained Spring Data Redis Test using Spring Boot
package com.example;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Configuration;
@mp911de
mp911de / SpringDataRedisTests.java
Created July 7, 2016 09:06
Testcase for DATAREDIS-531
package com.example;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import java.util.Map.Entry;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
public class CassandraInQuery {
@Autowired
CassandraOperations cassandraOperations;
@Test
public void query() {
List<String> values = Arrays.asList("one", "two", "three");
@mp911de
mp911de / ReactiveCqlTemplate.java
Created September 2, 2016 15:23
Reactive Spring Data Cassandra Experiment
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software