Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rainer-prosi committed Sep 18, 2023
1 parent 9c80166 commit 2118b36
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
34 changes: 0 additions & 34 deletions src/test/java/org/cip4/lib/jdf/jsonutil/JSONWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,40 +696,6 @@ public void testConvertXJMFNoArray()
log.info(jsonString);
}

/**
*
*/
@Test
public void testConvertXJMFFromFile()
{
final KElement xjmf = KElement.parseFile(sm_dirTestData + "xjmf/JMF1.xjmf");
final JSONWriter jsonWriter = new JSONWriter();
jsonWriter.setXJDF();
final JSONObject o = jsonWriter.convert(xjmf);
final String jsonString = o.toJSONString();
assertTrue(jsonString.indexOf("\"Header\":{") > 0);
assertTrue(jsonString.indexOf("\"SignalStatus\":{") > 0);
new JSONObjHelper(o).writeToFile(sm_dirTestDataTemp + "status.xjmf.json");
log.info(jsonString);
}

/**
*
*/
@Test
public void testConvertXJMFFromFileNoSplit()
{
final KElement xjmf = KElement.parseFile(sm_dirTestData + "xjmf/JMF1.xjmf");
final JSONWriter jsonWriter = new JSONWriter();
jsonWriter.setXJDF(false, false);
final JSONObject o = jsonWriter.convert(xjmf);
final String jsonString = o.toJSONString();
assertTrue(jsonString.indexOf("\"Header\":{") > 0);
assertTrue(jsonString.indexOf("\"SignalStatus\":[{") > 0);
new JSONObjHelper(o).writeToFile(sm_dirTestDataTemp + "status.xjmf.json");
log.info(jsonString);
}

/**
*
*/
Expand Down
38 changes: 38 additions & 0 deletions src/test/java/org/cip4/lib/jdf/jsonutil/XJMFJSONWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@
*/
package org.cip4.lib.jdf.jsonutil;

import static org.junit.Assert.assertTrue;

import org.cip4.jdflib.auto.JDFAutoNotification.EnumClass;
import org.cip4.jdflib.core.ElementName;
import org.cip4.jdflib.core.JDFElement;
import org.cip4.jdflib.core.JDFElement.EnumVersion;
import org.cip4.jdflib.core.KElement;
import org.cip4.jdflib.extensions.MessageHelper;
import org.cip4.jdflib.extensions.XJMFHelper;
import org.cip4.jdflib.jmf.JDFMessage.EnumFamily;
import org.cip4.jdflib.jmf.JDFMessage.EnumType;
import org.cip4.jdflib.resource.JDFNotification;
import org.json.simple.JSONObject;
import org.junit.Test;

/**
Expand All @@ -65,6 +69,40 @@ public static JSONWriter getXJDFWriter()
return XJDFJSONWriterTest.getXJDFWriter(true);
}

/**
*
*/
@Test
public void testConvertXJMFFromFile()
{
final KElement xjmf = KElement.parseFile(sm_dirTestData + "xjmf/JMF1.xjmf");
final JSONWriter jsonWriter = new JSONWriter();
jsonWriter.setXJDF();
final JSONObject o = jsonWriter.convert(xjmf);
final String jsonString = o.toJSONString();
assertTrue(jsonString.indexOf("\"Header\":{") > 0);
assertTrue(jsonString.indexOf("\"SignalStatus\":{") > 0);
new JSONObjHelper(o).writeToFile(sm_dirTestDataTemp + "status.xjmf.json");
log.info(jsonString);
}

/**
*
*/
@Test
public void testConvertXJMFFromFileNoSplit()
{
final KElement xjmf = KElement.parseFile(sm_dirTestData + "xjmf/JMF1.xjmf");
final JSONWriter jsonWriter = new JSONWriter();
jsonWriter.setXJDF(false, false);
final JSONObject o = jsonWriter.convert(xjmf);
final String jsonString = o.toJSONString();
assertTrue(jsonString.indexOf("\"Header\":{") > 0);
assertTrue(jsonString.indexOf("\"SignalStatus\":[{") > 0);
new JSONObjHelper(o).writeToFile(sm_dirTestDataTemp + "status.xjmf.json");
log.info(jsonString);
}

/**
*
*/
Expand Down

0 comments on commit 2118b36

Please sign in to comment.