use of nl.tudelft.watchdog.core.logic.network.JsonTransferer in project watchdog by TestRoots.
the class UserRegistrationPage 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 = Platform.getOS();
try {
id = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new user!";
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!";
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.getWorkspaceName(), "");
preferences.setProgrammingExperience(user.programmingExperience);
}
use of nl.tudelft.watchdog.core.logic.network.JsonTransferer in project watchdog by TestRoots.
the class StartupUIThread method makeSilentRegistration.
private void makeSilentRegistration() {
String userId = "";
if (preferences.getUserId() == null || preferences.getUserId().isEmpty()) {
User user = new User();
user.programmingExperience = "NA";
try {
userId = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
WatchDogLogger.getInstance().logSevere(exception);
}
if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userId)) {
return;
}
preferences.setUserId(userId);
preferences.registerProjectId(WatchDogUtils.getWorkspaceName(), "");
}
savePreferenceStoreIfNeeded();
registerAnonymousProject(preferences.getUserId());
}
use of nl.tudelft.watchdog.core.logic.network.JsonTransferer in project watchdog by TestRoots.
the class WatchDogStartUp method makeSilentRegistration.
private void makeSilentRegistration() {
String userId = "";
Preferences preferences = Preferences.getInstance();
if (preferences.getUserId() == null || preferences.getUserId().isEmpty()) {
User user = new User();
user.programmingExperience = "NA";
try {
userId = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
WatchDogLogger.getInstance().logSevere(exception);
}
if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userId)) {
return;
}
preferences.setUserId(userId);
preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
}
registerAnonymousProject(preferences.getUserId());
}
use of nl.tudelft.watchdog.core.logic.network.JsonTransferer in project watchdog by TestRoots.
the class WatchDogStartUp method registerAnonymousProject.
private void registerAnonymousProject(String userId) {
String projectId = "";
Preferences preferences = Preferences.getInstance();
try {
projectId = new JsonTransferer().registerNewProject(new nl.tudelft.watchdog.core.ui.wizards.Project(userId));
} catch (ServerCommunicationException exception) {
WatchDogLogger.getInstance().logSevere(exception);
}
if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(projectId)) {
return;
}
preferences.registerProjectId(WatchDogUtils.getProjectName(), projectId);
preferences.registerProjectUse(WatchDogUtils.getProjectName(), true);
}
use of nl.tudelft.watchdog.core.logic.network.JsonTransferer in project watchdog by TestRoots.
the class ProjectCreatedEndingStep method makeRegistration.
@Override
protected void makeRegistration() {
Project project = new Project(Preferences.getInstance().getUserId());
ProjectSliderStep sliderStep;
ProjectRegistrationStep projectStep = getWizard().projectRegistrationStep;
if (!getWizard().projectRegistrationStep.shouldSkipProjectSliderStep()) {
sliderStep = getWizard().projectSliderStep;
project.productionPercentage = sliderStep.percentageProductionSlider.getValue();
project.useJunitOnlyForUnitTesting = sliderStep.usesJunitForUnitTestingOnly();
project.followTestDrivenDesign = sliderStep.usesTestDrivenDesing();
}
// initialize from projectPage
project.belongToASingleSoftware = !projectStep.noSingleProjectCheck.isSelected();
project.name = projectStep.projectNameInput.getText();
project.website = projectStep.projectWebsite.getText();
project.usesContinuousIntegration = projectStep.usesContinuousIntegration();
project.usesJunit = projectStep.usesJunit();
project.usesOtherTestingFrameworks = projectStep.usesOtherTestingFrameworks();
project.usesOtherTestingForms = projectStep.usesOtherTestingForms();
windowTitle = "Registration Summary";
try {
id = new JsonTransferer().registerNewProject(project);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new project!";
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>";
WatchDogLogger.getInstance().logSevere(exception);
return;
}
successfulRegistration = true;
getWizard().setProjectId(id);
messageTitle = "New project registered!";
messageBody = "Your new project id is registered: ";
}
Aggregations