Description
The test uses rest-writer
user to read properties on app server and assert fails. Seems like MarkLogic server security/privileges have been tightened and REST layer needs changes on MarkLogic trunk.
The test started failing from build MarkLogic-10.0-20171219.x86_64.rpm on the Jenkins Job.
public void testErrorOnNonREST() throws ForbiddenUserException {
DatabaseClient badClient = DatabaseClientFactory.newClient(Common.HOST,
8001, new DigestAuthContext(Common.USER, Common.PASS));
ServerConfigurationManager serverConfig = badClient
.newServerConfigManager();
try {
serverConfig.readConfiguration();
} catch (FailedRequestException e) {
assertEquals(
"Local message: config/properties read failed: Not Found. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message.",
e.getMessage());
assertEquals(404, e.getFailedRequest().getStatusCode());
assertEquals("UNKNOWN", e.getFailedRequest().getStatus());
} finally {
badClient.release();
}
}
From ```Common.java```
public class Common {
final public static String USER= "rest-writer";
final public static String PASS= "x";
final public static String REST_ADMIN_USER= "rest-admin";
final public static String REST_ADMIN_PASS= "x";
final public static String SERVER_ADMIN_USER= "admin";
final public static String SERVER_ADMIN_PASS= "admin";
final public static String EVAL_USER= "rest-evaluator";
final public static String EVAL_PASS= "x";
final public static String READ_ONLY_USER= "rest-reader";
final public static String READ_ONLY_PASS= "x";
final public static String READ_PRIVILIGED_USER = "read-privileged";
final public static String READ_PRIVILIGED_PASS = "x";
final public static String WRITE_PRIVILIGED_USER = "write-privileged";
final public static String WRITE_PRIVILIGED_PASS = "x";
final public static String HOST = "localhost";
final public static int PORT = 8012;
public static DatabaseClient client;
...
...
- Version of MarkLogic Java Client API :
develop
branch - Version of MarkLogic Server :
MarkLogic 10
(trunk) nightly build MarkLogic-10.0-20171219.x86_64.rpm onwards - Java version:
java version "1.8.0_101"
- OS and version : Linux
- Error Message seen:
org.junit.ComparisonFailure: expected:<...erties read failed: [Not Found. Server Message: Server (not a REST instance?) did not respond with an expected REST Error messag]e.> but was:<...erties read failed: [Internal Server Error. Server Message: SEC-NOADMIN: (err:FOER0000) User does not have admin rol]e.>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.marklogic.client.test.FailedRequestTest.testErrorOnNonREST(FailedRequestTest.java:115)
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.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
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.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)