[TASK] Checkstyle report and mvn site configuration

This commit is contained in:
Maxime Sinclair
2014-02-06 18:28:06 +01:00
parent 77b9c2f0bd
commit fd2b6e7c02
22 changed files with 273 additions and 83 deletions

View File

@@ -21,13 +21,15 @@ public class TestCharset extends WebappTestCase {
String diagram = response.getText();
assertTrue("Interrobang unicode character is not preserved", diagram.contains(""));
}
/**
* Verifies the preservation of unicode characters for the "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample
* Verifies the preservation of unicode characters for the
* "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample
*/
public void testUnicodeInCMap() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header

View File

@@ -17,7 +17,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl());
WebResponse response = conversation.getResponse(request);
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
assertEquals("url", forms[1].getParameterNames()[0]);
assertTrue(forms[1].getParameterValue("url").endsWith("/png/" + TestUtils.SEQBOB));
@@ -38,7 +38,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", "version");
response = formUMLText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is correct
assertEquals("version", forms[0].getParameterValue("text"));
@@ -60,7 +60,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", "");
response = formUMLText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text"));
@@ -82,7 +82,7 @@ public class TestForm extends WebappTestCase {
formUrl.setParameter("url", "");
response = formUrl.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text"));
@@ -104,7 +104,7 @@ public class TestForm extends WebappTestCase {
formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa");
response = formDitaaText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is correct
assertTrue(forms[0].getParameterValue("text").startsWith("@startditaa"));
@@ -129,7 +129,7 @@ public class TestForm extends WebappTestCase {
// Ensure the generated image is present
assertEquals(1, response.getImages().length);
// Ensure the image map is present
HTMLElement maps[] = response.getElementsByTagName("map");
HTMLElement[] maps = response.getElementsByTagName("map");
assertEquals(1, maps.length);
}
@@ -143,7 +143,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl() + "form?url=" + TestUtils.SEQBOB);
WebResponse response = conversation.getResponse(request);
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is filled
assertEquals(forms[0].getParameterValue("text"), "@startuml\nBob -> Alice : hello\n@enduml");

View File

@@ -60,10 +60,10 @@ public class TestImage extends WebappTestCase {
// Consume the response
InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) {
; // Do nothing
// Do nothing
}
}
/**
* Verifies that the HTTP header of a diagram incites the browser to cache it.
*/
@@ -78,7 +78,7 @@ public class TestImage extends WebappTestCase {
// Consume the response
InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) {
; // Do nothing
// Do nothing
}
}
}
}

View File

@@ -8,17 +8,18 @@ import com.meterware.httpunit.WebResponse;
public class TestMap extends WebappTestCase {
/**
* Verifies the generation of the MAP for the following sample:
*
*
* participant Bob [[http://www.yahoo.com]]
* Bob -> Alice : [[http://www.google.com]] hello
*/
public void testSimpleSequenceDiagram() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType());
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType());
assertEquals("Response character set is not UTF-8", "UTF-8", response.getCharacterSet());
// Get the content, check its first characters and verify its size
String diagram = response.getText();
@@ -34,15 +35,17 @@ public class TestMap extends WebappTestCase {
*/
public void testSequenceDiagramContent() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebResponse response = conversation.getResource(request);
// Analyze response
// Get the data contained in the XML
String map = response.getText();
assertTrue("Response is not a list of tags", map.matches("(<([^<>]+)>)+"));
assertTrue("Response doesn't contain the area structure", map.matches(".*(area shape=\".+\" id=\".+\" href=\".+\").*"));
assertTrue("Response doesn't contain the area structure",
map.matches(".*(area shape=\".+\" id=\".+\" href=\".+\").*"));
}
/**
* Check the empty MAP of a sequence diagram without link
* This test uses the simple Bob -> Alice

View File

@@ -15,7 +15,8 @@ public class TestOldProxy extends WebappTestCase {
*/
public void testDefaultProxy() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/" + getServerUrl()
+ "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header
@@ -38,7 +39,8 @@ public class TestOldProxy extends WebappTestCase {
public void testProxyWithFormat() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/svg/" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/svg/" + getServerUrl()
+ "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header
@@ -61,7 +63,7 @@ public class TestOldProxy extends WebappTestCase {
// Analyze response, it must be the empty form
// Verifies the Content-Type header
assertEquals("Response content type is not HTML", "text/html", response.getContentType());
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
}
}

View File

@@ -14,12 +14,12 @@ public class TestProxy extends WebappTestCase {
*/
public void testDefaultProxy() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?src=" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?src=" + getServerUrl() + "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header
assertEquals( "Response content type is not PNG", "image/png", response.getContentType());
assertEquals("Response content type is not PNG", "image/png", response.getContentType());
// Get the image and verify its size (~2000 bytes)
InputStream responseStream = response.getInputStream();
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
@@ -38,8 +38,8 @@ public class TestProxy extends WebappTestCase {
/*
public void testProxyWithFormat() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?format=svg&src=" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?format=svg&src=" + getServerUrl() + "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header

View File

@@ -9,12 +9,12 @@ public class TestUtils {
/*
* Theses strings are the compressed form of a PlantUML diagram.
*/
/*
* version
*/
public static final String VERSION = "AqijAixCpmC0";
/*
* Bob -> Alice : hello
*/