made few changes also adding test method
This commit is contained in:
@@ -70,6 +70,8 @@ subprojects {
|
|||||||
testCompile group: 'junit', name: 'junit', version: '4.11'
|
testCompile group: 'junit', name: 'junit', version: '4.11'
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
testCompile('org.mockito:mockito-core:1.10.19') {exclude(group: 'org.hamcrest')}
|
testCompile('org.mockito:mockito-core:1.10.19') {exclude(group: 'org.hamcrest')}
|
||||||
|
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.1.2.RELEASE'
|
||||||
|
testCompile 'javax.el:javax.el-api:3.0.0'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +109,8 @@ dependencies {
|
|||||||
compile 'org.slf4j:slf4j-api:1.7.22'
|
compile 'org.slf4j:slf4j-api:1.7.22'
|
||||||
compile "joda-time:joda-time:2.2"
|
compile "joda-time:joda-time:2.2"
|
||||||
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.5.RELEASE'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.5.RELEASE'
|
||||||
|
compile('org.springframework.boot:spring-boot-starter-web','org.apache.tomcat.embed:tomcat-embed-jasper'
|
||||||
|
,'javax.servlet:jstl')
|
||||||
|
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
testCompile "org.springframework:spring-test:5.0.9.RELEASE"
|
testCompile "org.springframework:spring-test:5.0.9.RELEASE"
|
||||||
|
|||||||
@@ -1,16 +1,30 @@
|
|||||||
package edu.msudenver.tsp.website;
|
package edu.msudenver.tsp.website;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@Slf4j
|
||||||
|
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
SpringApplication.run(Application.class, args);
|
SpringApplication.run(Application.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package edu.msudenver.tsp.website;
|
|
||||||
|
|
||||||
public class ProofsDriver {
|
|
||||||
//Business Logic will go here
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package edu.msudenver.tsp.website;
|
package edu.msudenver.tsp.website;
|
||||||
|
|
||||||
import edu.msudenver.tsp.website.forms.Theorem;
|
import edu.msudenver.tsp.website.forms.Theorem;
|
||||||
import edu.msudenver.tsp.website.service.ProofDriver;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@@ -10,12 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Controller
|
@Controller
|
||||||
|
@AllArgsConstructor
|
||||||
public class TheoremEntryController {
|
public class TheoremEntryController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ProofDriver proofDriver;
|
|
||||||
|
|
||||||
@RequestMapping("/welcome")
|
@RequestMapping("/welcome")
|
||||||
public ModelAndView firstPage()
|
public ModelAndView firstPage()
|
||||||
@@ -26,14 +26,15 @@ public class TheoremEntryController {
|
|||||||
@RequestMapping("/theorem")
|
@RequestMapping("/theorem")
|
||||||
public ModelAndView theoremPage()
|
public ModelAndView theoremPage()
|
||||||
{
|
{
|
||||||
|
//System.out.println("Inside controller");
|
||||||
return new ModelAndView("Theorem");
|
return new ModelAndView("Theorem");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||||
public String saveTheorem(@Validated Theorem theorem, Model model) {
|
public String saveTheorem(@Validated Theorem theorem, Model model) {
|
||||||
proofDriver.processProof(theorem.getTheoremName());
|
|
||||||
model.addAttribute("theromName", theorem.getTheoremName());
|
model.addAttribute("theromName1", theorem.getTheoremName1());
|
||||||
|
model.addAttribute("theromName2", theorem.getTheoremName2());
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
package edu.msudenver.tsp.website.forms;
|
package edu.msudenver.tsp.website.forms;
|
||||||
|
|
||||||
public class Theorem {
|
public class Theorem {
|
||||||
private String theoremName ;
|
private String theoremName1 ;
|
||||||
|
private String theoremName2 ;
|
||||||
|
|
||||||
|
public String getTheoremName1() {
|
||||||
public String getTheoremName() {
|
return theoremName1;
|
||||||
return theoremName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTheoremName(String theoremName) {
|
public void setTheoremName1(String theoremName) {
|
||||||
this.theoremName = theoremName;
|
this.theoremName1 = theoremName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTheoremName2() {
|
||||||
|
return theoremName2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTheoremName2(String theoremName) {
|
||||||
|
this.theoremName2 = theoremName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package edu.msudenver.tsp.website.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ProofDriver {
|
|
||||||
List<String> theromList = new ArrayList<String>();
|
|
||||||
public String processProof(String theoremName){
|
|
||||||
//Business Logic
|
|
||||||
return theoremName + "Accepted";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="save" method="post">
|
<form action="save" method="post">
|
||||||
Enter Theroem Name <input type="text" name="theoremName"><br>
|
Enter Theorem 1: <input type="text" name="theoremName1">
|
||||||
|
<br>Enter Theorem 2: <input type="text" name="theoremName2"><br>
|
||||||
<input type="submit" value="save">
|
<input type="submit" value="save">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<b>Name:</b><%= request.getParameter("theoremName")%>
|
<br><b>Name1:</b><%= request.getParameter("theoremName1")%>
|
||||||
|
<br><b>Name2:</b><%= request.getParameter("theoremName2")%>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package edu.msudenver.tsp.website;
|
|
||||||
|
|
||||||
public class ProofsDriverTest {
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user