Commit c5f3f314 authored by Tianyi Zuo's avatar Tianyi Zuo
Browse files

Do not know how to test

parent 73bbe5ce
Pipeline #63099 canceled with stages
package ic.doc;
import ic.doc.web.HTMLResultPage;
import ic.doc.web.IndexPage;
import java.io.File;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
......@@ -16,7 +14,7 @@ import java.io.IOException;
public class WebServer {
public WebServer() throws Exception {
Server server = new Server(Integer.valueOf(System.getenv("PORT")));
Server server = new Server(5000);//Integer.valueOf(System.getenv("PORT")));
ServletHandler handler = new ServletHandler();
handler.addServletWithMapping(new ServletHolder(new Website()), "/*");
......@@ -27,21 +25,26 @@ public class WebServer {
static class Website extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException{
String query = req.getParameter("q");
String type = req.getParameter("t");
if (query == null) {
new IndexPage().writeTo(resp);
} else {
String result = new QueryProcessor().process(query);
if(type == null){
new HTMLResultPage(query, result).writeTo(resp);
}else if (type.equals("markdown")){
new MarkDownCreator(query, result).writeTo(resp);
}else{
//PDF
}
execute(query, type, resp);
}
}
public static void execute(String query, String type, HttpServletResponse resp)throws IOException{
if (query == null) {
new IndexPage().writeTo(resp);
} else {
String result = new QueryProcessor().process(query);
if(type == null){
new HTMLResultPage(query, result).writeTo(resp);
}else if (type.equals("markdown")){
System.out.println("Is a markdown");
new MarkDownCreator(query, result).writeTo(resp);
}else{
//PDF
}
}
}
......
package ic.doc;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
public class MarkDownTest {
@Test
public void markdownRadioButtonWorking() throws Exception {
//TODO: I dont know how to test
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment