Search in sources :

Example 1 with Project

use of nl.tudelft.watchdog.core.ui.wizards.Project 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)

Example 2 with Project

use of nl.tudelft.watchdog.core.ui.wizards.Project 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: ";
}
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) RegistrationWizardBase(nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase)

Example 3 with Project

use of nl.tudelft.watchdog.core.ui.wizards.Project in project watchdog by TestRoots.

the class JsonConverterTestBase method testProjectHasWatchDogVersion.

@Test
public void testProjectHasWatchDogVersion() {
    String gsonRepresentation = WatchDogUtils.convertToJson(new Project(""));
    boolean containsWDVersion = gsonRepresentation.contains("\"wdv\":\"" + WatchDogGlobals.CLIENT_VERSION + "\"");
    assertTrue(containsWDVersion);
}
Also used : Project(nl.tudelft.watchdog.core.ui.wizards.Project) Test(org.junit.Test)

Aggregations

Project (nl.tudelft.watchdog.core.ui.wizards.Project)3 JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)2 ServerCommunicationException (nl.tudelft.watchdog.core.logic.network.ServerCommunicationException)2 RegistrationWizardBase (nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase)1 Test (org.junit.Test)1