Move simple QueryParams tests 08/98108/4
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 24 Oct 2021 17:50:02 +0000 (19:50 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 24 Oct 2021 18:27:23 +0000 (20:27 +0200)
We have a number of tests which do not require anything from
transaction-related, but are pure databind validation tests. Move them.

Also do not tolerate null uriInfo -- it should always be present at
runtime.

JIRA: NETCONF-773
Change-Id: I8dfd5e32706a99313249387721f0a41210e1e558
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParams.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParamsTest.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtilTest.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/TestData.java

index 1d22460e5704a931f0197d697e9c89eab12d9b92..d18b0435d80b40939840e37a69da9e301097d2a6 100644 (file)
@@ -103,10 +103,6 @@ public final class QueryParams {
      */
     public static QueryParameters newReadDataParams(final InstanceIdentifierContext<?> identifier,
                                                     final UriInfo uriInfo) {
-        if (uriInfo == null) {
-            return QueryParameters.empty();
-        }
-
         // check only allowed parameters
         final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
         checkParametersTypes(queryParams.keySet(), ALLOWED_PARAMETERS);
index 97e3e456d5febe1ac055934b650288964c39320f..97f8b1fe23af70acce861638f7185e79011acd52 100644 (file)
@@ -8,20 +8,50 @@
 package org.opendaylight.restconf.nb.rfc8040.databind.jaxrs;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
 
 import java.util.List;
 import java.util.Set;
 import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.common.errors.RestconfError;
 import org.opendaylight.restconf.nb.rfc8040.ContentParameter;
 import org.opendaylight.restconf.nb.rfc8040.DepthParameter;
+import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter;
+import org.opendaylight.restconf.nb.rfc8040.legacy.QueryParameters;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class QueryParamsTest {
+    @Mock
+    public InstanceIdentifierContext<ContainerSchemaNode> context;
+    @Mock
+    public UriInfo uriInfo;
+    @Mock
+    public EffectiveModelContext modelContext;
+    @Mock
+    public ContainerSchemaNode containerSchema;
+    @Mock
+    public LeafSchemaNode containerChildSchema;
+
     /**
      * Test when parameter is present at most once.
      */
@@ -74,4 +104,182 @@ public class QueryParamsTest {
         assertEquals("Error type is not correct", ErrorType.PROTOCOL, error.getErrorType());
         assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, error.getErrorTag());
     }
+
+    /**
+     * Test of parsing default parameters from URI request.
+     */
+    @Test
+    public void parseUriParametersDefaultTest() {
+        // no parameters, default values should be used
+        mockQueryParameters(new MultivaluedHashMap<String, String>());
+
+        final QueryParameters parsedParameters = QueryParams.newReadDataParams(context, uriInfo);
+
+        assertEquals(ContentParameter.ALL, parsedParameters.getContent());
+        assertNull(parsedParameters.getDepth());
+        assertNull(parsedParameters.getFields());
+    }
+
+    /**
+     * Testing parsing of with-defaults parameter which value which is not supported.
+     */
+    @Test
+    public void parseUriParametersWithDefaultInvalidTest() {
+        // preparation of input data
+        mockQueryParameter("with-defaults", "invalid");
+
+        final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+            () -> QueryParams.newReadDataParams(context, uriInfo));
+        final List<RestconfError> errors = ex.getErrors();
+        assertEquals(1, errors.size());
+        assertEquals(ErrorTag.INVALID_VALUE, errors.get(0).getErrorTag());
+    }
+
+    /**
+     * Negative test of parsing request URI parameters when depth parameter has not allowed value.
+     */
+    @Test
+    public void parseUriParametersDepthParameterNegativeTest() {
+        // inserted value is not allowed
+        mockQueryParameter("depth", "bounded");
+
+        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+            () -> QueryParams.newReadDataParams(context, uriInfo));
+        // Bad request
+        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
+    }
+
+    /**
+     * Negative test of parsing request URI parameters when content parameter has not allowed value.
+     */
+    @Test
+    public void parseUriParametersContentParameterNegativeTest() {
+        mockQueryParameter("content", "not-allowed-parameter-value");
+
+        final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+            () -> QueryParams.newReadDataParams(context, uriInfo));
+        // Bad request
+        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
+    }
+
+    /**
+     * Negative test of parsing request URI parameters when depth parameter has not allowed value (more than maximum).
+     */
+    @Test
+    public void parseUriParametersDepthMaximalParameterNegativeTest() {
+        // inserted value is too high
+        mockQueryParameter("depth", "65536");
+
+        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+            () -> QueryParams.newReadDataParams(context, uriInfo));
+        // Bad request
+        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
+    }
+
+    /**
+     * Negative test of parsing request URI parameters when depth parameter has not allowed value (less than minimum).
+     */
+    @Test
+    public void parseUriParametersDepthMinimalParameterNegativeTest() {
+        // inserted value is too low
+        mockQueryParameter("depth", "0");
+
+        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+            () -> QueryParams.newReadDataParams(context, uriInfo));
+        // Bad request
+        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
+    }
+
+    /**
+     * Testing parsing of with-defaults parameter which value matches 'report-all-tagged' setting - default value should
+     * be set to {@code null} and tagged flag should be set to {@code true}.
+     */
+    @Test
+    public void parseUriParametersWithDefaultAndTaggedTest() {
+        // preparation of input data
+        mockQueryParameter("with-defaults", "report-all-tagged");
+
+        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
+        assertNull(writerParameters.getWithDefault());
+        assertTrue(writerParameters.isTagged());
+    }
+
+    /**
+     * Testing parsing of with-defaults parameter which value matches 'report-all' setting - default value should
+     * be set to {@code null} and tagged flag should be set to {@code false}.
+     */
+    @Test
+    public void parseUriParametersWithDefaultAndReportAllTest() {
+        // preparation of input data
+        mockQueryParameter("with-defaults", "report-all");
+
+        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
+        assertNull(writerParameters.getWithDefault());
+        assertFalse(writerParameters.isTagged());
+    }
+
+    /**
+     * Testing parsing of with-defaults parameter which value doesn't match report-all or report-all-tagged patterns
+     * - non-reporting setting.
+     */
+    @Test
+    public void parseUriParametersWithDefaultAndNonTaggedTest() {
+        // preparation of input data
+        mockQueryParameter("with-defaults", "explicit");
+
+        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
+        assertSame(WithDefaultsParameter.EXPLICIT, writerParameters.getWithDefault());
+        assertFalse(writerParameters.isTagged());
+    }
+
+    /**
+     * Test of parsing user defined parameters from URI request.
+     */
+    @Test
+    public void parseUriParametersUserDefinedTest() {
+        final QName containerChild = QName.create("ns", "container-child");
+
+        final MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
+        parameters.putSingle("content", "config");
+        parameters.putSingle("depth", "10");
+        parameters.putSingle("fields", "container-child");
+        mockQueryParameters(parameters);
+
+        doReturn(QName.create(containerChild, "container")).when(containerSchema).getQName();
+        doReturn(containerChildSchema).when(containerSchema).dataChildByName(containerChild);
+        doReturn(containerChild).when(containerChildSchema).getQName();
+
+        doReturn(modelContext).when(context).getSchemaContext();
+        doReturn(containerSchema).when(context).getSchemaNode();
+
+        final QueryParameters parsedParameters = QueryParams.newReadDataParams(context, uriInfo);
+
+        // content
+        assertEquals(ContentParameter.CONFIG, parsedParameters.getContent());
+
+        // depth
+        final DepthParameter depth = parsedParameters.getDepth();
+        assertNotNull(depth);
+        assertEquals(10, depth.value());
+
+        // fields
+        assertNotNull(parsedParameters.getFields());
+        assertEquals(1, parsedParameters.getFields().size());
+        assertEquals(1, parsedParameters.getFields().get(0).size());
+        assertEquals(containerChild, parsedParameters.getFields().get(0).iterator().next());
+    }
+
+    private void mockQueryParameter(final String name, final String value) {
+        final MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
+        parameters.putSingle(name, value);
+        mockQueryParameters(parameters);
+    }
+
+    private void mockQueryParameters(final MultivaluedMap<String, String> parameters) {
+        doReturn(parameters).when(uriInfo).getQueryParameters();
+    }
 }
index 9abea5fd1780c5e21fafacb4ac92ae7906a3a26a..4ab11afa72cb7e2494fc3eb665ef2f46f31ea658 100644 (file)
@@ -8,22 +8,12 @@
 package org.opendaylight.restconf.nb.rfc8040.rests.utils;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFluentFuture;
 
 import com.google.common.collect.ImmutableList;
-import java.util.List;
 import java.util.Optional;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.UriInfo;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.junit.Before;
@@ -36,18 +26,10 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
 import org.opendaylight.netconf.dom.api.NetconfDataTreeService;
 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.common.errors.RestconfError;
 import org.opendaylight.restconf.nb.rfc8040.ContentParameter;
-import org.opendaylight.restconf.nb.rfc8040.DepthParameter;
-import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter;
-import org.opendaylight.restconf.nb.rfc8040.databind.jaxrs.QueryParams;
-import org.opendaylight.restconf.nb.rfc8040.legacy.QueryParameters;
 import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy;
 import org.opendaylight.restconf.nb.rfc8040.rests.transactions.NetconfRestconfStrategy;
 import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
-import org.opendaylight.yangtools.yang.common.ErrorTag;
-import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
@@ -60,11 +42,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class ReadDataTransactionUtilTest {
-
     private static final TestData DATA = new TestData();
     private static final NodeIdentifier NODE_IDENTIFIER =
         new NodeIdentifier(QName.create("ns", "2016-02-28", "container"));
@@ -80,22 +60,12 @@ public class ReadDataTransactionUtilTest {
     @Mock
     private EffectiveModelContext schemaContext;
     @Mock
-    private ContainerSchemaNode containerSchemaNode;
-    @Mock
-    private LeafSchemaNode containerChildNode;
-    private QName containerChildQName;
+    private DOMDataBroker mockDataBroker;
 
     @Before
     public void setUp() {
-        containerChildQName = QName.create("ns", "2016-02-28", "container-child");
-
-        when(context.getSchemaContext()).thenReturn(schemaContext);
-        when(context.getSchemaNode()).thenReturn(containerSchemaNode);
-        when(containerSchemaNode.getQName()).thenReturn(NODE_IDENTIFIER.getNodeType());
-        when(containerChildNode.getQName()).thenReturn(containerChildQName);
-        when(containerSchemaNode.dataChildByName(containerChildQName)).thenReturn(containerChildNode);
-
-        DOMDataBroker mockDataBroker = mock(DOMDataBroker.class);
+        // FIXME: these tests need to be parameterized somehow. The trouble is we need mocking before we invoke
+        //        the strategy. This needs some more thought.
         doReturn(read).when(mockDataBroker).newReadOnlyTransaction();
         mdsalStrategy = new MdsalRestconfStrategy(mockDataBroker);
         netconfStrategy = new NetconfRestconfStrategy(netconfService);
@@ -322,197 +292,6 @@ public class ReadDataTransactionUtilTest {
         assertNull(normalizedNode);
     }
 
-    /**
-     * Test of parsing default parameters from URI request.
-     */
-    @Test
-    public void parseUriParametersDefaultTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-
-        // no parameters, default values should be used
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final QueryParameters parsedParameters = QueryParams.newReadDataParams(context, uriInfo);
-
-        assertEquals(ContentParameter.ALL, parsedParameters.getContent());
-        assertNull(parsedParameters.getDepth());
-        assertNull(parsedParameters.getFields());
-    }
-
-    /**
-     * Test of parsing user defined parameters from URI request.
-     */
-    @Test
-    public void parseUriParametersUserDefinedTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("content", "config");
-        parameters.putSingle("depth", "10");
-        parameters.putSingle("fields", containerChildQName.getLocalName());
-
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final QueryParameters parsedParameters = QueryParams.newReadDataParams(context, uriInfo);
-
-        // content
-        assertEquals(ContentParameter.CONFIG, parsedParameters.getContent());
-
-        // depth
-        final DepthParameter depth = parsedParameters.getDepth();
-        assertNotNull(depth);
-        assertEquals(10, depth.value());
-
-        // fields
-        assertNotNull(parsedParameters.getFields());
-        assertEquals(1, parsedParameters.getFields().size());
-        assertEquals(1, parsedParameters.getFields().get(0).size());
-        assertEquals(containerChildQName, parsedParameters.getFields().get(0).iterator().next());
-    }
-
-    /**
-     * Negative test of parsing request URI parameters when content parameter has not allowed value.
-     */
-    @Test
-    public void parseUriParametersContentParameterNegativeTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("content", "not-allowed-parameter-value");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
-            () -> QueryParams.newReadDataParams(context, uriInfo));
-        // Bad request
-        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
-        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
-    }
-
-    /**
-     * Negative test of parsing request URI parameters when depth parameter has not allowed value.
-     */
-    @Test
-    public void parseUriParametersDepthParameterNegativeTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-
-        // inserted value is not allowed
-        parameters.putSingle("depth", "bounded");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
-            () -> QueryParams.newReadDataParams(context, uriInfo));
-        // Bad request
-        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
-        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
-    }
-
-    /**
-     * Negative test of parsing request URI parameters when depth parameter has not allowed value (less than minimum).
-     */
-    @Test
-    public void parseUriParametersDepthMinimalParameterNegativeTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-
-        // inserted value is too low
-        parameters.putSingle("depth", "0");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
-            () -> QueryParams.newReadDataParams(context, uriInfo));
-        // Bad request
-        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
-        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
-    }
-
-    /**
-     * Negative test of parsing request URI parameters when depth parameter has not allowed value (more than maximum).
-     */
-    @Test
-    public void parseUriParametersDepthMaximalParameterNegativeTest() {
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-
-        // inserted value is too high
-        parameters.putSingle("depth", "65536");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
-            () -> QueryParams.newReadDataParams(context, uriInfo));
-        // Bad request
-        assertEquals("Error type is not correct", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
-        assertEquals("Error tag is not correct", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
-    }
-
-    /**
-     * Testing parsing of with-defaults parameter which value doesn't match report-all or report-all-tagged patterns
-     * - non-reporting setting.
-     */
-    @Test
-    public void parseUriParametersWithDefaultAndNonTaggedTest() {
-        // preparation of input data
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("with-defaults", "explicit");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
-        assertSame(WithDefaultsParameter.EXPLICIT, writerParameters.getWithDefault());
-        assertFalse(writerParameters.isTagged());
-    }
-
-    /**
-     * Testing parsing of with-defaults parameter which value which is not supported.
-     */
-    @Test
-    public void parseUriParametersWithDefaultInvalidTest() {
-        // preparation of input data
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("with-defaults", "invalid");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
-            () -> QueryParams.newReadDataParams(context, uriInfo));
-        final List<RestconfError> errors = ex.getErrors();
-        assertEquals(1, errors.size());
-        assertEquals(ErrorTag.INVALID_VALUE, errors.get(0).getErrorTag());
-    }
-
-    /**
-     * Testing parsing of with-defaults parameter which value matches 'report-all-tagged' setting - default value should
-     * be set to {@code null} and tagged flag should be set to {@code true}.
-     */
-    @Test
-    public void parseUriParametersWithDefaultAndTaggedTest() {
-        // preparation of input data
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("with-defaults", "report-all-tagged");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
-        assertNull(writerParameters.getWithDefault());
-        assertTrue(writerParameters.isTagged());
-    }
-
-    /**
-     * Testing parsing of with-defaults parameter which value matches 'report-all' setting - default value should
-     * be set to {@code null} and tagged flag should be set to {@code false}.
-     */
-    @Test
-    public void parseUriParametersWithDefaultAndReportAllTest() {
-        // preparation of input data
-        final UriInfo uriInfo = mock(UriInfo.class);
-        final MultivaluedHashMap<String, String> parameters = new MultivaluedHashMap<>();
-        parameters.putSingle("with-defaults", "report-all");
-        when(uriInfo.getQueryParameters()).thenReturn(parameters);
-
-        final QueryParameters writerParameters = QueryParams.newReadDataParams(context, uriInfo);
-        assertNull(writerParameters.getWithDefault());
-        assertFalse(writerParameters.isTagged());
-    }
-
     /**
      * Read specific type of data from data store via transaction.
      *
index 31bc06b9ac5d5ddc47f4adf78de308812779f0bd..fb2d10c4cef98b74507494fd6a643bb4aeb3b678 100644 (file)
@@ -53,6 +53,7 @@ final class TestData {
     final QName leafListQname = QName.create(base, "leaf-list");
     final QName listQname = QName.create(base, "list");
 
+    // FIXME: ${DEITY}, this is fugly. All these are essentially constants for ReadDataTransactionUtilTest!
     TestData() {
         final NodeIdentifierWithPredicates nodeWithKey =
                 NodeIdentifierWithPredicates.of(listQname, listKeyQName, "keyValue");