1+ /*
2+ * Copyright (c) 2023-2025 University Corporation for Atmospheric Research/Unidata
3+ * See LICENSE for license information.
4+ */
5+
16package thredds .server .metadata ;
27
38import static com .google .common .truth .Truth .assertThat ;
1318import org .junit .BeforeClass ;
1419import org .junit .ClassRule ;
1520import org .junit .Test ;
21+ import org .junit .experimental .categories .Category ;
1622import org .testcontainers .containers .GenericContainer ;
1723import org .testcontainers .utility .DockerImageName ;
1824import org .testcontainers .utility .MountableFile ;
2733import ucar .httpservices .HTTPMethod ;
2834import ucar .httpservices .HTTPSession ;
2935
36+ @ Category (Integration .class )
3037public class NcIsoIT {
3138 private static final DockerImageName dockerImageName =
3239 DockerImageName .parse ("unidata/thredds-docker:" + getTdsVersion ());
@@ -39,14 +46,21 @@ public class NcIsoIT {
3946 "/usr/local/tomcat/content/thredds/catalog.xml" )
4047 .withCopyFileToContainer (MountableFile .forClasspathResource ("/thredds/testgrid1.nc" ),
4148 "/usr/local/tomcat/content/thredds/public/testdata/testgrid1.nc" )
42- .withCopyFileToContainer (MountableFile .forHostPath (getJarPath ()),
43- "/usr/local/tomcat/webapps/thredds/WEB-INF/lib/tds-plugin-jar-with-dependencies.jar" );
49+ // copy local tds-plugin jar
50+ .withCopyFileToContainer (MountableFile .forHostPath (getJarPath ("tds-plugin" )),
51+ "/usr/local/tomcat/webapps/thredds/WEB-INF/lib/1-tds-plugin.jar" )
52+ // make sure local nciso-common shows up before bundled nciso-common jar by
53+ // prefixing it with 1-
54+ .withCopyFileToContainer (MountableFile .forHostPath (getJarPath ("../../nciso-common/target/nciso-common" )),
55+ "/usr/local/tomcat/webapps/thredds/WEB-INF/lib/1-nciso-common.jar" );
4456
4557 @ BeforeClass
46- public static void setUp () {
58+ public static void setUp () throws IOException , InterruptedException {
4759 final String address = tds .getHost ();
4860 final Integer port = tds .getFirstMappedPort ();
4961 basePath = "http://" + address + ":" + port + "/thredds/" ;
62+ // remove bundled tds-plugin classes from the classpath
63+ tds .execInContainer ("rm" , "-rf" , "/usr/local/tomcat/webapps/thredds/WEB-INF/classes/thredds/server/metadata" );
5064 }
5165
5266 @ Test
@@ -118,11 +132,11 @@ private static String getTdsVersion() {
118132 return getPropertyValue ("tds_version" );
119133 }
120134
121- private static Path getJarPath () {
135+ private static Path getJarPath (String name ) {
122136 try {
123137 final Path targetPath = Paths .get (ClassLoader .getSystemClassLoader ().getResource ("" ).toURI ()).getParent ();
124- return Paths .get (targetPath .toString (), "tds-plugin- " + getVersion () + "-jar-with-dependencies .jar" );
125- } catch (URISyntaxException e ) {
138+ return Paths .get (targetPath .toRealPath (). toString (), name + "- " + getVersion () + ".jar" );
139+ } catch (URISyntaxException | IOException e ) {
126140 throw new RuntimeException (e );
127141 }
128142 }
0 commit comments