made few changes also adding test method
This commit is contained in:
@@ -1,16 +1,30 @@
|
||||
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.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@SpringBootApplication
|
||||
@Slf4j
|
||||
|
||||
public class Application {
|
||||
|
||||
public static void main(final String[] 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;
|
||||
|
||||
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.stereotype.Controller;
|
||||
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.servlet.ModelAndView;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@AllArgsConstructor
|
||||
public class TheoremEntryController {
|
||||
|
||||
@Autowired
|
||||
ProofDriver proofDriver;
|
||||
|
||||
@RequestMapping("/welcome")
|
||||
public ModelAndView firstPage()
|
||||
@@ -26,14 +26,15 @@ public class TheoremEntryController {
|
||||
@RequestMapping("/theorem")
|
||||
public ModelAndView theoremPage()
|
||||
{
|
||||
//System.out.println("Inside controller");
|
||||
return new ModelAndView("Theorem");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package edu.msudenver.tsp.website.forms;
|
||||
|
||||
public class Theorem {
|
||||
private String theoremName ;
|
||||
private String theoremName1 ;
|
||||
private String theoremName2 ;
|
||||
|
||||
|
||||
public String getTheoremName() {
|
||||
return theoremName;
|
||||
public String getTheoremName1() {
|
||||
return theoremName1;
|
||||
}
|
||||
|
||||
public void setTheoremName(String theoremName) {
|
||||
this.theoremName = theoremName;
|
||||
public void setTheoremName1(String 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";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user