From 670022f008f044d8226f7894cdb522fd9eb8e449 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 16 Oct 2023 19:28:52 +0200 Subject: [PATCH] Use text blocks in StressClient We have inline XML documents here. Make sure they are as crisp as possible. Change-Id: I2d56361b5b7ad78ea596b46196436ab486b53c2f Signed-off-by: Robert Varga --- .../test/tool/client/stress/StressClient.java | 65 ++++++++----------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java index ad2b9e4956..cd26030a96 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java @@ -47,50 +47,39 @@ import org.xml.sax.SAXException; @SuppressFBWarnings("DM_EXIT") public final class StressClient { - private static final Logger LOG = LoggerFactory.getLogger(StressClient.class); static final QName COMMIT_QNAME = QName.create(CommitInput.QNAME, "commit"); - public static final NetconfMessage COMMIT_MSG; - - static { - try { - COMMIT_MSG = new NetconfMessage(XmlUtil.readXmlToDocument( - "\n" - + " \n" - + "")); - } catch (final SAXException | IOException e) { - throw new ExceptionInInitializerError(e); - } - } + public static final NetconfMessage COMMIT_MSG = new NetconfMessage(readString(""" + + + """)); static final QName EDIT_QNAME = QName.create(EditConfigInput.QNAME, "edit-config"); - static final org.w3c.dom.Document EDIT_CANDIDATE_BLUEPRINT; - static final org.w3c.dom.Document EDIT_RUNNING_BLUEPRINT; - - static { + static final Document EDIT_CANDIDATE_BLUEPRINT = readString(""" + + + + + + none + + + """); + static final Document EDIT_RUNNING_BLUEPRINT = readString(""" + + + + + + none + + + """); + + private static Document readString(final String str) { try { - EDIT_CANDIDATE_BLUEPRINT = XmlUtil.readXmlToDocument( - "\n" - + " \n" - + " \n" - + " \n" - + " \n" - + " none" - + " \n" - + " \n" - + ""); - - EDIT_RUNNING_BLUEPRINT = XmlUtil.readXmlToDocument( - "\n" - + " \n" - + " \n" - + " \n" - + " \n" - + " none" - + " \n" - + " \n" - + ""); + return XmlUtil.readXmlToDocument(str); } catch (SAXException | IOException e) { throw new ExceptionInInitializerError(e); } -- 2.36.6