Search in sources :

Example 21 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class ImageUploadAction method prepareData.

protected FileUploadPageData prepareData() {
    FileUploadPageData data = new FileUploadPageData(account, sessionToken);
    BlobInfo blobInfo = extractImageKey(getImageKeyParam());
    if (blobInfo == null) {
        data.isFileUploaded = false;
        data.fileSrcUrl = null;
        log.warning("Image Upload Failed");
        statusToAdmin = "Image Upload Failed";
        return data;
    }
    BlobKey blobKey = blobInfo.getBlobKey();
    data.isFileUploaded = true;
    AppUrl fileSrcUrl = Config.getAppUrl(Const.ActionURIs.PUBLIC_IMAGE_SERVE).withParam(Const.ParamsNames.BLOB_KEY, blobKey.getKeyString());
    String absoluteFileSrcUrl = fileSrcUrl.toAbsoluteString();
    data.fileSrcUrl = fileSrcUrl.toString();
    log.info("New Image Uploaded : " + absoluteFileSrcUrl);
    statusToAdmin = "New Image Uploaded : " + "<a href=" + data.fileSrcUrl + " target=\"_blank\">" + absoluteFileSrcUrl + "</a>";
    data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage";
    return data;
}
Also used : BlobKey(com.google.appengine.api.blobstore.BlobKey) AppUrl(teammates.common.util.AppUrl) BlobInfo(com.google.appengine.api.blobstore.BlobInfo) FileUploadPageData(teammates.ui.pagedata.FileUploadPageData)

Example 22 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorCourseEnrollPageScalabilityTest method testEnrollAction.

private void testEnrollAction(int numStudents) throws IOException {
    AppUrl enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("CCEnrollScT.teammates.test").googleId).withCourseId(testData.courses.get("CCEnrollScT.CS2104").getId());
    InstructorCourseEnrollPage enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
    String enrollString = InstructorCourseEnrollPageDataGenerator.generateStudents(numStudents);
    log.info("Testing with " + numStudents + " students...");
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.start();
    enrollPage.enroll(enrollString);
    log.info("Time taken: " + stopwatch.getTimeElapsedInSeconds());
}
Also used : InstructorCourseEnrollPage(teammates.test.pageobjects.InstructorCourseEnrollPage) AppUrl(teammates.common.util.AppUrl) Stopwatch(teammates.client.scripts.util.Stopwatch)

Example 23 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorFeedbackResultsPageScalabilityTest method loginToInstructorFeedbackResultsPage.

// Needs to log before returning.
@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn")
private InstructorFeedbackResultsPage loginToInstructorFeedbackResultsPage(String instructorName, String fsName) {
    AppUrl resultsUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_PAGE).withUserId(testData.instructors.get(instructorName).googleId).withCourseId(testData.feedbackSessions.get(fsName).getCourseId()).withSessionName(testData.feedbackSessions.get(fsName).getFeedbackSessionName());
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.start();
    InstructorFeedbackResultsPage resultsPage = loginAdminToPage(resultsUrl, InstructorFeedbackResultsPage.class);
    resultsPage.clickCollapseExpandButtonAndWaitForPanelsToExpand();
    log.info("Time taken: " + stopwatch.getTimeElapsedInSeconds());
    return resultsPage;
}
Also used : AppUrl(teammates.common.util.AppUrl) Stopwatch(teammates.client.scripts.util.Stopwatch) InstructorFeedbackResultsPage(teammates.test.pageobjects.InstructorFeedbackResultsPage)

Example 24 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class UrlTest method testAppUrlAssertion.

@Test
public void testAppUrlAssertion() {
    ______TS("typical non-empty case");
    AppUrl url = new AppUrl("http://www.google.com/page?key1=value1");
    assertEquals("/page?key1=value1", url.toString());
    assertEquals("http://www.google.com/page?key1=value1", url.toAbsoluteString());
    ______TS("empty path case");
    url = new AppUrl("http://www.google.com");
    assertEquals("", url.toString());
    assertEquals("http://www.google.com", url.toAbsoluteString());
    ______TS("malformed URL: not http(s)");
    try {
        url = new AppUrl("file:///C:/path/to/file.ext");
        signalFailureToDetectException();
    } catch (AssertionError ae) {
        ignoreExpectedException();
    }
}
Also used : AppUrl(teammates.common.util.AppUrl) Test(org.testng.annotations.Test)

Example 25 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorFeedbackEditPageUiTest method navigateToInstructorFeedbackSessionsPage.

private InstructorFeedbackSessionsPage navigateToInstructorFeedbackSessionsPage() {
    AppUrl feedbacksPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructorId);
    InstructorFeedbackSessionsPage feedbacksPage = AppPage.getNewPageInstance(browser, feedbacksPageUrl, InstructorFeedbackSessionsPage.class);
    feedbacksPage.waitForPageToLoad();
    return feedbacksPage;
}
Also used : InstructorFeedbackSessionsPage(teammates.test.pageobjects.InstructorFeedbackSessionsPage) AppUrl(teammates.common.util.AppUrl)

Aggregations

AppUrl (teammates.common.util.AppUrl)52 Test (org.testng.annotations.Test)7 InstructorCourseEnrollPage (teammates.test.pageobjects.InstructorCourseEnrollPage)6 InstructorStudentListPage (teammates.test.pageobjects.InstructorStudentListPage)6 StudentHomePage (teammates.test.pageobjects.StudentHomePage)6 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)4 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)3 InstructorCourseDetailsPage (teammates.test.pageobjects.InstructorCourseDetailsPage)3 InstructorCourseStudentDetailsEditPage (teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage)3 InstructorHomePage (teammates.test.pageobjects.InstructorHomePage)3 Stopwatch (teammates.client.scripts.util.Stopwatch)2 AdminHomePage (teammates.test.pageobjects.AdminHomePage)2 InstructorCourseStudentDetailsViewPage (teammates.test.pageobjects.InstructorCourseStudentDetailsViewPage)2 InstructorCoursesPage (teammates.test.pageobjects.InstructorCoursesPage)2 InstructorFeedbackResultsPage (teammates.test.pageobjects.InstructorFeedbackResultsPage)2 InstructorFeedbackSessionsPage (teammates.test.pageobjects.InstructorFeedbackSessionsPage)2 InstructorStudentRecordsPage (teammates.test.pageobjects.InstructorStudentRecordsPage)2 StudentCourseDetailsPage (teammates.test.pageobjects.StudentCourseDetailsPage)2 BlobInfo (com.google.appengine.api.blobstore.BlobInfo)1 BlobKey (com.google.appengine.api.blobstore.BlobKey)1