use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MarshallingBaseCase method testUnmarshalFromUrlStringLocalFile.
@Test
public void testUnmarshalFromUrlStringLocalFile() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
File f = new File(testOutputDir, new GuidGenerator().getUUID());
String fname = f.getCanonicalPath();
if (Os.isFamily(Os.WINDOWS_FAMILY)) {
// THis is juist to remove c: and leave us with \blah.
fname = f.getCanonicalPath().substring(2).replaceAll("\\\\", "/");
}
marshaller.marshal(adapter, f);
Adapter o2 = (Adapter) marshaller.unmarshal(new URLString(fname));
assertRoundtripEquality(adapter, o2);
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MarshallingBaseCase method testRoundTripToFile.
@Test
public void testRoundTripToFile() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
File f = new File(testOutputDir, new GuidGenerator().getUUID());
marshaller.marshal(adapter, f);
assertRoundtripEquality(adapter, marshaller.unmarshal(f));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MarshallingBaseCase method testRoundTripToURL.
@Test
public void testRoundTripToURL() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
File f = new File(testOutputDir, new GuidGenerator().getUUID());
marshaller.marshal(adapter, f.toURI().toURL());
assertRoundtripEquality(adapter, marshaller.unmarshal(f.toURI().toURL()));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MarshallingBaseCase method testMarshalToFile_NonExistent.
@Test
public void testMarshalToFile_NonExistent() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
File dir = File.createTempFile("pfx", ".sfx");
File nonExistent = new File(dir, new GuidGenerator().getUUID());
try {
marshaller.marshal(adapter, nonExistent);
fail();
} catch (CoreException expected) {
} finally {
FileUtils.deleteQuietly(dir);
}
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MarshallingBaseCase method testUnmarshal_NonExistent.
@Test
public void testUnmarshal_NonExistent() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
File dir = File.createTempFile("pfx", ".sfx");
File nonExistent = new File(dir, new GuidGenerator().getUUID());
try {
marshaller.unmarshal(nonExistent);
fail();
} catch (CoreException expected) {
} finally {
FileUtils.deleteQuietly(dir);
}
}
Aggregations