Skip to content

Commit

Permalink
[GEOS-8887] Test cannot run on windows, Java keeps a channel open ont…
Browse files Browse the repository at this point in the history
…o the font providing no way to release it
  • Loading branch information
aaime committed Aug 13, 2018
1 parent cd05f42 commit 74c8497
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;

import java.awt.*;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.lang.SystemUtils;
import org.geoserver.data.test.SystemTestData;
import org.geoserver.platform.resource.Resource;
import org.geoserver.platform.resource.Resources;
Expand All @@ -27,6 +29,10 @@ protected void setUpTestData(SystemTestData testData) throws Exception {

@Test
public void testOTFFontRegistration() throws IOException {
// loading fonts causes Java to open a Channel on the file, but there is no way to
// release it from client code, thus the test will fail to delete filse on Windows
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

// in case this font is already on the machine we cannot run a meaningful test
FontCache fontCache = FontCache.getDefaultInstance();
String fontName = "League Mono Regular";
Expand All @@ -44,9 +50,7 @@ public void testOTFFontRegistration() throws IOException {
getGeoServer().reset();

// now the font should be in font cache
assertThat(
fontCache.getAvailableFonts().toString(),
fontCache.getFont(fontName),
CoreMatchers.notNullValue());
Font theFont = fontCache.getFont(fontName);
assertThat(fontCache.getAvailableFonts().toString(), theFont, CoreMatchers.notNullValue());
}
}

0 comments on commit 74c8497

Please sign in to comment.