diff --git a/cwms-data-api/src/main/java/cwms/cda/api/TimeSeriesGroupController.java b/cwms-data-api/src/main/java/cwms/cda/api/TimeSeriesGroupController.java
index b5f27bc53..3630ca94a 100644
--- a/cwms-data-api/src/main/java/cwms/cda/api/TimeSeriesGroupController.java
+++ b/cwms-data-api/src/main/java/cwms/cda/api/TimeSeriesGroupController.java
@@ -96,9 +96,8 @@ private Timer.Context markAndTime(String subject) {
@OpenApi(
queryParams = {
@OpenApiParam(name = OFFICE, description = "Specifies the owning office of the "
- + "timeseries group(s) whose data is to be included in the response. If this "
- + "field is not specified, matching timeseries groups information from all "
- + "offices shall be returned."),
+ + "timeseries assigned to the group(s) whose data is to be included in the response. If this "
+ + "field is not specified, group information for all assigned TS offices shall be returned."),
@OpenApiParam(name = INCLUDE_ASSIGNED, type = Boolean.class, description = "Include"
+ " the assigned timeseries in the returned timeseries groups. (default: true)"),
@OpenApiParam(name = TIMESERIES_CATEGORY_LIKE, description = "Posix regular expression "
@@ -124,7 +123,7 @@ public void getAll(@NotNull Context ctx) {
DSLContext dsl = getDslContext(ctx);
TimeSeriesGroupDao dao = new TimeSeriesGroupDao(dsl);
- String office = ctx.queryParam(OFFICE);
+ String tsOffice = ctx.queryParam(OFFICE);
String groupOffice = ctx.queryParam(GROUP_OFFICE_ID);
String categoryOffice = ctx.queryParam(CATEGORY_OFFICE_ID);
@@ -136,7 +135,7 @@ Boolean.class, true, metrics, name(TimeSeriesGroupController.class.getName(),
String tsGroupLike = queryParamAsClass(ctx, new String[]{TIMESERIES_GROUP_LIKE},
String.class, null, metrics, name(TimeSeriesGroupController.class.getName(), GET_ALL));
- List grps = dao.getTimeSeriesGroups(office, groupOffice, categoryOffice,
+ List grps = dao.getTimeSeriesGroups(tsOffice, groupOffice, categoryOffice,
includeAssigned, tsCategoryLike, tsGroupLike);
if (grps.isEmpty()) {
CdaError re = new CdaError("No data found for The provided office");
@@ -164,8 +163,9 @@ Boolean.class, true, metrics, name(TimeSeriesGroupController.class.getName(),
},
queryParams = {
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the "
- + "owning office of the timeseries group whose data is to be included"
- + " in the response."),
+ + "owning office of the timeseries assigned to the group whose data is to be included"
+ + " in the response. This will limit the assigned timeseries returned to only those"
+ + " assigned to the specified office."),
@OpenApiParam(name = CATEGORY_OFFICE_ID, description = "Specifies the owning office of the "
+ "timeseries group category", required = true),
@OpenApiParam(name = GROUP_OFFICE_ID, description = "Specifies the owning office of the "
@@ -186,7 +186,7 @@ public void getOne(@NotNull Context ctx, @NotNull String groupId) {
DSLContext dsl = getDslContext(ctx);
TimeSeriesGroupDao dao = new TimeSeriesGroupDao(dsl);
- String office = ctx.queryParam(OFFICE);
+ String tsOffice = ctx.queryParam(OFFICE);
String categoryId = ctx.queryParam(CATEGORY_ID);
// Not marked as required to maintain backwards compatibility with existing clients
@@ -197,7 +197,7 @@ public void getOne(@NotNull Context ctx, @NotNull String groupId) {
ContentType contentType = Formats.parseHeader(formatHeader, TimeSeriesGroup.class);
TimeSeriesGroup group = null;
- List timeSeriesGroups = dao.getTimeSeriesGroups(office, groupOffice, categoryOffice,
+ List timeSeriesGroups = dao.getTimeSeriesGroups(tsOffice, groupOffice, categoryOffice,
categoryId, groupId);
if (timeSeriesGroups != null && !timeSeriesGroups.isEmpty()) {
if (timeSeriesGroups.size() == 1) {
@@ -208,7 +208,7 @@ public void getOne(@NotNull Context ctx, @NotNull String groupId) {
"Multiple TimeSeriesGroups returned from getTimeSeriesGroups "
+ "for:%s category:%s groupId:%s At most one match was "
+ "expected. Found:%s",
- office, categoryId, groupId, timeSeriesGroups);
+ groupOffice, categoryId, groupId, timeSeriesGroups);
throw new IllegalArgumentException(message);
}
}
diff --git a/cwms-data-api/src/main/java/cwms/cda/data/dao/TimeSeriesGroupDao.java b/cwms-data-api/src/main/java/cwms/cda/data/dao/TimeSeriesGroupDao.java
index 7386218cd..5285b4703 100644
--- a/cwms-data-api/src/main/java/cwms/cda/data/dao/TimeSeriesGroupDao.java
+++ b/cwms-data-api/src/main/java/cwms/cda/data/dao/TimeSeriesGroupDao.java
@@ -59,22 +59,19 @@ public List getTimeSeriesGroups() {
return getTimeSeriesGroups(null, null, null);
}
- public List getTimeSeriesGroups(String officeId, String groupOfficeId, String categoryOfficeId) {
+ public List getTimeSeriesGroups(String tsOfficeId, String groupOfficeId, String categoryOfficeId) {
Condition whereCond = DSL.noCondition();
- if (officeId != null) {
- whereCond = AV_TS_CAT_GRP.AV_TS_CAT_GRP.GRP_DB_OFFICE_ID.eq(officeId);
+ if (tsOfficeId != null) {
+ whereCond = AV_TS_CAT_GRP.AV_TS_CAT_GRP.GRP_DB_OFFICE_ID.eq(tsOfficeId);
}
- return getTimeSeriesGroupsWhere(whereCond, groupOfficeId, categoryOfficeId);
+ return getTimeSeriesGroupsWhere(whereCond, tsOfficeId, groupOfficeId, categoryOfficeId);
}
- public List getTimeSeriesGroups(String officeId, String groupOfficeId, String categoryOfficeId,
+ public List getTimeSeriesGroups(String tsOfficeId, String groupOfficeId, String categoryOfficeId,
boolean includeAssigned, String tsCategoryLike, String tsGroupLike) {
Condition whereCond = DSL.noCondition();
- if (officeId != null) {
- whereCond = whereCond.and(AV_TS_CAT_GRP.AV_TS_CAT_GRP.GRP_DB_OFFICE_ID.eq(officeId));
- }
if (tsCategoryLike != null) {
whereCond = whereCond.and(JooqDao.caseInsensitiveLikeRegex(AV_TS_CAT_GRP.AV_TS_CAT_GRP.TS_CATEGORY_ID,
@@ -89,7 +86,7 @@ public List getTimeSeriesGroups(String officeId, String groupOf
}
if (includeAssigned) {
- return getTimeSeriesGroupsWhere(whereCond, groupOfficeId, categoryOfficeId);
+ return getTimeSeriesGroupsWhere(whereCond, tsOfficeId, groupOfficeId, categoryOfficeId);
} else {
return getTimeSeriesGroupsWithoutAssigned(whereCond);
}
@@ -97,14 +94,14 @@ public List getTimeSeriesGroups(String officeId, String groupOf
}
- public List getTimeSeriesGroups(String officeId, String groupOfficeId, String categoryOfficeId,
+ public List getTimeSeriesGroups(String tsOfficeId, String groupOfficeId, String categoryOfficeId,
String categoryId, String groupId) {
- return getTimeSeriesGroupsWhere(buildWhereCondition(groupOfficeId, categoryId, groupId), officeId,
+ return getTimeSeriesGroupsWhere(buildWhereCondition(categoryId, groupId), tsOfficeId, groupOfficeId,
categoryOfficeId);
}
@NotNull
- private List getTimeSeriesGroupsWhere(Condition whereCond, String groupOfficeId,
+ private List getTimeSeriesGroupsWhere(Condition whereCond, String tsOfficeId, String groupOfficeId,
String categoryOfficeId) {
AV_TS_CAT_GRP catGrp = AV_TS_CAT_GRP.AV_TS_CAT_GRP;
AV_TS_GRP_ASSGN grpAssgn = AV_TS_GRP_ASSGN.AV_TS_GRP_ASSGN;
@@ -125,6 +122,12 @@ private List getTimeSeriesGroupsWhere(Condition whereCond, Stri
whereCondGrpCat = whereCondGrpCat.and(catGrp.GRP_DB_OFFICE_ID.eq(groupOfficeId.toUpperCase()));
}
+ Condition joinCond = catGrp.TS_CATEGORY_ID.eq(grpAssgn.CATEGORY_ID)
+ .and(catGrp.TS_GROUP_ID.eq(grpAssgn.GROUP_ID));
+ if (tsOfficeId != null) {
+ joinCond = joinCond.and(grpAssgn.DB_OFFICE_ID.eq(tsOfficeId));
+ }
+
SelectSeekStep1, BigDecimal> query = dsl.select(catGrp.CAT_DB_OFFICE_ID,
catGrp.TS_CATEGORY_ID, catGrp.TS_CATEGORY_DESC, catGrp.GRP_DB_OFFICE_ID,
catGrp.TS_GROUP_ID, catGrp.TS_GROUP_DESC, catGrp.SHARED_TS_ALIAS_ID,
@@ -132,8 +135,7 @@ private List getTimeSeriesGroupsWhere(Condition whereCond, Stri
grpAssgn.GROUP_ID, grpAssgn.TS_ID, grpAssgn.TS_CODE, grpAssgn.ATTRIBUTE,
grpAssgn.ALIAS_ID, grpAssgn.REF_TS_ID, grpAssgn.CATEGORY_OFFICE_ID, grpAssgn.GROUP_OFFICE_ID)
.from(catGrp).leftJoin(grpAssgn)
- .on(catGrp.TS_CATEGORY_ID.eq(grpAssgn.CATEGORY_ID)
- .and(catGrp.TS_GROUP_ID.eq(grpAssgn.GROUP_ID)))
+ .on(joinCond)
.where(whereCond)
.and(whereCondGrpCat)
.orderBy(grpAssgn.ATTRIBUTE);
@@ -224,17 +226,10 @@ private TimeSeriesCategory buildTimeSeriesCategory(Record queryRecord) {
}
- private Condition buildWhereCondition(String groupOfficeId, String categoryId, String groupId) {
+ private Condition buildWhereCondition(String categoryId, String groupId) {
AV_TS_CAT_GRP atcg = AV_TS_CAT_GRP.AV_TS_CAT_GRP;
Condition whereCondition = DSL.noCondition();
- if (groupOfficeId != null && !groupOfficeId.isEmpty()) {
- //We do not need to filter on the category office id since category ids
- //are unique unlike group ids.
- //We also don't want to filter on assigned time series' offices since that could leave
- //incomplete groups. If that is ever needed, it should be a separate context variable.
- whereCondition = whereCondition.and(atcg.GRP_DB_OFFICE_ID.eq(groupOfficeId));
- }
if (categoryId != null && !categoryId.isEmpty()) {
whereCondition = whereCondition.and(atcg.TS_CATEGORY_ID.eq(categoryId));
diff --git a/cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesGroupControllerTestIT.java b/cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesGroupControllerTestIT.java
index ce6d8ab92..3e152d19e 100644
--- a/cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesGroupControllerTestIT.java
+++ b/cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesGroupControllerTestIT.java
@@ -181,7 +181,9 @@ void test_group_CWMS() {
given()
.log().ifValidationFails(LogDetail.ALL,true)
.accept("application/json")
- .queryParam("office", CWMS_OFFICE)
+ .queryParam(OFFICE, CWMS_OFFICE)
+ .queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
+ .queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
.when()
.get("/timeseries/group")
.then()
@@ -396,21 +398,7 @@ void test_create_read_delete_agency_aliases_same_name() throws Exception {
.assertThat()
.statusCode(is(HttpServletResponse.SC_CREATED));
//Create Group 2
- groupXml = Formats.format(contentType, group2);
- given()
- .log().ifValidationFails(LogDetail.ALL,true)
- .accept(Formats.JSON)
- .contentType(Formats.JSON)
- .body(groupXml)
- .header("Authorization", user.toHeaderValue())
- .when()
- .redirects().follow(true)
- .redirects().max(3)
- .post("/timeseries/group")
- .then()
- .log().ifValidationFails(LogDetail.ALL,true)
- .assertThat()
- .statusCode((is(HttpServletResponse.SC_CREATED)));
+ loadSqlDataFromResource("cwms/cda/data/sql/create_test_group2.sql");
// Read
given()
.log().ifValidationFails(LogDetail.ALL,true)
@@ -505,22 +493,7 @@ void test_create_read_delete_agency_aliases_same_name() throws Exception {
.assertThat()
.statusCode(is(HttpServletResponse.SC_NO_CONTENT));
//Delete Group
- given()
- .log().ifValidationFails(LogDetail.ALL,true)
- .accept(Formats.JSON)
- .contentType(Formats.JSON)
- .header("Authorization", user.toHeaderValue())
- .queryParam(OFFICE, officeId2)
- .queryParam(CATEGORY_ID, cat.getId())
- .queryParam(CASCADE_DELETE, "true")
- .when()
- .redirects().follow(true)
- .redirects().max(3)
- .delete("/timeseries/group/" + group2.getId())
- .then()
- .log().ifValidationFails(LogDetail.ALL,true)
- .assertThat()
- .statusCode(is(HttpServletResponse.SC_NO_CONTENT));
+ loadSqlDataFromResource("cwms/cda/data/sql/delete_test_group2.sql");
//Read Empty
given()
@@ -604,7 +577,7 @@ void test_create_read_delete_same_names_different_offices() throws Exception {
.accept(Formats.JSON)
.contentType(Formats.JSON)
.body(categoryXml)
- .header("Authorization", user.toHeaderValue())
+ .header("Authorization", user2.toHeaderValue())
.queryParam(OFFICE, officeId2)
.when()
.redirects().follow(true)
@@ -631,21 +604,7 @@ void test_create_read_delete_same_names_different_offices() throws Exception {
.assertThat()
.statusCode(is(HttpServletResponse.SC_CREATED));
//Create Group 2
- groupXml = Formats.format(contentType, group2);
- given()
- .log().ifValidationFails(LogDetail.ALL,true)
- .accept(Formats.JSON)
- .contentType(Formats.JSON)
- .body(groupXml)
- .header("Authorization", user.toHeaderValue())
- .when()
- .redirects().follow(true)
- .redirects().max(3)
- .post("/timeseries/group")
- .then()
- .log().ifValidationFails(LogDetail.ALL,true)
- .assertThat()
- .statusCode(is(HttpServletResponse.SC_CREATED));
+ loadSqlDataFromResource("cwms/cda/data/sql/create_test_group.sql");
//Read
given()
.log().ifValidationFails(LogDetail.ALL,true)
@@ -704,22 +663,7 @@ void test_create_read_delete_same_names_different_offices() throws Exception {
.assertThat()
.statusCode(is(HttpServletResponse.SC_NO_CONTENT));
//Delete Group
- given()
- .log().ifValidationFails(LogDetail.ALL,true)
- .accept(Formats.JSON)
- .contentType(Formats.JSON)
- .header("Authorization", user.toHeaderValue())
- .queryParam(OFFICE, officeId2)
- .queryParam(CATEGORY_ID, cat2.getId())
- .queryParam(CASCADE_DELETE, "true")
- .when()
- .redirects().follow(true)
- .redirects().max(3)
- .delete("/timeseries/group/" + group2.getId())
- .then()
- .log().ifValidationFails(LogDetail.ALL,true)
- .assertThat()
- .statusCode(is(HttpServletResponse.SC_NO_CONTENT));
+ loadSqlDataFromResource("cwms/cda/data/sql/delete_test_group.sql");
//Read Empty
given()
@@ -1154,7 +1098,7 @@ void test_patch_permissions_CWMS() throws Exception {
.log().ifValidationFails(LogDetail.ALL, true)
.accept(Formats.JSONV1)
.contentType(Formats.JSONV1)
- .queryParam(OFFICE, CWMS_OFFICE)
+ .queryParam(OFFICE, officeId)
.queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
.queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
.when()
@@ -1267,7 +1211,7 @@ void test_patch_permissions_CWMS_with_replacement() throws Exception {
.log().ifValidationFails(LogDetail.ALL, true)
.accept(Formats.JSONV1)
.contentType(Formats.JSONV1)
- .queryParam(OFFICE, CWMS_OFFICE)
+ .queryParam(OFFICE, officeId)
.queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
.queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
.when()
@@ -1372,7 +1316,7 @@ void test_patch_district_permission() throws Exception {
.accept(Formats.JSONV1)
.contentType(Formats.JSONV1)
.header("Authorization", user.toHeaderValue())
- .queryParam(OFFICE, CWMS_OFFICE)
+ .queryParam(OFFICE, officeId)
.queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
.queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
.when()
@@ -1387,4 +1331,135 @@ void test_patch_district_permission() throws Exception {
.body("assigned-time-series.size()", equalTo(1))
.body("assigned-time-series[0].timeseries-id", equalTo(tsId));
}
+
+ @Test
+ void testRetrieveOfficeParams() throws Exception {
+ String officeId = user.getOperatingOffice();
+ String timeSeriesId = "Alder Springs.Precip-Cumulative.Inst.15Minutes.0.raw-cda";
+ createLocation(timeSeriesId.split("\\.")[0],true,officeId);
+ TimeSeriesCategory cat = new TimeSeriesCategory(CWMS_OFFICE, "Default", "Default");
+ TimeSeriesGroup group = new TimeSeriesGroup(cat, officeId, "test_create_read_delete", "IntegrationTesting",
+ "sharedTsAliasId", timeSeriesId);
+ List assignedTimeSeries = group.getAssignedTimeSeries();
+
+ BigDecimal tsCode = getTsCode(officeId, timeSeriesId);
+ assignedTimeSeries.add(new AssignedTimeSeries(officeId,timeSeriesId, tsCode, "AliasId", timeSeriesId, 1));
+ ContentType contentType = Formats.parseHeader(Formats.JSON, TimeSeriesCategory.class);
+ String groupXml = Formats.format(contentType, group);
+ //Create Group
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .body(groupXml)
+ .header("Authorization", user.toHeaderValue())
+ .queryParam(FAIL_IF_EXISTS, false)
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .post("/timeseries/group")
+ .then()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .assertThat()
+ .statusCode(is(HttpServletResponse.SC_CREATED));
+ //Read with specified office
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .queryParam(OFFICE, officeId)
+ .queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
+ .queryParam(GROUP_OFFICE_ID, officeId)
+ .queryParam(CATEGORY_ID, group.getTimeSeriesCategory().getId())
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .get("/timeseries/group/" + group.getId())
+ .then()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .assertThat()
+ .statusCode(is(HttpServletResponse.SC_OK))
+ .body("office-id", equalTo(group.getOfficeId()))
+ .body("id", equalTo(group.getId()))
+ .body("description", equalTo(group.getDescription()))
+ .body("assigned-time-series[0].timeseries-id", equalTo(timeSeriesId))
+ .body("assigned-time-series[0].alias-id", equalTo("AliasId"))
+ .body("assigned-time-series[0].ref-ts-id", equalTo(timeSeriesId));
+
+ //Read without specified office
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
+ .queryParam(GROUP_OFFICE_ID, officeId)
+ .queryParam(CATEGORY_ID, group.getTimeSeriesCategory().getId())
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .get("/timeseries/group/" + group.getId())
+ .then()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .assertThat()
+ .statusCode(is(HttpServletResponse.SC_OK))
+ .body("office-id", equalTo(group.getOfficeId()))
+ .body("id", equalTo(group.getId()))
+ .body("description", equalTo(group.getDescription()))
+ .body("assigned-time-series[0].timeseries-id", equalTo(timeSeriesId))
+ .body("assigned-time-series[0].alias-id", equalTo("AliasId"))
+ .body("assigned-time-series[0].ref-ts-id", equalTo(timeSeriesId));
+ //Clear Assigned TS
+ group.getAssignedTimeSeries().clear();
+ groupXml = Formats.format(contentType, group);
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .body(groupXml)
+ .header("Authorization", user.toHeaderValue())
+ .queryParam(CATEGORY_ID, group.getTimeSeriesCategory().getId())
+ .queryParam(REPLACE_ASSIGNED_TS, "true")
+ .queryParam(OFFICE, group.getOfficeId())
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .patch("/timeseries/group/"+ group.getId())
+ .then()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .assertThat()
+ .statusCode(is(HttpServletResponse.SC_OK));
+ //Delete Group
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .header("Authorization", user.toHeaderValue())
+ .queryParam(OFFICE, officeId)
+ .queryParam(CATEGORY_ID, cat.getId())
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .delete("/timeseries/group/" + group.getId())
+ .then()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .assertThat()
+ .statusCode(is(HttpServletResponse.SC_NO_CONTENT));
+
+ //Read Empty
+ given()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .accept(Formats.JSON)
+ .contentType(Formats.JSON)
+ .queryParam(OFFICE, officeId)
+ .queryParam(GROUP_OFFICE_ID, officeId)
+ .queryParam(CATEGORY_OFFICE_ID, officeId)
+ .when()
+ .redirects().follow(true)
+ .redirects().max(3)
+ .get("/timeseries/group/" + group.getId())
+ .then()
+ .assertThat()
+ .log().ifValidationFails(LogDetail.ALL,true)
+ .statusCode(is(HttpServletResponse.SC_NOT_FOUND));
+ }
}
diff --git a/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group.sql b/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group.sql
new file mode 100644
index 000000000..57c1c1c4c
--- /dev/null
+++ b/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group.sql
@@ -0,0 +1,10 @@
+begin
+ -- create a group at CWMS in the mew category
+ cwms_ts.store_ts_group('TestCategory2',
+ 'test_create_read_delete',
+ 'IntegrationTesting','F','T',
+ 'sharedTsAliasId',
+ 'Alder Springs.Precip-Cumulative.Inst.15Minutes.0.raw-cda',
+ 'SWT');
+
+end;
\ No newline at end of file
diff --git a/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group2.sql b/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group2.sql
new file mode 100644
index 000000000..a93b90a9d
--- /dev/null
+++ b/cwms-data-api/src/test/resources/cwms/cda/data/sql/create_test_group2.sql
@@ -0,0 +1,11 @@
+begin
+
+ -- create a group at CWMS in the mew category
+ cwms_ts.store_ts_group('Agency Aliases',
+ 'test_create_read_delete',
+ 'IntegrationTesting','F','T',
+ 'sharedTsAliasId',
+ 'Alder Springs.Precip-Cumulative.Inst.15Minutes.0.raw-cda',
+ 'SWT');
+
+end;
\ No newline at end of file
diff --git a/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group.sql b/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group.sql
new file mode 100644
index 000000000..2cf424822
--- /dev/null
+++ b/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group.sql
@@ -0,0 +1,6 @@
+begin
+ -- delete a group at CWMS in the mew category
+ cwms_ts.delete_ts_group('TestCategory2',
+ 'test_create_read_delete',
+ 'SWT');
+end;
\ No newline at end of file
diff --git a/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group2.sql b/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group2.sql
new file mode 100644
index 000000000..cd69b5265
--- /dev/null
+++ b/cwms-data-api/src/test/resources/cwms/cda/data/sql/delete_test_group2.sql
@@ -0,0 +1,7 @@
+begin
+
+ -- delete a group at CWMS in the mew category
+ cwms_ts.delete_ts_group('Agency Aliases',
+ 'test_create_read_delete',
+ 'SWT');
+end;
\ No newline at end of file