- String rawStr = strBuilder.toString();
- if (removeWhiteChars) {
- rawStr = rawStr.replace("\n", "");
- rawStr = rawStr.replace("\r", "");
- rawStr = rawStr.replace("\t", "");
- rawStr = removeSpaces(rawStr);
+ return null;
+ }
+
+// public static Node<?> readInputToCnSnNew(String path, MessageBodyReader<Node<?>> reader) throws WebApplicationException {
+// InputStream inputStream = TestUtils.class.getResourceAsStream(path);
+// try {
+// return reader.readFrom(null, null, null, null, null, inputStream);
+// } catch (IOException e) {
+// LOG.error(e.getMessage());
+// assertTrue(e.getMessage(), false);
+// }
+// return null;
+// }
+
+ public static Node<?> readInputToCnSn(final String path, final MessageBodyReader<Node<?>> reader) {
+ return readInputToCnSn(path, false, reader);
+ }
+
+ public static String writeCompNodeWithSchemaContextToOutput(final Node<?> node, final Set<Module> modules,
+ final DataSchemaNode dataSchemaNode, final MessageBodyWriter<StructuredData> messageBodyWriter) throws IOException,
+ WebApplicationException {
+
+ assertNotNull(dataSchemaNode);
+ assertNotNull("Composite node can't be null", node);
+ final ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
+
+ ControllerContext.getInstance().setSchemas(loadSchemaContext(modules));
+
+ assertTrue(node instanceof CompositeNode);
+ messageBodyWriter.writeTo(new StructuredData((CompositeNode)node, dataSchemaNode, null), null, null, null, null,
+ null, byteArrayOS);
+
+ return byteArrayOS.toString();
+ }
+
+ public static String loadTextFile(final String filePath) throws IOException {
+ final FileReader fileReader = new FileReader(filePath);
+ final BufferedReader bufReader = new BufferedReader(fileReader);
+
+ String line = null;
+ final StringBuilder result = new StringBuilder();
+ while ((line = bufReader.readLine()) != null) {
+ result.append(line);