use of nl.tudelft.watchdog.core.logic.network.ServerCommunicationException in project watchdog by TestRoots.
the class UserRegistrationStep method makeRegistration.
protected void makeRegistration() {
User user = new User();
user.email = getEmailInput().getText();
user.organization = getOrganizationInput().getText();
user.mayContactUser = getMayContactUser();
user.programmingExperience = getProgrammingExperience();
user.operatingSystem = System.getProperty("os.name");
try {
id = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new user!";
messageBody = "<html>" + WordUtils.wrap(exception.getMessage(), 100, "<br>", true);
messageBody += "<br>Are you connected to the internet, and is port 80 open?";
messageBody += "<br>Please contact us via www.testroots.org. <br>We'll troubleshoot the issue!</html>";
return;
}
successfulRegistration = true;
((UserProjectRegistrationWizard) getWizard()).userid = id;
messageTitle = "New user registered!";
messageBody = "Your new user id is registered: ";
Preferences preferences = Preferences.getInstance();
preferences.setUserId(id);
preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
preferences.setProgrammingExperience(user.programmingExperience);
}
use of nl.tudelft.watchdog.core.logic.network.ServerCommunicationException in project watchdog by TestRoots.
the class ProjectCreatedEndingPage method makeRegistration.
@Override
protected void makeRegistration() {
Project project = new Project(Preferences.getInstance().getUserId());
ProjectSliderPage sliderPage;
ProjectRegistrationPage projectPage = null;
if (getPreviousPage() instanceof ProjectRegistrationPage) {
projectPage = (ProjectRegistrationPage) getPreviousPage();
} else if (getPreviousPage() instanceof ProjectSliderPage) {
sliderPage = (ProjectSliderPage) getPreviousPage();
projectPage = (ProjectRegistrationPage) getPreviousPage().getPreviousPage();
project.productionPercentage = sliderPage.percentageProductionSlider.getSelection();
project.useJunitOnlyForUnitTesting = sliderPage.usesJunitForUnitTestingOnly();
project.followTestDrivenDesign = sliderPage.usesTestDrivenDesing();
}
if (projectPage == null) {
messageTitle = "How did you get here?";
messageBody = "We couldn't figure out which wizard page\n";
messageBody += "you came from. Please restart the registration.";
WatchDogLogger.getInstance().logSevere("Unknown previous page");
return;
}
// initialize from projectPage
project.belongToASingleSoftware = !projectPage.noSingleProjectButton.getSelection();
project.name = projectPage.projectNameInput.getText();
project.website = projectPage.projectWebsite.getText();
project.usesContinuousIntegration = projectPage.usesContinuousIntegration();
project.usesJunit = projectPage.usesJunit();
project.usesOtherTestingFrameworks = projectPage.usesOtherTestingFrameworks();
project.usesOtherTestingForms = projectPage.usesOtherTestingForms();
windowTitle = "Registration Summary";
try {
id = new JsonTransferer().registerNewProject(project);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new project!";
messageBody = WordUtils.wrap(exception.getMessage(), 100, null, true);
messageBody += "\nAre you connected to the internet, and is port 80 open?";
messageBody += "\nPlease contact us via www.testroots.org. \nWe'll troubleshoot the issue!";
WatchDogLogger.getInstance().logSevere(exception);
return;
}
successfulRegistration = true;
((RegistrationWizardBase) getWizard()).setProjectId(id);
messageTitle = "New project registered!";
messageBody = "Your new project id is registered: ";
}
use of nl.tudelft.watchdog.core.logic.network.ServerCommunicationException in project watchdog by TestRoots.
the class NetworkUtilsTest method testIntervalTransfer.
@Test
@Ignore
public void testIntervalTransfer() {
JsonTransferer it = new JsonTransferer();
IntervalBase interval = new IDEOpenInterval(new Date());
ArrayList<WatchDogItem> intervals = createSampleIntervals(interval);
String json = it.toJson(intervals);
try {
NetworkUtils.transferJsonAndGetResponse(NetworkUtils.buildIntervalsPostURL(fooBarUser, fooBarProject), json);
} catch (ServerCommunicationException | ServerReturnCodeException e) {
fail(e.getMessage());
}
}
Aggregations