...
The following JUnit test show an example how to login to a development server as well as to a deployed GAE application located at http://camelcloud.appspot.comImage Removed.
Code Block |
---|
| java |
---|
| java |
---|
title | GLoginTest.java |
---|
|
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.ProducerTemplate;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.apache.camel.component.gae.login.GLoginBinding.*;
import static org.junit.Assert.*;
public class GLoginTest {
private ProducerTemplate template = ...
@Test
public void testDevLogin() {
Exchange result = template.request("glogin://localhost:8888?userName=test@example.org&devMode=true", null);
assertNotNull(result.getOut().getHeader(GLOGIN_COOKIE));
}
@Test
public void testRemoteLogin() {
Exchange result = template.request("glogin://camelcloud.appspot.com", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(GLOGIN_USER_NAME, "replaceme@gmail.com");
exchange.getIn().setHeader(GLOGIN_PASSWORD, "replaceme");
}
});
assertNotNull(result.getOut().getHeader(GLOGIN_COOKIE));
}
}
|
...
Code Block |
---|
|
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-gae</artifactId>
<version>${camel-version}<<version>x.x.x</version>
</dependency>
|
...
Include Page |
---|
| CAMEL:Endpoint See AlsoCAMEL: |
---|
| Endpoint See Also |
---|
|