Skip to content

Instantly share code, notes, and snippets.

View eiswind's full-sized avatar

Thomas Kratz eiswind

View GitHub Profile
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.mockito.AdditionalAnswers;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
@eiswind
eiswind / mapstructwithprotobuf
Last active May 6, 2017 11:38
mapstruct with protobuf3
public class Proto3AccessorNamingStrategy
extends DefaultAccessorNamingStrategy {
@Override
public String getElementName(ExecutableElement adderMethod) {
String methodName =
adderMethod.getSimpleName().toString() + "List";
return Introspector.decapitalize(methodName.substring(3));
}
}
@eiswind
eiswind / BlossomReloadPlugin
Last active August 29, 2015 14:19
spring-loaded magnolia blossom plugin
package de.eiswind.magnolia.springloaded;
import info.magnolia.module.blossom.annotation.Area;
import info.magnolia.module.blossom.annotation.Template;
import info.magnolia.module.blossom.dispatcher.BlossomDispatcherInitializedEvent;
import info.magnolia.module.blossom.render.BlossomDispatcherServlet;
import org.springframework.context.ConfigurableApplicationContext;
import org.springsource.loaded.Plugins;
import org.springsource.loaded.ReloadEventProcessorPlugin;
@eiswind
eiswind / gist:319657c3f7835a023a0d
Last active August 29, 2015 14:04
Taken from the Ivy Tests: Downloading p2 artifacts
// Taken from the Ivy Tests: Downloading p2 artifacts
settings = new IvySettings();
p2SourceResolver = new UpdateSiteResolver();
p2SourceResolver.setName("p2-sources");
p2SourceResolver.setUrl(new File("test/test-p2/sources").toURI().toURL().toExternalForm());
p2SourceResolver.setSettings(settings);
settings.addResolver(p2SourceResolver);
@eiswind
eiswind / gist:5611873
Last active December 17, 2015 12:39
rap java code for select2 combo replacement
/*******************************************************************************
******************************************************************************/
package de.eiswind.mango.widgets.select2;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@eiswind
eiswind / gist:5611866
Created May 20, 2013 12:09
rap client js for select2 combo-replacement
var SELECT2_BASEPATH = "rwt-resources/select2/";
(function() {
'use strict';
rap.registerTypeHandler("eiswind.Select2", {
factory : function(properties) {
return new eiswind.Select2(properties);
},
@eiswind
eiswind / emf.b3aggr
Created April 14, 2013 06:43
b3 configuration to mirror emf artifacts for maven
<?xml version="1.0" encoding="UTF-8"?>
<aggregator:Aggregation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:aggregator="http://www.eclipse.org/b3/2011/aggregator/1.1.0" label="emf" packedStrategy="SKIP" mavenResult="true">
<validationSets label="emf">
<contributions label="juno">
<repositories location="http://download.eclipse.org/releases/juno/">
<features name="org.eclipse.xsd.sdk.feature.group"/>
<features name="org.eclipse.xsd.source.feature.group"/>
</repositories>
</contributions>
</validationSets>
@eiswind
eiswind / OSGIJmsBackendQueueProcessor.java
Created October 7, 2012 09:25
OSGI bound Backend Processor for Hibernate Search
package de.eiswind.mango.hibernate.osgi;
import java.util.List;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import org.apache.log4j.Logger;
import org.hibernate.search.backend.IndexingMonitor;
import org.hibernate.search.backend.LuceneWork;
@eiswind
eiswind / gist:3321417
Created August 11, 2012 05:22
Hack to render contribution ids in for RAP UI Tests (Snippet from Widget.java)
public void setData( Object data ) {
checkWidget();
if( ( state & KEYED_DATA ) != 0 ) {
( ( Object[] )this.data )[ 0 ] = data;
} else {
this.data = data;
}
if( UITestUtil.isEnabled() && data != null ) {
Class<? extends Object> clazz = data.getClass();
while( clazz != Object.class ) {
@eiswind
eiswind / gist:3321343
Created August 11, 2012 05:15
Render Row IDs on Eclipse RAP for UI testing (Snippet for TreeRowContainer.js)
_updateRows : function( from, delta, contentOnly ) {
this._updateRowsEvenState();
var item = this._topItem;
var to = from + delta;
var row = 0;
while( item != null && row < this._children.length ) {
if( row >= from && row <= to ) {
this._renderRow( this._children[ row ], item, contentOnly );
this._items[ row ] = item;
}