Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/scaled testing #878

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

package cwms.cda.data.dto.location.kind;

import static java.util.Comparator.comparing;

import com.fasterxml.jackson.annotation.JsonProperty;
import cwms.cda.data.dto.CwmsDTOBase;
import cwms.cda.data.dto.CwmsDTOValidator;
Expand All @@ -41,6 +39,7 @@
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import static java.util.Comparator.comparing;

public abstract class PhysicalStructureChange<T extends Setting> extends CwmsDTOBase {
@JsonProperty(required = true)
Expand Down Expand Up @@ -235,6 +234,7 @@ public B withChangeDate(Instant changeDate) {
}

public B withSettings(List<T> settings) {
this.settings.clear();
settings.forEach(s -> {
if (!this.settings.add(s)) {
throw new FormattingException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void sessionEvent(SessionEvent event) {
.wrappedRegister(user.getJSessionId(), mcup, "CLIENT-CERT", null,null);
}
} catch(RuntimeException ex) {
throw new Exception("User registration failed",ex);
// throw new Exception("User registration failed",ex);
}
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.google.common.flogger.FluentLogger;
import cwms.cda.api.errors.NotFoundException;
import cwms.cda.data.dao.DeleteRule;
import cwms.cda.data.dao.LocationGroupDao;
import cwms.cda.data.dto.AssignedLocation;
import cwms.cda.data.dto.LocationGroup;
Expand Down Expand Up @@ -63,4 +64,15 @@ public static void createRatingSpecForOutlet(DSLContext context, Outlet outlet,
locGroupDao.create(realGroup);
}
}

public static void storeOutlet(DSLContext context, Outlet outlet) {
OutletDao dao = new OutletDao(context);
dao.storeOutlet(outlet, false);
}

public static void deleteOutlet(DSLContext context, Outlet outlet) {
OutletDao outletDao = new OutletDao(context);
outletDao.deleteOutlet(outlet.getLocation().getOfficeId(), outlet.getLocation().getName(),
DeleteRule.DELETE_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ static void setup() throws Exception {
CwmsDatabaseContainer<?> databaseLink = CwmsDataApiSetupCallback.getDatabaseLink();
databaseLink.connection(c -> {
DSLContext context = getDslContext(c, OFFICE_ID);
OutletDao outletDao = new OutletDao(context);
deleteLocation(context, TG_LOC4_ID.getOfficeId(), TG_LOC4_ID.getName());
try {
storeLocation(context, TAINTER_GATE_1_LOC);
storeLocation(context, TAINTER_GATE_2_LOC);
storeLocation(context, TAINTER_GATE_3_LOC);
storeLocation(context, BOX_CULVERT_1_LOC);
outletDao.storeOutlet(TAINTER_GATE_1_OUTLET, false);
outletDao.storeOutlet(TAINTER_GATE_2_OUTLET, false);
outletDao.storeOutlet(BOX_CULVERT_1_OUTLET, false);
storeOutlet(context, TAINTER_GATE_1_OUTLET);
storeOutlet(context, TAINTER_GATE_2_OUTLET);
storeOutlet(context, BOX_CULVERT_1_OUTLET);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -91,15 +90,12 @@ static void tearDown() throws Exception {
CwmsDatabaseContainer<?> databaseLink = CwmsDataApiSetupCallback.getDatabaseLink();
databaseLink.connection(c -> {
DSLContext context = getDslContext(c, OFFICE_ID);
OutletDao outletDao = new OutletDao(context);
deleteLocationGroup(context, TAINTER_GATE_1_OUTLET);
deleteLocationGroup(context, TAINTER_GATE_2_OUTLET);
deleteLocationGroup(context, BOX_CULVERT_1_OUTLET);
outletDao.deleteOutlet(TAINTER_GATE_1_LOC.getOfficeId(), TAINTER_GATE_1_LOC.getName(),
DeleteRule.DELETE_ALL);
outletDao.deleteOutlet(TAINTER_GATE_2_LOC.getOfficeId(), TAINTER_GATE_2_LOC.getName(),
DeleteRule.DELETE_ALL);
outletDao.deleteOutlet(BOX_CULVERT_1_LOC.getOfficeId(), BOX_CULVERT_1_LOC.getName(), DeleteRule.DELETE_ALL);
deleteOutlet(context, TAINTER_GATE_1_OUTLET);
deleteOutlet(context, TAINTER_GATE_2_OUTLET);
deleteOutlet(context, BOX_CULVERT_1_OUTLET);
deleteLocation(context, TAINTER_GATE_1_LOC.getOfficeId(), TAINTER_GATE_1_LOC.getName());
deleteLocation(context, TAINTER_GATE_2_LOC.getOfficeId(), TAINTER_GATE_2_LOC.getName());
deleteLocation(context, TAINTER_GATE_3_LOC.getOfficeId(), TAINTER_GATE_3_LOC.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public static void storeLocation(DSLContext context, Location loc) throws IOExce
locationsDao.storeLocation(loc);
}

public static void deleteLocation(DSLContext context, Location loc) {
deleteLocation(context, loc.getOfficeId(), loc.getName());
}
public static void deleteLocation(DSLContext context, String officeId, String locId) {
LocationsDaoImpl locationsDao = new LocationsDaoImpl(context);
try {
Expand Down
Loading
Loading