This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith( HttpJUnitRunner.class ) | |
public class RestfuseTest { | |
@Rule | |
public Destination destination = new Destination( "http://restfuse.com" ); | |
@Context | |
private Response response; // will be injected after every request | |
@HttpTest( method = Method.GET, path = "/" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith( HttpJUnitRunner.class ) | |
public class RestfusePollTest { | |
@Rule | |
public Destination destination = new Destination( "http://restfuse.com" ); | |
@Context | |
private Response response; | |
@Context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith( HttpJUnitRunner.class ) | |
public class RestfuseCalbackTest { | |
@Rule | |
public Destination destination = new Destination( "http://restfuse.com" ); | |
@Context | |
private Response response; | |
private class TestCallbackResource extends DefaultCallbackResource { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@HttpTest( method = Method.POST, path = "/", file = "YOUR_JSON_FILE", type = MediaType.APPLICATION_JSON ) | |
public void testPost() { | |
String repsonseBody = response.getBody(); | |
MyJsonParser.parse( responseBody ); | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* 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 | |
******************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package osgi.rest.example; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
@Path( "/hello" ) | |
public class ExampleResource { | |
@GET | |
public String helloWorld() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* 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 | |
******************************************************************************/ |
OlderNewer