use of org.exoplatform.xml.object.XMLCollection in project kernel by exoplatform.
the class TestField method testNoProfile.
public void testNoProfile() throws Exception {
XMLCollection xc = getConfiguredCollection();
assertEquals(Arrays.asList("manager"), xc.getCollection());
}
use of org.exoplatform.xml.object.XMLCollection in project kernel by exoplatform.
the class TestField method testBarProfile.
public void testBarProfile() throws Exception {
XMLCollection xc = getConfiguredCollection("bar");
assertEquals(Arrays.asList("foo_bar_manager"), xc.getCollection());
}
use of org.exoplatform.xml.object.XMLCollection in project kernel by exoplatform.
the class TestField method testFooProfile.
public void testFooProfile() throws Exception {
XMLCollection xc = getConfiguredCollection("foo");
assertEquals(Arrays.asList("foo_manager"), xc.getCollection());
}
use of org.exoplatform.xml.object.XMLCollection in project kernel by exoplatform.
the class TestDataXML method testConvert.
public void testConvert() throws Exception {
String projectdir = System.getProperty("basedir");
XMLObject xmlobj = new XMLObject(new TestObject());
String xml1 = new String(xmlobj.toByteArray("UTF-8"));
FileOutputStream os = new FileOutputStream(projectdir + "/target/test-object-1.xml");
os.write(xml1.getBytes());
os.close();
File file = new File(projectdir + "/target/test-object-1.xml");
FileInputStream is = new FileInputStream(file);
FileChannel fchan = is.getChannel();
ByteBuffer buff = ByteBuffer.allocate((int) file.length());
fchan.read(buff);
buff.rewind();
byte[] data = buff.array();
buff.clear();
fchan.close();
is.close();
TestObject tobject = (TestObject) XMLObject.getObject(new ByteArrayInputStream(data));
assertTrue(tobject.nested.intarray.length == 10);
os = new FileOutputStream(projectdir + "/target/test-object-2.xml");
xmlobj = new XMLObject(tobject);
String xml2 = new String(xmlobj.toByteArray("UTF-8"));
os.write(xml2.getBytes());
os.close();
assertTrue(xml1.equals(xml2));
is.close();
List list = new ArrayList();
list.add("test.....................");
list.add(new Date());
XMLCollection xmllist = new XMLCollection(list);
os = new FileOutputStream(projectdir + "/target/list.xml");
os.write(xmllist.toByteArray("UTF-8"));
os.close();
}
Aggregations