use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class LoginControllerTest method testDisplayLoginPage.
/**
* Test of displayLoginPage method, of class LoginController.
*/
public void testDisplayLoginPage() {
System.out.println("displayLoginPage");
Model model = new ExtendedModelMap();
setUpMockAuthenticationContext();
LoginController instance = new LoginController();
String expResult = TgolKeyStore.LOGIN_VIEW_NAME;
String result = instance.displayLoginPage("", new HttpServletRequest() {
@Override
public String getAuthType() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Cookie[] getCookies() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getDateHeader(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getHeader(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Enumeration getHeaders(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Enumeration getHeaderNames() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getIntHeader(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getMethod() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getPathInfo() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getPathTranslated() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getContextPath() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getQueryString() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRemoteUser() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isUserInRole(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Principal getUserPrincipal() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRequestedSessionId() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRequestURI() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public StringBuffer getRequestURL() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getServletPath() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public HttpSession getSession(boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public HttpSession getSession() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isRequestedSessionIdValid() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isRequestedSessionIdFromCookie() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Object getAttribute(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Enumeration getAttributeNames() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getCharacterEncoding() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setCharacterEncoding(String string) throws UnsupportedEncodingException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getContentLength() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getContentType() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ServletInputStream getInputStream() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getParameter(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Enumeration getParameterNames() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String[] getParameterValues(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map getParameterMap() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getProtocol() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getScheme() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getServerName() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getServerPort() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public BufferedReader getReader() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRemoteAddr() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRemoteHost() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setAttribute(String string, Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeAttribute(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Locale getLocale() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Enumeration getLocales() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isSecure() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public RequestDispatcher getRequestDispatcher(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getRealPath(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getRemotePort() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getLocalName() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getLocalAddr() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getLocalPort() {
throw new UnsupportedOperationException("Not supported yet.");
}
}, model);
assertEquals(expResult, result);
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class AuditSetUpControllerTest method testDisplayPageAuditUploadSetUp.
public void testDisplayPageAuditUploadSetUp() {
System.out.println("testDisplayPageAuditUploadSetUp");
// Set-up
setUpMockUserDataServiceAndUser();
setUpMockAuthenticationContext();
setUpMockContractDataService(1, "Contract1");
setUpViewFunctionalityBindingMap();
setUpAuditSetUpCommandFactory();
Model model = new ExtendedModelMap();
// test
String returnedView = instance.displayUploadAuditSetUp("1", null, null, model);
// assertions
assertEquals(TgolKeyStore.AUDIT_UPLOAD_SET_UP_VIEW_NAME, returnedView);
assertEquals("http://www.test1.com", model.asMap().get(TgolKeyStore.URL_KEY));
assertEquals(false, model.asMap().get(TgolKeyStore.DEFAULT_PARAM_SET_KEY));
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class AuditSetUpControllerTest method testDisplayPageAuditSiteSetUp.
public void testDisplayPageAuditSiteSetUp() {
System.out.println("testDisplayPageAuditSiteSetUp");
// Set-up
setUpMockUserDataServiceAndUser();
setUpMockAuthenticationContext();
setUpMockContractDataService(1, "Contract1");
setUpViewFunctionalityBindingMap();
setUpAuditSetUpCommandFactory();
Model model = new ExtendedModelMap();
String returnedView = instance.displaySiteAuditSetUp("1", null, null, model);
// assertions
assertEquals(TgolKeyStore.AUDIT_SITE_SET_UP_VIEW_NAME, returnedView);
assertEquals("http://www.test1.com", model.asMap().get(TgolKeyStore.URL_KEY));
assertEquals(true, model.asMap().get(TgolKeyStore.DEFAULT_PARAM_SET_KEY));
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class AuditSetUpControllerTest method testDisplayPageAuditSiteSetUpWithUnauthorisedFunctionality.
public void testDisplayPageAuditSiteSetUpWithUnauthorisedFunctionality() {
System.out.println("testDisplayPageAuditSiteSetUpWithUnauthorisedFunctionality");
setUpMockUserDataServiceAndUser();
setUpMockAuthenticationContext();
setUpMockContractDataService(2, "Contract1");
setUpEmptyViewFunctionalityBindingMap();
// regarding the viewFunctionalityBindingMap. An exception is caught
try {
instance.displaySiteAuditSetUp("2", null, null, new ExtendedModelMap());
assertTrue(false);
} catch (ForbiddenPageException fue) {
assertTrue(true);
}
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class AuditSetUpControllerTest method testDisplayPageAuditPageSetUp.
public void testDisplayPageAuditPageSetUp() {
System.out.println("testDisplayPageAuditPageSetUp");
// set-up
setUpMockUserDataServiceAndUser();
setUpMockAuthenticationContext();
setUpMockContractDataService(1, "Contract1");
setUpViewFunctionalityBindingMap();
setUpAuditSetUpCommandFactory();
Model model = new ExtendedModelMap();
// test
String returnedView = instance.displayPageAuditSetUp("1", null, null, model);
// assertions
assertEquals(TgolKeyStore.AUDIT_PAGE_SET_UP_VIEW_NAME, returnedView);
assertEquals("http://www.test1.com", model.asMap().get(TgolKeyStore.URL_KEY));
assertEquals(false, model.asMap().get(TgolKeyStore.DEFAULT_PARAM_SET_KEY));
// TO DO : write test to control the integrity of data of the AuditSetUpCommand
// regarding the option/functionality rules
}
Aggregations