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;
}
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());
}
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;
}
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();
}
}
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;
}
Aggregations