import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFalseFluentFuture;
import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateTrueFluentFuture;
+import java.util.Map;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.UriInfo;
import org.junit.jupiter.api.BeforeEach;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
+import org.opendaylight.restconf.api.query.PrettyPrintParam;
import org.opendaylight.restconf.server.spi.YangPatchStatusBody;
@ExtendWith(MockitoExtension.class)
@BeforeEach
void beforeEach() {
doReturn(tx).when(dataBroker).newReadWriteTransaction();
- doReturn(new MultivaluedHashMap<>()).when(uriInfo).getQueryParameters();
+ doReturn(new MultivaluedHashMap<>(Map.of(PrettyPrintParam.uriName, "true"))).when(uriInfo).getQueryParameters();
}
@Test
}"""), uriInfo, ar));
assertFormat("""
- {"ietf-yang-patch:yang-patch-status":{"patch-id":"test patch id","ok":[null]}}""", body::formatToJSON);
+ {
+ "ietf-yang-patch:yang-patch-status": {
+ "patch-id": "test patch id",
+ "ok": [
+ null
+ ]
+ }
+ }""", body::formatToJSON);
}
@Test
}"""), uriInfo, ar));
assertFormat("""
- {"ietf-yang-patch:yang-patch-status":{"patch-id":"test patch id","edit-status":{"edit":[\
- {"edit-id":"create data","ok":[null]},\
- {"edit-id":"remove data","ok":[null]},\
- {"edit-id":"delete data","errors":{"error":[{"error-type":"protocol","error-tag":"data-missing",\
- "error-path":"/example-jukebox:jukebox/player/gap","error-message":"Data does not exist"}]}}]}}}""",
- body::formatToJSON);
+ {
+ "ietf-yang-patch:yang-patch-status": {
+ "patch-id": "test patch id",
+ "edit-status": {
+ "edit": [
+ {
+ "edit-id": "create data",
+ "ok": [
+ null
+ ]
+ },
+ {
+ "edit-id": "remove data",
+ "ok": [
+ null
+ ]
+ },
+ {
+ "edit-id": "delete data",
+ "errors": {
+ "error": [
+ {
+ "error-type": "protocol",
+ "error-tag": "data-missing",
+ "error-path": "/example-jukebox:jukebox/player/gap",
+ "error-message": "Data does not exist"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ }""", body::formatToJSON);
}
@Test
</yang-patch>"""), uriInfo, ar));
assertFormat("""
- <yang-patch-status xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">\
- <patch-id>test patch id</patch-id><ok/>\
+ <yang-patch-status xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test patch id</patch-id>
+ <ok/>
</yang-patch-status>""", body::formatToXML);
}
}