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

Context Path issue when running application in a servlet container #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

larsgsvensson
Copy link
Contributor

@larsgsvensson larsgsvensson commented Jan 23, 2019

When running the application i a servlet container (e. g. Tomcat) the dataset URLs were not properly built since the algorithm did not cater for the servlet path.
In order to write the test cases, I also had to move the tests into the same packages as the classes they test so that they can access protected methods and inner classes

…hey can access protected methods and inner classes
Added dependency on mockito
packaging as war now excludes all jetty*-Jars since they are not needed when running the application in an external servlet container
…ntainer since the algorithm did not take the servlet path into account.
@mielvds
Copy link
Contributor

mielvds commented Oct 17, 2019

Hi, would like to merge this, but it seems to have errors:

shouldIncludeContextPathInBaseUrl(org.linkeddatafragments.fragments.FragmentRequestParserBaseTest)  Time elapsed: 0.036 sec  <<< ERROR!
org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: interface javax.servlet.ServletContext.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.


Java               : 1.8
JVM vendor name    : Oracle Corporation
JVM vendor version : 25.5-b02
JVM name           : Java HotSpot(TM) 64-Bit Server VM
JVM version        : 1.8.0_05-b13
JVM info           : mixed mode
OS name            : Mac OS X
OS version         : 10.13.6


Underlying exception : java.lang.IllegalArgumentException: object is not an instance of declaring class
	at org.linkeddatafragments.fragments.FragmentRequestParserBaseTest.shouldIncludeContextPathInBaseUrl(FragmentRequestParserBaseTest.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	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:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	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)

@awoods
Copy link

awoods commented Oct 25, 2019

The non-functional reformatting in this pull-request makes the review very challenging. Would it be possible to resubmit, only including the functional updates?

awoods pushed a commit to awoods/Server.Java that referenced this pull request Oct 25, 2019
Prior to this update, when deploying to a servlet container:
- the style.css does not resolve
- the favicon.ico does not resolve
- the "Linked Data Fragments" image does not resolve
- the contexts of datasource do not resolve

Resolves: LinkedDataFragments#52
awoods pushed a commit to awoods/Server.Java that referenced this pull request Oct 25, 2019
Prior to this update, when deploying to a servlet container:
- the style.css does not resolve
- the favicon.ico does not resolve
- the "Linked Data Fragments" image does not resolve
- the contexts of datasource do not resolve

Resolves: LinkedDataFragments#52
awoods pushed a commit to awoods/Server.Java that referenced this pull request Oct 26, 2019
Prior to this update, when deploying to a servlet container:
- the style.css does not resolve
- the favicon.ico does not resolve
- the "Linked Data Fragments" image does not resolve
- the contexts of datasource do not resolve

Resolves: LinkedDataFragments#52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants