Skip to content

Commit

Permalink
[#11175] Change most mentions of Datastore to database (#11261)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoazWu authored Jul 11, 2021
1 parent 79fb53a commit 43735f6
Show file tree
Hide file tree
Showing 66 changed files with 439 additions and 439 deletions.
4 changes: 2 additions & 2 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ The `Storage` component performs CRUD (Create, Read, Update, Delete) operations
It contains minimal logic beyond what is directly relevant to CRUD operations.
In particular, it is reponsible for:
- Validating data inside entities before creating/updating them, to ensure they are in a valid state.
- Hiding the complexities of datastore from the `Logic` component. All GQL queries are to be contained inside the `Storage` component.
- Hiding the complexities of the database from the `Logic` component.
- Hiding the persistable objects: Classes in the `storage::entity` package are not visible outside this component to hide information specific to data persistence.
- Instead, a corresponding non-persistent [data transfer object](http://en.wikipedia.org/wiki/Data_transfer_object) named `*Attributes` (e.g., `CourseAttributes` is the data transfer object for `Course` entities) object is returned. These datatransfer classes are in `common::datatransfer` package, to be explained later.

Expand All @@ -205,7 +205,7 @@ This is because we want to keep the data schema flexible so that new entity type

### Storage API

Represented by the `*Db` classes. These classes act as the bridge to the Google Cloud Datastore.
Represented by the `*Db` classes. These classes act as the bridge to the database.

### Policies

Expand Down
2 changes: 1 addition & 1 deletion docs/e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ In TEAMMATES, E2E test cases are organized by page. For each page, we:

All E2E test classes inherit from `BaseE2ETestCase` which contains methods that are common to most test cases, such as preparing the `Browser` object used for testing.

To help verify the state of the datastore, `BackDoor` contains methods to create API calls to the back-end without going through the UI.
To help verify the state of the database, `BackDoor` contains methods to create API calls to the back-end without going through the UI.

### Page Object Pattern

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import teammates.storage.api.OfyHelper;

/**
* Enables access to any Datastore (local/production).
* Enables access to any datastore (local/production).
*/
public abstract class DatastoreClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import teammates.storage.entity.BaseEntity;

/**
* Base script to be used as a template to scan entities in the Datastore.
* Base script to be used as a template to scan entities in the database.
*
* @param <T> The entity to scan.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Map<String, String> asMap() {
/**
* Gets the institute name associated with the course identified by {@code courseId}.
*
* <p>If the mapping cannot be found in the cache, several Datastore queries are issued to find the mapping.
* <p>If the mapping cannot be found in the cache, several database queries are issued to find the mapping.
*/
public String get(String courseId) {
return cache.getUnchecked(courseId);
Expand Down
26 changes: 13 additions & 13 deletions src/e2e/java/teammates/e2e/cases/AdminAccountsPageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ public void testAll() {
InstructorAttributes instructor = testData.instructors.get("AAccounts.instr2-AAccounts.CS2103");
String courseId = instructor.courseId;

verifyPresentInDatastore(instructor);
verifyPresentInDatabase(instructor);
accountsPage.clickRemoveInstructorFromCourse(courseId);
accountsPage.verifyStatusMessage("Instructor is successfully deleted from course \"" + courseId + "\"");
verifyAbsentInDatastore(instructor);
verifyAbsentInDatabase(instructor);

______TS("action: remove student from course");

StudentAttributes student = testData.students.get("AAccounts.instr2-student-CS2103");
courseId = student.course;

verifyPresentInDatastore(student);
verifyPresentInDatabase(student);
accountsPage.clickRemoveStudentFromCourse(courseId);
accountsPage.verifyStatusMessage("Student is successfully deleted from course \"" + courseId + "\"");
verifyAbsentInDatastore(student);
verifyAbsentInDatabase(student);

______TS("action: downgrade instructor account");

InstructorAttributes instructor2 = testData.instructors.get("AAccounts.instr2-AAccounts.CS2104");
InstructorAttributes instructor3 = testData.instructors.get("AAccounts.instr2-AAccounts.CS1101");
verifyPresentInDatastore(instructor2);
verifyPresentInDatastore(instructor3);
verifyPresentInDatabase(instructor2);
verifyPresentInDatabase(instructor3);

accountsPage.clickDowngradeAccount();
accountsPage.verifyStatusMessage("Instructor account is successfully downgraded to student.");
Expand All @@ -71,24 +71,24 @@ public void testAll() {
accountsPage.verifyAccountDetails(account);

// instructor entities should also be deleted
verifyAbsentInDatastore(instructor2);
verifyAbsentInDatastore(instructor3);
verifyAbsentInDatabase(instructor2);
verifyAbsentInDatabase(instructor3);

______TS("action: delete account entirely");

StudentAttributes student2 = testData.students.get("AAccounts.instr2-student-CS2104");
StudentAttributes student3 = testData.students.get("AAccounts.instr2-student-CS1101");
verifyPresentInDatastore(student2);
verifyPresentInDatastore(student3);
verifyPresentInDatabase(student2);
verifyPresentInDatabase(student3);

accountsPage.clickDeleteAccount();
accountsPage.verifyStatusMessage("Account \"" + googleId + "\" is successfully deleted.");

verifyAbsentInDatastore(account);
verifyAbsentInDatabase(account);

// student entities should be deleted
verifyAbsentInDatastore(student2);
verifyAbsentInDatastore(student3);
verifyAbsentInDatabase(student2);
verifyAbsentInDatabase(student3);

}

Expand Down
6 changes: 3 additions & 3 deletions src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import teammates.e2e.util.BackDoor;
import teammates.e2e.util.EmailAccount;
import teammates.e2e.util.TestProperties;
import teammates.test.BaseTestCaseWithDatastoreAccess;
import teammates.test.BaseTestCaseWithDatabaseAccess;
import teammates.test.FileHelper;

/**
Expand All @@ -43,7 +43,7 @@
* <p>This type of test has no knowledge of the workings of the application,
* and can only communicate via the UI or via {@link BackDoor} to obtain/transmit data.
*/
public abstract class BaseE2ETestCase extends BaseTestCaseWithDatastoreAccess {
public abstract class BaseE2ETestCase extends BaseTestCaseWithDatabaseAccess {

static final BackDoor BACKDOOR = BackDoor.getInstance();

Expand Down Expand Up @@ -214,7 +214,7 @@ public void setupLocalDatastoreHelper() {
@Override
@SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract")
public void resetLocalDatastoreHelper() {
// Local datastore state should persist across e2e test suites
// Local database state should persist across e2e test suites
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void testEditPage() {
feedbackEditPage.addConstSumOptionQuestion(loadedQuestion);

feedbackEditPage.verifyConstSumQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);

______TS("copy question");
FeedbackQuestionAttributes copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession");
Expand All @@ -65,7 +65,7 @@ protected void testEditPage() {
copiedQuestion.setQuestionNumber(3);

feedbackEditPage.verifyConstSumQuestionDetails(3, questionDetails);
verifyPresentInDatastore(copiedQuestion);
verifyPresentInDatabase(copiedQuestion);

______TS("edit question");
questionDetails = (FeedbackConstantSumQuestionDetails) loadedQuestion.getQuestionDetails();
Expand All @@ -81,7 +81,7 @@ protected void testEditPage() {
feedbackEditPage.waitForPageToLoad();

feedbackEditPage.verifyConstSumQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);
}

@Override
Expand All @@ -98,7 +98,7 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response = getResponse(questionId, Arrays.asList(50, 20, 30));
feedbackSubmitPage.submitConstSumOptionResponse(1, "", response);

verifyPresentInDatastore(response);
verifyPresentInDatabase(response);

______TS("check previous response");
feedbackSubmitPage = getFeedbackSubmitPage();
Expand All @@ -110,7 +110,7 @@ protected void testSubmitPage() {

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyConstSumOptionResponse(1, "", response);
verifyPresentInDatastore(response);
verifyPresentInDatabase(response);
}

private FeedbackResponseAttributes getResponse(String questionId, List<Integer> answers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void testEditPage() {
feedbackEditPage.addConstSumRecipientQuestion(loadedQuestion);

feedbackEditPage.verifyConstSumQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);

______TS("copy question");
FeedbackQuestionAttributes copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession");
Expand All @@ -66,7 +66,7 @@ protected void testEditPage() {
copiedQuestion.setQuestionNumber(3);

feedbackEditPage.verifyConstSumQuestionDetails(3, questionDetails);
verifyPresentInDatastore(copiedQuestion);
verifyPresentInDatabase(copiedQuestion);

______TS("edit question");
questionDetails = (FeedbackConstantSumQuestionDetails) loadedQuestion.getQuestionDetails();
Expand All @@ -78,7 +78,7 @@ protected void testEditPage() {
feedbackEditPage.waitForPageToLoad();

feedbackEditPage.verifyConstSumQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);
}

@Override
Expand All @@ -99,8 +99,8 @@ protected void testSubmitPage() {
List responses = Arrays.asList(response, response2);
feedbackSubmitPage.submitConstSumRecipientResponse(1, responses);

verifyPresentInDatastore(response);
verifyPresentInDatastore(response2);
verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);

______TS("check previous response");
feedbackSubmitPage = getFeedbackSubmitPage();
Expand All @@ -114,8 +114,8 @@ protected void testSubmitPage() {

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyConstSumRecipientResponse(1, responses);
verifyPresentInDatastore(response);
verifyPresentInDatastore(response2);
verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
}

private FeedbackResponseAttributes getResponse(String questionId, StudentAttributes receiver, Integer answer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected void testEditPage() {
feedbackEditPage.addContributionQuestion(loadedQuestion);

feedbackEditPage.verifyContributionQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);

______TS("copy question");
FeedbackQuestionAttributes copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession");
Expand All @@ -67,7 +67,7 @@ protected void testEditPage() {
copiedQuestion.setQuestionNumber(3);

feedbackEditPage.verifyContributionQuestionDetails(3, questionDetails);
verifyPresentInDatastore(copiedQuestion);
verifyPresentInDatabase(copiedQuestion);

______TS("edit question");
questionDetails = (FeedbackContributionQuestionDetails) loadedQuestion.getQuestionDetails();
Expand All @@ -77,7 +77,7 @@ protected void testEditPage() {
feedbackEditPage.waitForPageToLoad();

feedbackEditPage.verifyContributionQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);
}

@Override
Expand All @@ -99,9 +99,9 @@ protected void testSubmitPage() {
List responses = Arrays.asList(response, response2, response3);
feedbackSubmitPage.submitContributionResponse(1, responses);

verifyPresentInDatastore(response);
verifyPresentInDatastore(response2);
verifyPresentInDatastore(response3);
verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
verifyPresentInDatabase(response3);

______TS("check previous response");
feedbackSubmitPage = getFeedbackSubmitPage();
Expand All @@ -116,9 +116,9 @@ protected void testSubmitPage() {

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyContributionResponse(1, responses);
verifyPresentInDatastore(response);
verifyPresentInDatastore(response2);
verifyPresentInDatastore(response3);
verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
verifyPresentInDatabase(response3);
}

private FeedbackResponseAttributes getResponse(String questionId, StudentAttributes receiver, int answer) {
Expand Down
10 changes: 5 additions & 5 deletions src/e2e/java/teammates/e2e/cases/FeedbackMcqQuestionE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void testEditPage() {
feedbackEditPage.addMcqQuestion(loadedQuestion);

feedbackEditPage.verifyMcqQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);

______TS("copy question");
FeedbackQuestionAttributes copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession");
Expand All @@ -65,7 +65,7 @@ protected void testEditPage() {
copiedQuestion.setQuestionNumber(3);

feedbackEditPage.verifyMcqQuestionDetails(3, questionDetails);
verifyPresentInDatastore(copiedQuestion);
verifyPresentInDatabase(copiedQuestion);

______TS("edit question");
questionDetails = (FeedbackMcqQuestionDetails) loadedQuestion.getQuestionDetails();
Expand All @@ -82,7 +82,7 @@ protected void testEditPage() {
feedbackEditPage.waitForPageToLoad();

feedbackEditPage.verifyMcqQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);
}

@Override
Expand All @@ -102,7 +102,7 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response = getResponse(questionId, false, "UI");
feedbackSubmitPage.submitMcqResponse(1, "", response);

verifyPresentInDatastore(response);
verifyPresentInDatabase(response);

______TS("check previous response");
feedbackSubmitPage = getFeedbackSubmitPage();
Expand All @@ -114,7 +114,7 @@ protected void testSubmitPage() {

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyMcqResponse(1, "", response);
verifyPresentInDatastore(response);
verifyPresentInDatabase(response);
}

private List<String> getGeneratedStudentOptions() {
Expand Down
10 changes: 5 additions & 5 deletions src/e2e/java/teammates/e2e/cases/FeedbackMsqQuestionE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void testEditPage() {
feedbackEditPage.addMsqQuestion(loadedQuestion);

feedbackEditPage.verifyMsqQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);

______TS("copy question");
FeedbackQuestionAttributes copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession");
Expand All @@ -68,7 +68,7 @@ protected void testEditPage() {
copiedQuestion.setQuestionNumber(3);

feedbackEditPage.verifyMsqQuestionDetails(3, questionDetails);
verifyPresentInDatastore(copiedQuestion);
verifyPresentInDatabase(copiedQuestion);

______TS("edit question");
questionDetails = (FeedbackMsqQuestionDetails) loadedQuestion.getQuestionDetails();
Expand All @@ -85,7 +85,7 @@ protected void testEditPage() {
feedbackEditPage.waitForPageToLoad();

feedbackEditPage.verifyMsqQuestionDetails(2, questionDetails);
verifyPresentInDatastore(loadedQuestion);
verifyPresentInDatabase(loadedQuestion);
}

@Override
Expand All @@ -109,7 +109,7 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response = getResponse(questionId, receiver, answers.get(answers.size() - 1), answers);
feedbackSubmitPage.submitMsqResponse(1, receiver.getName(), response);

verifyPresentInDatastore(response);
verifyPresentInDatabase(response);

______TS("check previous response");
feedbackSubmitPage = getFeedbackSubmitPage();
Expand All @@ -122,7 +122,7 @@ protected void testSubmitPage() {

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyMsqResponse(1, receiver.getName(), response);
verifyPresentInDatastore(response);
verifyPresentInDatabase(response);
}

private List<String> getGeneratedTeams() {
Expand Down
Loading

0 comments on commit 43735f6

Please sign in to comment.