Skip to content

Commit

Permalink
Add teaching assistant group name attribute to course entity
Browse files Browse the repository at this point in the history
  • Loading branch information
muenchdo committed Oct 19, 2016
1 parent fc45659 commit e6f37d7
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .jhipster/Course.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"fieldName": "studentGroupName",
"fieldType": "String"
},
{
"fieldName": "teachingAssistantGroupName",
"fieldType": "String"
}
],
"changelogDate": "20160609093907",
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/de/tum/in/www1/exerciseapp/domain/Course.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class Course implements Serializable {
@Column(name = "student_group_name")
private String studentGroupName;

@Column(name = "teaching_assistant_group_name")
private String teachingAssistantGroupName;

@OneToMany(mappedBy = "course")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
Expand Down Expand Up @@ -59,6 +62,14 @@ public void setStudentGroupName(String studentGroupName) {
this.studentGroupName = studentGroupName;
}

public String getTeachingAssistantGroupName() {
return teachingAssistantGroupName;
}

public void setTeachingAssistantGroupName(String teachingAssistantGroupName) {
this.teachingAssistantGroupName = teachingAssistantGroupName;
}

public Set<Exercise> getExercises() {
return exercises;
}
Expand Down Expand Up @@ -93,6 +104,7 @@ public String toString() {
"id=" + id +
", title='" + title + "'" +
", studentGroupName='" + studentGroupName + "'" +
", teachingAssistantGroupName='" + teachingAssistantGroupName + "'" +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="muenchdo (generated)" id="1476886675461-1">
<addColumn tableName="course">
<column name="teaching_assistant_group_name" type="varchar(255)"/>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/config/liquibase/master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<include file="classpath:config/liquibase/changelog/20160927221337_changelog.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20160927225643_changelog.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20161006142956_changelog.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/liquibase/changelog/20161019161722_changelog.xml" relativeToChangelogFile="false"/>
</databaseChangeLog>
4 changes: 4 additions & 0 deletions src/main/webapp/app/entities/course/course-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ <h2><span translate="exerciseApplicationApp.course.detail.title">Course</span> {
<dd>
<span>{{vm.course.studentGroupName}}</span>
</dd>
<dt><span translate="exerciseApplicationApp.course.teachingAssistantGroupName">Teaching Assistant Group Name</span></dt>
<dd>
<span>{{vm.course.teachingAssistantGroupName}}</span>
</dd>
</dl>

<button type="submit"
Expand Down
6 changes: 6 additions & 0 deletions src/main/webapp/app/entities/course/course-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ <h4 class="modal-title" id="myCourseLabel" translate="exerciseApplicationApp.cou
ng-model="vm.course.studentGroupName"
/>
</div>
<div class="form-group">
<label class="control-label" translate="exerciseApplicationApp.course.teachingAssistantGroupName" for="field_teachingAssistantGroupName">Teaching Assistant Group Name</label>
<input type="text" class="form-control" name="teachingAssistantGroupName" id="field_teachingAssistantGroupName"
ng-model="vm.course.teachingAssistantGroupName"
/>
</div>

</div>
<div class="modal-footer">
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/app/entities/course/course.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
return {
title: null,
studentGroupName: null,
teachingAssistantGroupName: null,
id: null
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/app/entities/course/courses.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h2 translate="exerciseApplicationApp.course.home.title">Courses</h2>
<th><span translate="global.field.id">ID</span></th>
<th><span translate="exerciseApplicationApp.course.title">Title</span></th>
<th><span translate="exerciseApplicationApp.course.studentGroupName">Student Group Name</span></th>
<th><span translate="exerciseApplicationApp.course.teachingAssistantGroupName">Teaching Assistant Group Name</span></th>
<th></th>
</tr>
</thead>
Expand All @@ -29,6 +30,7 @@ <h2 translate="exerciseApplicationApp.course.home.title">Courses</h2>
<td><a ui-sref="course-detail({id:course.id})">{{course.id}}</a></td>
<td>{{course.title}}</td>
<td>{{course.studentGroupName}}</td>
<td>{{course.teachingAssistantGroupName}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/de/course.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"title": "Title",
"studentGroupName": "Student Group Name",
"teachingAssistantGroupName": "Teaching Assistant Group Name",
"exercises": "Exercises"
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/en/course.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"title": "Title",
"studentGroupName": "Student Group Name",
"teachingAssistantGroupName": "Teaching Assistant Group Name",
"exercises": "Exercises"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/gatling/simulations/CourseGatlingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CourseGatlingTest extends Simulation {
.exec(http("Create new course")
.post("/api/courses")
.headers(headers_http_authenticated)
.body(StringBody("""{"id":null, "title":"SAMPLE_TEXT", "studentGroupName":"SAMPLE_TEXT"}""")).asJSON
.body(StringBody("""{"id":null, "title":"SAMPLE_TEXT", "studentGroupName":"SAMPLE_TEXT", "teachingAssistantGroupName":"SAMPLE_TEXT"}""")).asJSON
.check(status.is(201))
.check(headerRegex("Location", "(.*)").saveAs("new_course_url"))).exitHereIfFailed
.pause(10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class CourseResourceIntTest {
private static final String UPDATED_TITLE = "BBBBB";
private static final String DEFAULT_STUDENT_GROUP_NAME = "AAAAA";
private static final String UPDATED_STUDENT_GROUP_NAME = "BBBBB";
private static final String DEFAULT_TEACHING_ASSISTANT_GROUP_NAME = "AAAAA";
private static final String UPDATED_TEACHING_ASSISTANT_GROUP_NAME = "BBBBB";

@Inject
private CourseRepository courseRepository;
Expand Down Expand Up @@ -80,6 +82,7 @@ public void initTest() {
course = new Course();
course.setTitle(DEFAULT_TITLE);
course.setStudentGroupName(DEFAULT_STUDENT_GROUP_NAME);
course.setTeachingAssistantGroupName(DEFAULT_TEACHING_ASSISTANT_GROUP_NAME);
}

@Test
Expand All @@ -100,6 +103,7 @@ public void createCourse() throws Exception {
Course testCourse = courses.get(courses.size() - 1);
assertThat(testCourse.getTitle()).isEqualTo(DEFAULT_TITLE);
assertThat(testCourse.getStudentGroupName()).isEqualTo(DEFAULT_STUDENT_GROUP_NAME);
assertThat(testCourse.getTeachingAssistantGroupName()).isEqualTo(DEFAULT_TEACHING_ASSISTANT_GROUP_NAME);
}

@Test
Expand All @@ -114,7 +118,8 @@ public void getAllCourses() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.[*].id").value(hasItem(course.getId().intValue())))
.andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE.toString())))
.andExpect(jsonPath("$.[*].studentGroupName").value(hasItem(DEFAULT_STUDENT_GROUP_NAME.toString())));
.andExpect(jsonPath("$.[*].studentGroupName").value(hasItem(DEFAULT_STUDENT_GROUP_NAME.toString())))
.andExpect(jsonPath("$.[*].teachingAssistantGroupName").value(hasItem(DEFAULT_TEACHING_ASSISTANT_GROUP_NAME.toString())));
}

@Test
Expand All @@ -129,7 +134,8 @@ public void getCourse() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.id").value(course.getId().intValue()))
.andExpect(jsonPath("$.title").value(DEFAULT_TITLE.toString()))
.andExpect(jsonPath("$.studentGroupName").value(DEFAULT_STUDENT_GROUP_NAME.toString()));
.andExpect(jsonPath("$.studentGroupName").value(DEFAULT_STUDENT_GROUP_NAME.toString()))
.andExpect(jsonPath("$.teachingAssistantGroupName").value(DEFAULT_TEACHING_ASSISTANT_GROUP_NAME.toString()));
}

@Test
Expand All @@ -153,6 +159,7 @@ public void updateCourse() throws Exception {
updatedCourse.setId(course.getId());
updatedCourse.setTitle(UPDATED_TITLE);
updatedCourse.setStudentGroupName(UPDATED_STUDENT_GROUP_NAME);
updatedCourse.setTeachingAssistantGroupName(UPDATED_TEACHING_ASSISTANT_GROUP_NAME);

restCourseMockMvc.perform(put("/api/courses")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
Expand All @@ -165,6 +172,7 @@ public void updateCourse() throws Exception {
Course testCourse = courses.get(courses.size() - 1);
assertThat(testCourse.getTitle()).isEqualTo(UPDATED_TITLE);
assertThat(testCourse.getStudentGroupName()).isEqualTo(UPDATED_STUDENT_GROUP_NAME);
assertThat(testCourse.getTeachingAssistantGroupName()).isEqualTo(UPDATED_TEACHING_ASSISTANT_GROUP_NAME);
}

@Test
Expand Down

0 comments on commit e6f37d7

Please sign in to comment.