Skip to content

Instantly share code, notes, and snippets.

View odrotbohm's full-sized avatar
👨‍💻
@ home

Oliver Drotbohm odrotbohm

👨‍💻
@ home
View GitHub Profile
@odrotbohm
odrotbohm / ConcreteTest.java
Created August 10, 2013 13:44
Sample code to show apparent bug in Spring test context framework
@Transactional
public class ConcreteTest extends TestBase {
@Before
public void setUp() {
// Create sample data in the database
}
// Further test methods
}
@odrotbohm
odrotbohm / gist:6193121
Created August 9, 2013 12:06
Optional sample
public Location whereIs( String employeeName ){
employeeDAO.findProjectFor(employeeName)
.map( p -> ProjectDAO.findCustomerFor( p ) )
.map( c -> CustomerDAO.findLocationFor( c ) )
.orElse( HomeBase.Location );
}
@Test
public void foo() {
TypeBasedAggregationOperationContext context = new TypeBasedAggregationOperationContext(Foo.class,
new MongoMappingContext(), new QueryMapper(converter));
Aggregation aggregation = newAggregation(Foo.class, group("bar.name"));
aggregation.toDbObject("foo", context);
}
/*
* Copyright 2008-2013 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
$ ps -xo pid,ppid,stat,command | grep Skype
85267 185 ?E (Skype)
79202 339 R+ grep Skype
$ kill -9 85267
$ ps -xo pid,ppid,stat,command | grep Skype
85267 185 ?E (Skype)
79220 339 R+ grep Skype
[INFO] Surefire report directory: /Users/olivergierke/Documents/workspace/spring-data-couchbase/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.springframework.data.couchbase.cache.CouchbaseCacheManagerTests
2013-07-29 10:49:10,346 INFO ontext.support.GenericApplicationContext: 503 - Refreshing org.springframework.context.support.GenericApplicationContext@2880cac9: startup date [Mon Jul 29 10:49:10 CEST 2013]; root of context hierarchy
2013-07-29 10:49:10,836 INFO ctory.support.DefaultListableBeanFactory: 577 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@627a4489: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotat
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Polyglot Tesla :: Aggregator ...................... SUCCESS [3.804s]
[INFO] Polyglot Tesla :: Common .......................... SUCCESS [18.580s]
[INFO] Polyglot Tesla :: Atom ............................ SUCCESS [10.898s]
[INFO] Polyglot Tesla :: Ruby ............................ FAILURE [15.009s]
[INFO] Polyglot Tesla :: Groovy .......................... SKIPPED
[INFO] Polyglot Tesla :: YAML ............................ SKIPPED
[INFO] Polyglot Tesla :: Clojure ......................... SKIPPED
@odrotbohm
odrotbohm / MyComponentImpl.java
Last active November 3, 2020 08:22
Constructor injection example with Lombok
/**
* Sample component implementation showing the usage of constructor injection
* avoiding the need to declare a constructor by the help of Lombok. There are
* several advantages of using constructor injection over field injection:
*
* <ol>
* <li>The class communicates its dependencies. Just start with {@code new
* MyDependencyImpl(…}and your IDE will tell you what you need to hand it in. No
* need to look into the implementation of the class to discover that.</li>
* <li>The class can only be used in valid state. The constructor argument require
@MappedSuperclass
public abstract class AbstractAuditable<U, PK extends Serializable> extends AbstractPersistable<PK> implements
Auditable<U, PK> {
// …
}
@odrotbohm
odrotbohm / gist:5712700
Created June 5, 2013 09:20
STS crash dump
Process: STS [52734]
Path: /Applications/Tools/*/STS.app/Contents/MacOS/STS
Identifier: org.springsource.sts.ide
Version: 3.3.0 (3.3.0.201305210239-CI-B1145875-e38)
Code Type: X86-64 (Native)
Parent Process: launchd [177]
User ID: 501
Date/Time: 2013-06-05 11:17:02.602 +0200
OS Version: Mac OS X 10.8.3 (12D78)