[Geoserver-devel] building error on testBackFormatXmlComatibility(org.geoserver.wps.WPSXStreamLoaderTest)

HI geoserver-devel,

While we are trying to fix the build error of Geoserver, we found it broke at the Gs-wps-core:WPSXStreamLoaderTest.java line :81(please refer the attached building output) . We tried to debug and found the reason is because file url path for a resources has space character which was encoded with “%20” . then it caused that the resources was not loaded properly and it breaks the test.

So I thought that I might report it to community. Also I added a few line code to fix the problem, please have it for reference.

Thanks,

Lingbo

/////////////////the building output/////////////////////////

Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec <<< FAILURE!

testBackFormatXmlComatibility(org.geoserver.wps.WPSXStreamLoaderTest) Time elapsed: 4 sec <<< FAILURE!

java.lang.AssertionError

at org.junit.Assert.fail(Assert.java:86)

at org.junit.Assert.assertTrue(Assert.java:41)

at org.junit.Assert.assertTrue(Assert.java:52)

at org.geoserver.wps.WPSXStreamLoaderTest.testBackFormatXmlComatibility(WPSXStreamLoaderTest.java:81)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)

at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)

at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)

at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

/////////////////////////////// please refer the green line code change///////////////////////////

@Test

public void testBackFormatXmlComatibility() throws Exception {

GeoServer gs = createMock(GeoServer.class);

URL url = Thread.currentThread().getContextClassLoader().getResource(“org/geoserver/wps/”);

//Lingbo the url was encoded with “%20” for space.

+File file;

+try {

  • file = new File(url.toURI());

  • } catch(URISyntaxException e) {

  • file = new File(url.getPath());

  • }

-File file = new File(url.getPath());

WPSXStreamLoader loader = new WPSXStreamLoader(new GeoServerResourceLoader(file));

WPSInfo wps = loader.load(gs);

boolean found1 = false;

boolean found2 = false;

for (ProcessGroupInfo pg : wps.getProcessGroups()) {

if (pg.getFactoryClass().getName().equals(“org.geoserver.wps.DeprecatedProcessFactory”)) {

assertFalse(pg.isEnabled());

found1 = true;

}

if (pg.getFilteredProcesses() != null) {

for (Object opi : pg.getFilteredProcesses()) {

assertTrue(opi instanceof ProcessInfo);

}

if (pg.getFactoryClass().getName()

.equals(“org.geoserver.wps.jts.SpringBeanProcessFactory”)) {

assertTrue(pg.isEnabled());

assertEquals(pg.getFilteredProcesses().get(0).getName().toString(),

“gs:GeorectifyCoverage”);

assertEquals(pg.getFilteredProcesses().get(1).getName().toString(),

“gs:GetFullCoverage”);

assertEquals(pg.getFilteredProcesses().get(2).getName().toString(), “gs:Import”);

found2 = true;

}

}

}

assertTrue(found1);

assertTrue(found2);

}

Thanks for the catch - can your please report to the issue tracker?

If you would like to patch please check for consistent use of DataUtilities URL methods.

On Wed, Jan 21, 2015 at 6:50 PM Lingbo.Jiang@anonymised.com wrote:

HI geoserver-devel,

While we are trying to fix the build error of Geoserver, we found it broke at the Gs-wps-core:WPSXStreamLoaderTest.java line :81(please refer the attached building output) . We tried to debug and found the reason is because file url path for a resources has space character which was encoded with “%20” . then it caused that the resources was not loaded properly and it breaks the test.

So I thought that I might report it to community. Also I added a few line code to fix the problem, please have it for reference.

Thanks,

Lingbo

/////////////////the building output/////////////////////////

Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec <<< FAILURE!

testBackFormatXmlComatibility(org.geoserver.wps.WPSXStreamLoaderTest) Time elapsed: 4 sec <<< FAILURE!

java.lang.AssertionError

at org.junit.Assert.fail(Assert.java:86)

at org.junit.Assert.assertTrue(Assert.java:41)

at org.junit.Assert.assertTrue(Assert.java:52)

at org.geoserver.wps.WPSXStreamLoaderTest.testBackFormatXmlComatibility(WPSXStreamLoaderTest.java:81)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)

at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)

at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)

at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

/////////////////////////////// please refer the green line code change///////////////////////////

@Test

public void testBackFormatXmlComatibility() throws Exception {

GeoServer gs = createMock(GeoServer.class);

URL url = Thread.currentThread().getContextClassLoader().getResource(“org/geoserver/wps/”);

//Lingbo the url was encoded with “%20” for space.

+File file;

+try {

  • file = new File(url.toURI());

  • } catch(URISyntaxException e) {

  • file = new File(url.getPath());

  • }

-File file = new File(url.getPath());

WPSXStreamLoader loader = new WPSXStreamLoader(new GeoServerResourceLoader(file));

WPSInfo wps = loader.load(gs);

boolean found1 = false;

boolean found2 = false;

for (ProcessGroupInfo pg : wps.getProcessGroups()) {

if (pg.getFactoryClass().getName().equals(“org.geoserver.wps.DeprecatedProcessFactory”)) {

assertFalse(pg.isEnabled());

found1 = true;

}

if (pg.getFilteredProcesses() != null) {

for (Object opi : pg.getFilteredProcesses()) {

assertTrue(opi instanceof ProcessInfo);

}

if (pg.getFactoryClass().getName()

.equals(“org.geoserver.wps.jts.SpringBeanProcessFactory”)) {

assertTrue(pg.isEnabled());

assertEquals(pg.getFilteredProcesses().get(0).getName().toString(),

“gs:GeorectifyCoverage”);

assertEquals(pg.getFilteredProcesses().get(1).getName().toString(),

“gs:GetFullCoverage”);

assertEquals(pg.getFilteredProcesses().get(2).getName().toString(), “gs:Import”);

found2 = true;

}

}

}

assertTrue(found1);

assertTrue(found2);

}


New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@anonymised.comsourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel