Closed adityaketkar closed 6 years ago
Merging #174 into broken-dev will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## broken-dev #174 +/- ##
===========================================
Coverage 57.49% 57.49%
===========================================
Files 47 47
Lines 1261 1261
Branches 103 103
===========================================
Hits 725 725
Misses 513 513
Partials 23 23
Impacted Files | Coverage Δ | |
---|---|---|
...rsistence/repository/ElasticSearchFactoryImpl.java | 100% <ø> (ø) |
:arrow_up: |
...er/persistence/repository/ElasticSearchConfig.java | 100% <ø> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ff5c4bc...f70119a. Read the comment docs.
@adityaketkar I will verify the PR on my computer. In the mean time, I would request you to document the descriptions of annotations used in this PR. The relevant pages are:
These pages are coding tutorial cum coding style pages. We are going to use these pages to standardise the coding idioms to use in the project. Each page should contain a brief motivation for using the annotation, what scenarios do we use it, coding examples from our project, and external references.
@adityaketkar
I ran the tests on my system. The integration test fails with the following exception.
org.elasticsearch.ElasticsearchIllegalStateException: Failed to created node environment
at org.elasticsearch.node.internal.InternalNode.<init>(InternalNode.java:162)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
at in.ac.bits.protocolanalyzer.persistence.repository.ElasticSearchConfig.elasticsearchTemplate(ElasticSearchConfig.java:32)
at unit.in.ac.bits.protocolanalyzer.persistence.repository.ElasticSearchConfigTest.testElasticsearchTemplate(ElasticSearchConfigTest.java:47)
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:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207)
Caused by: java.nio.file.AccessDeniedException: /opt/darshini-es
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:105)
at org.elasticsearch.node.internal.InternalNode.<init>(InternalNode.java:160)
... 33 more
The exception clearly points to not having /opt/darshini-es
directory in the file system. I created the same and given ownership permissions over the folder to the user who runs Eclipse. The exception disappears and all the tests pass. The integration test ends up creating data repositories for Elastic Search. We thought we were mocking the ElasticSearchTemplate, there by mocking the Elastic Search completely. Obviously, that conclusion is not true.
We might as well not mock anything in the integration tests.
@kapilkalra04 you might want to create /opt/darshini-es directory and give ownership to your regular user who runs Eclipse. Then try the tests. Let's see if this works for you as well.
Yes after giving access permissions to the required folder, all tests passed.
@adityaketkar and @kapilkalra04 Have both of you deployed a war build from adityaketkar:broken-dev
to tomcat 8.5 successfully?
@prasadtalasila I have done it.
Description
Motivation
The mock created by Mockito for ElasticSearchTemplate was as good as the object itself, because it created data repositories for Elastic Search.
Types of changes
Checks
Fixes #<issue number>
if relevantNotify reviewers
@prasadtalasila @kapilkalra04