Search in sources :

Example 1 with JsonTransferer

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);
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User) Preferences(nl.tudelft.watchdog.eclipse.ui.preferences.Preferences)

Example 2 with JsonTransferer

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());
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User)

Example 3 with JsonTransferer

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());
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User) Preferences(nl.tudelft.watchdog.intellij.ui.preferences.Preferences)

Example 4 with JsonTransferer

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);
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) Project(com.intellij.openapi.project.Project) Preferences(nl.tudelft.watchdog.intellij.ui.preferences.Preferences)

Example 5 with JsonTransferer

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: ";
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) Project(nl.tudelft.watchdog.core.ui.wizards.Project)

Aggregations

JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)8 ServerCommunicationException (nl.tudelft.watchdog.core.logic.network.ServerCommunicationException)8 User (nl.tudelft.watchdog.core.ui.wizards.User)4 Preferences (nl.tudelft.watchdog.intellij.ui.preferences.Preferences)3 Project (nl.tudelft.watchdog.core.ui.wizards.Project)2 Project (com.intellij.openapi.project.Project)1 Date (java.util.Date)1 IDEOpenInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval)1 IntervalBase (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase)1 ServerReturnCodeException (nl.tudelft.watchdog.core.logic.network.ServerReturnCodeException)1 WatchDogItem (nl.tudelft.watchdog.core.logic.storage.WatchDogItem)1 Preferences (nl.tudelft.watchdog.eclipse.ui.preferences.Preferences)1 RegistrationWizardBase (nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1