From 7f0ccd114478cca250a00c3504e85e42e78e8f1a Mon Sep 17 00:00:00 2001 From: YX Z Date: Sun, 28 Apr 2024 21:07:02 +0800 Subject: [PATCH] Update progress and knowledge --- students/yuanxi1/knowledge.md | 41 ++++++++++++++++++++++++++++++++--- students/yuanxi1/progress.md | 38 +++++++++++++++++++++++++++----- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/students/yuanxi1/knowledge.md b/students/yuanxi1/knowledge.md index 32f518447..5a9882458 100644 --- a/students/yuanxi1/knowledge.md +++ b/students/yuanxi1/knowledge.md @@ -7,10 +7,10 @@ Page Object Pattern is used in TEAMMATES to facilitate UI changes. In this pattern, a class is created for each page . It helps separate the details of the interactions with the webpage with the rest of the test. Page Object provides an interface for the tests to interact with the page's UI without having to directly manipulate the HTML elements. -Resourses: +Resources: - Page Object Pattern: https://martinfowler.com/bliki/PageObject.html - Examples of e2e test with Selenium: https://medium.com/@iamfaisalkhatri/end-to-end-testing-using-selenium-webdriver-and-java-4ff8667716ca -- Selenium documention: https://www.selenium.dev/documentation/webdriver/actions_api/ +- Selenium documentation: https://www.selenium.dev/documentation/webdriver/actions_api/ ## Unit tests @@ -41,4 +41,39 @@ Generated snapshots do not include platform specific or other non-deterministic Resourses: - JestJs documentation: https://jestjs.io/docs/snapshot-testing - \ No newline at end of file + +## Hibernate ORM +**Entity lifecycle**\ +Hibernate can help manage objects and automatically propagate the changes to database. Hibernate entity lifecycle state explains how the entity is related to a persistence context. +- Transient: a newly created object (such as created by calling the constructor) is not associated with a Hibernate session. To save it to the database, `persist` need to be called to +- Persistent: entity has been associated with a database table row.Any change made to such entity is going to be detected and propagated to the database (during the Session flush-time) +- Detached: A detached entity is not tracked anymore by any persistence context +- Removed: An entity is in a deleted (removed) state if Session.delete(entity) has been called, and the Session has marked the entity for deletion. + +**JPA & Hibernate Annotations**\ +Annotations are used to provide the metadata for the Object and Relational Table mapping directly in the Java source code. Annotations such as `@Entity`, `@Column`, `@Table`, and `@OneToMany`, can define the structure of the database schema. + +They are also important for enhancing performance. For example, a join column if not specified with a lazy fetch strategy will cause unnecessary fetch if the data in the join column are not often needed. (Similar problems were presented during data migration some annotations had to be changed in the migration branch). + + +Resources: +- [Hibernate 6 documentation](https://docs.jboss.org/hibernate/orm/6.5/introduction/html_single/Hibernate_Introduction.html#entities-summary) +- [A beginner’s guide to entity state transitions with JPA and Hibernate](https://vladmihalcea.com/a-beginners-guide-to-jpa-hibernate-entity-state-transitions/) +- [Hibernate Entity Lifecycle](https://www.baeldung.com/hibernate-entity-lifecycle) + + +## Data Migration with Technology Integration + +- #### Optimization + Techniques such as batch processing can minimize overhead and maximize throughput during data transfer. Avoiding unnecessary joins and fetches are also important. For example, [`EntityManager.getReference`](https://docs.oracle.com/javaee/7/api/javax/persistence/EntityManager.html#getReference-java.lang.Class-java.lang.Object-) can be used to lazily fetch the foreign key referenced object. +- #### Dependency Preservation + topological ordering of the tables being migrated should be established and migrate entities in order. +- #### Patchable Script Design + large-scale data migration needs to be patchable as it needs to be executed multiple times to minimise downtime. + +- #### Testing with Staging + the initial step involved setting up a Google Cloud SQL instance for testing to provide insights into the real-time performance and scalability. + +Resources: +- [Teammates staging server set up guide](https://github.com/TEAMMATES/teammates-ops/blob/master/platform-guide.md) +- [Hibernate 6 documentation](https://docs.jboss.org/hibernate/orm/6.5/introduction/html_single/Hibernate_Introduction.html#entities-summary) diff --git a/students/yuanxi1/progress.md b/students/yuanxi1/progress.md index 473c09ff9..a1ae5af06 100644 --- a/students/yuanxi1/progress.md +++ b/students/yuanxi1/progress.md @@ -1,9 +1,35 @@ +### TEAMMATES + +#### Overview + +* Actions and Tests Migration + * Actions & Integration tests: `JoinCourseAction`, `SearchStudentsAction` + * Unit tests: `FeedbackresponseDbTest` + * E2E tests: `NotificationBannerE2E`, `InstructorNotificationsPageE2E`, `FeedBackRubricQuestionsE2E`, + +* Multiple Course Structure + * Discussed and wrote design documents on user stories, requriments, logic and db changes + * Created wireframes and DB diagram with the planned changes +* Data Migration + * Wrote migration and verificaiton script for feedback session entity + * Designed and implemented new migration script for by-course migration in a team of 3 + * Assited in reviewing some data migration PRs + | Week | Achievements | | ---- | ------------ | -| 3 | Merged PR: [Migrate join course action #12722](https://github.com/TEAMMATES/teammates/pull/12722) | -| 4 | Merged PR: [Migrate search students action #12735](https://github.com/TEAMMATES/teammates/pull/12735) | -| 5 | Submitted PR: [Add test cases for Feedback response Db](https://github.com/TEAMMATES/teammates/pull/12761) | -| 6 | Merged PR: [Add locale for java datetime formatter](https://github.com/TEAMMATES/teammates/pull/12826) | -| 6 | Merged PR: [Migrate Notification Banner E2E](https://github.com/TEAMMATES/teammates/pull/12840) | +| 3 | Authored PR: [Migrate join course action #12722](https://github.com/TEAMMATES/teammates/pull/12722) | +| 4 | Authored PR: [Migrate search students action #12735](https://github.com/TEAMMATES/teammates/pull/12735) | +| 5 | Authored PR: [Add test cases for Feedback response Db](https://github.com/TEAMMATES/teammates/pull/12761) | +| 6 | Authored PR: [Add locale for java datetime formatter](https://github.com/TEAMMATES/teammates/pull/12826) | +| 6 | Authored PR: [Migrate Notification Banner E2E](https://github.com/TEAMMATES/teammates/pull/12840) | | 7 | Multiple section/team structure tech design (User flow and Requirements) | -| 8 | Multiple section/team structure tech design (Created UI wireframes) | \ No newline at end of file +| 8 | Multiple section/team structure tech design (Created UI wireframes) | +| 9 | [Migrate InstructorNotificationsPageE2E](https://github.com/TEAMMATES/teammates/pull/12906) | +| 10 | Authored PR: [Data migration for feedback session entities](https://github.com/TEAMMATES/teammates/pull/13046) | +| 11 | Discussed and wrote design for new migration script by course | +| 11 | Reviewed PR: [Data migration for course entities](https://github.com/TEAMMATES/teammates/pull/12980) | +| 12 |Authored PR: [Data migration: ensure consistency when script is stopped and resumed](https://github.com/TEAMMATES/teammates/pull/13046) | +| 13 | Authored PR: [Migrate FeedbackRubricQuestionsE2E ](https://github.com/TEAMMATES/teammates/pull/13078) | +| R | Authored PR: [Test and fix course entity migration script](https://github.com/TEAMMATES/teammates/pull/13082) | +| R | Reviewed PR: [Add seed and verification scripts for feedback chain](https://github.com/TEAMMATES/teammates/pull/13074) | +| R | Assisted prod testing by Prof | \ No newline at end of file