2014-05-28 17:26:53 +01:00
|
|
|
package test
|
|
|
|
|
2014-05-29 09:17:39 +01:00
|
|
|
@SpringApplicationConfiguration(classes=TestConfiguration)
|
2014-05-28 17:26:53 +01:00
|
|
|
@WebAppConfiguration
|
|
|
|
@IntegrationTest('server.port:0')
|
|
|
|
@DirtiesContext
|
|
|
|
class IntegrationTests {
|
|
|
|
|
|
|
|
@Value('${local.server.port}')
|
|
|
|
int port
|
|
|
|
|
|
|
|
@Test
|
2014-05-29 09:17:39 +01:00
|
|
|
void homeIsForm() {
|
2014-05-28 17:26:53 +01:00
|
|
|
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
|
|
|
|
assertTrue('Wrong body:\n' + body, body.contains('action="/starter.zip"'))
|
|
|
|
}
|
|
|
|
|
2014-05-28 19:25:35 +01:00
|
|
|
@Test
|
|
|
|
void infoHasExternalProperties() {
|
|
|
|
String body = new TestRestTemplate().getForObject('http://localhost:' + port + '/info', String)
|
|
|
|
assertTrue('Wrong body:\n' + body, body.contains('"project"'))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void homeHasWebStyle() {
|
|
|
|
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
|
|
|
|
assertTrue('Wrong body:\n' + body, body.contains('name="style" value="web"'))
|
|
|
|
}
|
|
|
|
|
2014-05-29 09:17:39 +01:00
|
|
|
@Test
|
|
|
|
void downloadStarter() {
|
|
|
|
byte[] body = new TestRestTemplate().getForObject('http://localhost:' + port + 'starter.zip', byte[])
|
|
|
|
assertNotNull(body)
|
|
|
|
assertTrue(body.length>100)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLI compliled classes are not @ComponentScannable so we have to create
|
|
|
|
// an explicit configuration for the test
|
|
|
|
@Configuration
|
|
|
|
@Import([app.MainController, app.Projects, app.TemporaryFileCleaner])
|
|
|
|
class TestConfiguration {
|
2014-05-28 17:26:53 +01:00
|
|
|
}
|