Skip to content

Commit e128c2a

Browse files
authored
Stop generating controller-first URLs (#2889)
1 parent 84b07f8 commit e128c2a

5 files changed

Lines changed: 15 additions & 41 deletions

File tree

src/org/labkey/test/LabKeySiteWrapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ private void waitForStartup()
646646
throw new RuntimeException("Webapp failed to start up after " + MAX_SERVER_STARTUP_WAIT_SECONDS + " seconds.", lastError);
647647
}
648648
log("Server is running.");
649-
WebTestHelper.setUseContainerRelativeUrl((Boolean)executeScript("return LABKEY.experimental.containerRelativeURL;"));
650649
}
651650

652651
@LogMethod

src/org/labkey/test/WebDriverWrapper.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,25 +1210,22 @@ public long beginAt(String url, int millis, boolean acceptAlerts)
12101210
logMessage = "Navigating to " + relativeURL;
12111211
}
12121212

1213-
if (WebTestHelper.isUseContainerRelativeUrl())
1213+
try
12141214
{
1215-
try
1215+
if (new Crawler.ControllerActionId(relativeURL).isControllerFirstUrl() && !_controllerFirstUrls.contains(url))
12161216
{
1217-
if (new Crawler.ControllerActionId(relativeURL).isControllerFirstUrl() && !_controllerFirstUrls.contains(url))
1218-
{
1219-
_controllerFirstUrls.add(url);
1220-
RuntimeException ex = new RuntimeException("Controller-first url used: " + relativeURL);
1221-
if (TestProperties.isControllerFirstUrlFatal())
1222-
throw ex;
1223-
else
1224-
TestLogger.log().warn(ex.getMessage(), ex);
1225-
}
1226-
}
1227-
catch (IllegalArgumentException e)
1228-
{
1229-
TestLogger.warn("Unable to parse URL: " + relativeURL, e);
1217+
_controllerFirstUrls.add(url);
1218+
RuntimeException ex = new RuntimeException("Controller-first url used: " + relativeURL);
1219+
if (TestProperties.isControllerFirstUrlFatal())
1220+
throw ex;
1221+
else
1222+
TestLogger.log().warn(ex.getMessage(), ex);
12301223
}
12311224
}
1225+
catch (IllegalArgumentException e)
1226+
{
1227+
TestLogger.warn("Unable to parse URL: " + relativeURL, e);
1228+
}
12321229

12331230
final String fullURL = WebTestHelper.getBaseURL() + relativeURL;
12341231
final boolean expectPageLoad = expectPageLoad(fullURL);

src/org/labkey/test/WebTestHelper.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
2727
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
2828
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
29-
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
3029
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
3130
import org.apache.hc.client5.http.impl.io.ManagedHttpClientConnectionFactory;
3231
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
@@ -99,7 +98,6 @@
9998
*/
10099
public class WebTestHelper
101100
{
102-
103101
private static final Logger LOG = LogManager.getLogger(WebTestHelper.class);
104102

105103
public static final Random RANDOM = new Random();
@@ -114,19 +112,13 @@ public class WebTestHelper
114112
private static String _contextPath = null;
115113
public static final int MAX_LEAK_LIMIT = 0;
116114
public static final int GC_ATTEMPT_LIMIT = 6;
117-
private static boolean USE_CONTAINER_RELATIVE_URL = true;
118115
private static final Map<String, Map<String, Cookie>> savedCookies = new HashMap<>();
119116
private static final Map<String, String> savedSessionKeys = new HashMap<>();
120117
private static final Map<String, String> savedApiKeys = new HashMap<>();
121118
private static final Set<String> deletedApiKeys = new HashSet<>();
122119

123120
static { TestProperties.load(); }
124121

125-
public static void setUseContainerRelativeUrl(boolean useContainerRelativeUrl)
126-
{
127-
USE_CONTAINER_RELATIVE_URL = useContainerRelativeUrl;
128-
}
129-
130122
/**
131123
* Save cookies to be used by HTTP requests
132124
*/
@@ -229,11 +221,6 @@ public static void deleteApiKey(Connection connection, String apiKey)
229221
}
230222
}
231223

232-
public static boolean isUseContainerRelativeUrl()
233-
{
234-
return USE_CONTAINER_RELATIVE_URL;
235-
}
236-
237224
private static void acceptLocalhostCert() throws Exception
238225
{
239226
String keystorePassword = System.getProperty("keystore.password", "changeit");

src/org/labkey/test/util/Crawler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ public boolean underCreatedProject()
609609

610610
private void checkControllerRelativeUrl()
611611
{
612-
if (_actionId != null && _actionId.isControllerFirstUrl() && WebTestHelper.isUseContainerRelativeUrl() && !_controllerFirstUrls.contains(_actionId))
612+
if (_actionId != null && _actionId.isControllerFirstUrl() && !_controllerFirstUrls.contains(_actionId))
613613
{
614614
_controllerFirstUrls.add(_actionId);
615615
RuntimeException ex = new RuntimeException("Found a controller-first URL (%s) on %s".formatted(getUrlText(), getOrigin()));

src/org/labkey/test/util/URLBuilder.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ public String buildRelativeURL()
151151
{
152152
StringBuilder url = new StringBuilder();
153153

154-
if (!WebTestHelper.isUseContainerRelativeUrl())
155-
{
156-
url.append("/");
157-
url.append(_controller);
158-
}
159-
160154
if (_containerPath != null) // null is root container; nothing to append.
161155
{
162156
url.append("/");
@@ -167,11 +161,8 @@ public String buildRelativeURL()
167161
}
168162

169163
url.append("/");
170-
if (WebTestHelper.isUseContainerRelativeUrl())
171-
{
172-
url.append(_controller);
173-
url.append("-");
174-
}
164+
url.append(_controller);
165+
url.append("-");
175166
url.append(_action);
176167
if (!_action.contains("."))
177168
url.append(".view");

0 commit comments

Comments
 (0)