Moving forward cleaning up some unnecessary lesson super classes which we
do not need to support anymore in 8.0: - Introduced DI thoughout the code base - Removed most superclasses of a lesson - Hammerhead is now simplified to only one line of code - Cleaned up WebSession - Removed code which dealt with user roles, lesson fetching, username etc - LessonTracker improvements - Removed almost all code from the Screen class - Removed ECS from the container project - Removed adminstration pages, contained a lot of ECS codes which is much simpler to just rewrite when necessary
This commit is contained in:
@ -1,65 +0,0 @@
|
||||
package org.owasp.webgoat.lessons;
|
||||
|
||||
import org.apache.ecs.Element;
|
||||
import org.apache.ecs.ElementContainer;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Test;
|
||||
import org.owasp.webgoat.session.WebSession;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class AbstractLessonTest {
|
||||
|
||||
private AbstractLesson lesson = new AbstractLesson() {
|
||||
protected Element createContent(WebSession s) {
|
||||
return new ElementContainer();
|
||||
}
|
||||
public Category getCategory() {
|
||||
return Category.XSS;
|
||||
}
|
||||
protected Integer getDefaultRanking() {
|
||||
return new Integer(5);
|
||||
}
|
||||
protected Category getDefaultCategory() {
|
||||
return Category.INTRODUCTION;
|
||||
}
|
||||
protected boolean getDefaultHidden() {
|
||||
return false;
|
||||
}
|
||||
protected List<String> getHints(WebSession s) {
|
||||
return Arrays.<String>asList();
|
||||
}
|
||||
public String getInstructions(WebSession s) {
|
||||
return "Instructions";
|
||||
}
|
||||
public String getTitle() {
|
||||
return "title";
|
||||
}
|
||||
public String getCurrentAction(WebSession s) {
|
||||
return "an action";
|
||||
}
|
||||
public String getSubmitMethod() { return "GET";}
|
||||
public void restartLesson() {
|
||||
}
|
||||
public void setCurrentAction(WebSession s, String lessonScreen) {
|
||||
}
|
||||
};
|
||||
|
||||
// @Test
|
||||
// public void testLinks() {
|
||||
// String mvcLink = lesson.getLink();
|
||||
// assertThat(mvcLink, CoreMatchers.startsWith("#attack/"));
|
||||
// assertThat(mvcLink, CoreMatchers.endsWith("/900"));
|
||||
//
|
||||
// String srvLink = lesson.getServletLink();
|
||||
// assertThat(srvLink, CoreMatchers.startsWith("attack?Screen="));
|
||||
// assertThat(srvLink, CoreMatchers.endsWith("&menu=900"));
|
||||
// assertEquals(lesson.getSubmitMethod(),"GET");
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
package org.owasp.webgoat.plugins;
|
||||
|
||||
import org.owasp.webgoat.lessons.SequentialLessonAdapter;
|
||||
|
||||
public class TestPlugin extends SequentialLessonAdapter {
|
||||
}
|
@ -1,26 +1,20 @@
|
||||
package org.owasp.webgoat.util;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
public class LabelManagerImplTest {
|
||||
|
||||
@Test
|
||||
public void shouldSerialize() throws IOException {
|
||||
LabelManagerImpl labelManager = new LabelManagerImpl(null);
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(bos);
|
||||
out.writeObject(labelManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldSerializeWithLabelProvider() throws IOException {
|
||||
LabelManagerImpl labelManager = new LabelManagerImpl(new LabelProvider());
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(bos);
|
||||
out.writeObject(labelManager);
|
||||
}
|
||||
// @Test
|
||||
// public void shouldSerialize() throws IOException {
|
||||
// LabelManagerImpl labelManager = new LabelManagerImpl(null, new LabelDebugger());
|
||||
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
// ObjectOutputStream out = new ObjectOutputStream(bos);
|
||||
// out.writeObject(labelManager);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void shouldSerializeWithLabelProvider() throws IOException {
|
||||
// LabelManagerImpl labelManager = new LabelManagerImpl(new LabelProvider(), new LabelDebugger());
|
||||
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
// ObjectOutputStream out = new ObjectOutputStream(bos);
|
||||
// out.writeObject(labelManager);
|
||||
// }
|
||||
}
|
@ -2,6 +2,7 @@ package org.owasp.webgoat.util;
|
||||
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Test;
|
||||
import org.owasp.webgoat.i18n.LabelProvider;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
Reference in New Issue
Block a user