Skip to content

Instantly share code, notes, and snippets.

View hstaudacher's full-sized avatar
🥷
{...copilot}

Holger Staudacher hstaudacher

🥷
{...copilot}
View GitHub Profile
@hstaudacher
hstaudacher / CleanSheet.icls
Last active November 29, 2021 10:55
CleanSheet editor color scheme for IntelliJ, see original http://fappel.github.io/xiliary/clean-sheet.html
<scheme name="CleanSheet" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2021-11-29T11:54:56</property>
<property name="ide">idea</property>
<property name="ideVersion">2021.2.3.0.0</property>
<property name="modified">2021-11-29T11:55:05</property>
<property name="originalScheme">CleanSheet</property>
</metaInfo>
<option name="LINE_SPACING" value="1.1" />
@hstaudacher
hstaudacher / test.java
Created June 8, 2020 15:10
hub integration test #hub
@RunWith(SpringRunner.class)
@HubIntegrationTest
@hstaudacher
hstaudacher / RWTRule.java
Created February 24, 2014 10:08
A simple JUnit Rule to setup and teardown RWT
/*******************************************************************************
* Copyright (c) 2014 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource - initial API and implementation
******************************************************************************/
@hstaudacher
hstaudacher / Activator.java
Created February 3, 2014 14:04
OSGi-JAX-RS Connector Activator
package osgi.rest.example;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public class Activator implements BundleActivator {
private ServiceRegistration<ExampleResource> registration;
@hstaudacher
hstaudacher / ExampleResource.java
Last active August 29, 2015 13:55
OSGi-JAX-RS Connector ExampleResource
package osgi.rest.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path( "/hello" )
public class ExampleResource {
@GET
public String helloWorld() {
@hstaudacher
hstaudacher / Clauses.java
Last active December 19, 2015 02:38
Util to throw exceptions in a nicer way then if( .. ) throw...
/*******************************************************************************
* Copyright (c) 2013 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource - initial API and implementation
******************************************************************************/
@HttpTest( method = Method.POST, path = "/", file = "YOUR_JSON_FILE", type = MediaType.APPLICATION_JSON )
public void testPost() {
String repsonseBody = response.getBody();
MyJsonParser.parse( responseBody );
...
}
@hstaudacher
hstaudacher / GsonProvider.java
Last active April 12, 2016 13:55
Simple GsonProvider implementation for JAX-RS 2.0
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@hstaudacher
hstaudacher / junit4-templates.xml
Created March 20, 2012 11:20
JUnit4 Templates for Eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="setup">${:import(org.junit.Before)}
@Before
public void setUp() {
${cursor}
}</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="teardown">${:import(org.junit.After)}
@After
public void tearDown() {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="test method" enabled="true" id="org.eclipse.jdt.ui.templates.test" name="test">${:import(org.junit.Test)}
@Test
@hstaudacher
hstaudacher / RestfuseCalbackTest.java
Created November 12, 2011 11:41
A simple Callback Test using restfuse
@RunWith( HttpJUnitRunner.class )
public class RestfuseCalbackTest {
@Rule
public Destination destination = new Destination( "http://restfuse.com" );
@Context
private Response response;
private class TestCallbackResource extends DefaultCallbackResource {