THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
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.com.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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)); } } |
...
Maven users will need to add the following dependency to their pom.xml
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-gae</artifactId> <version>x.x.x</version> </dependency> |
...