use of org.eclipse.sw360.datahandler.thrift.projectimport.RemoteCredentials in project sw360portal by sw360.
the class ProjectImportPortlet method doView.
@Override
public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
List<Project> importables = new ArrayList<>();
Boolean loggedIn = false;
String loggedInServer = "";
RemoteCredentials reCred = getRemoteCredentialsFromSession(request.getPortletSession());
String projectName = request.getParameter(ProjectImportConstants.PROJECT_NAME);
if (!nullToEmpty(reCred.getServerUrl()).isEmpty()) {
importables = loadImportables(reCred, projectName);
loggedIn = true;
loggedInServer = reCred.getServerUrl();
}
String idName = getIdName();
request.setAttribute("idName", idName);
request.setAttribute("importables", importables);
request.setAttribute("loggedIn", loggedIn);
request.setAttribute("loggedInServer", loggedInServer);
super.doView(request, response);
}
use of org.eclipse.sw360.datahandler.thrift.projectimport.RemoteCredentials in project sw360portal by sw360.
the class ProjectImportPortletTest method testUpdateInputSourceWithoutUrl.
@Test
public void testUpdateInputSourceWithoutUrl() throws Exception {
ProjectImportPortlet.LoginState loginState = new ProjectImportPortlet.LoginState();
RemoteCredentials remoteCredentials = new RemoteCredentials();
new ProjectImportPortlet().setNewImportSource(remoteCredentials, session, responseData, loginState);
verify(responseData).put(ProjectImportConstants.RESPONSE__STATUS, ProjectImportConstants.RESPONSE__DB_URL_NOT_SET);
}
use of org.eclipse.sw360.datahandler.thrift.projectimport.RemoteCredentials in project sw360portal by sw360.
the class ProjectImportPortletTest method testUpdateInputSourceWithUrlUpdatesSession.
@Test
public void testUpdateInputSourceWithUrlUpdatesSession() throws Exception {
ProjectImportPortlet.LoginState loginState = new ProjectImportPortlet.LoginState();
RemoteCredentials remoteCredentials = new RemoteCredentials();
remoteCredentials.setUsername(name);
remoteCredentials.setPassword(password);
remoteCredentials.setServerUrl(newURL);
new ProjectImportPortlet().setNewImportSource(remoteCredentials, session, responseData, loginState);
verify(session).setAttribute(ProjectImportConstants.USERNAME, name);
verify(session).setAttribute(ProjectImportConstants.PASSWORD, password);
verify(session).setAttribute(ProjectImportConstants.SERVER_URL, newURL);
}
Aggregations