@Test public void testDatastreamEditorWriteStream_ManagedAsAttached() throws Exception { LocalStorage storage = new LocalStorage(); LocalObject lobject = storage.create(); String dsID = "dsID"; MediaType mime = MediaType.TEXT_PLAIN_TYPE; String label = "label"; XmlStreamEditor editor = lobject.getEditor(FoxmlUtils.managedProfile(dsID, mime, label)); assertNotNull(editor); assertNotNull(editor.getProfile()); assertEquals(mime.toString(), editor.getProfile().getDsMIME()); assertNull(editor.getProfile().getDsFormatURI()); byte[] data = "data".getBytes("UTF-8"); File attachment = tmp.newFile(); editor.write(attachment.toURI(), 0, null); editor.write(new ByteArrayInputStream(data), editor.getLastModified(), null); lobject.flush(); DigitalObject dobj = lobject.getDigitalObject(); DatastreamType ds = FoxmlUtils.findDatastream(dobj, dsID); assertNotNull(ds); assertEquals(ControlGroup.MANAGED.toExternal(), ds.getCONTROLGROUP()); DatastreamVersionType dsv = FoxmlUtils.findDataStreamVersion(dobj, dsID); assertNotNull(dsv); assertEquals(mime.toString(), dsv.getMIMETYPE()); assertEquals(label, dsv.getLABEL()); assertNull(dsv.getBinaryContent()); assertNotNull(dsv.getContentLocation()); FileInputStream fis = new FileInputStream(attachment); byte[] readdata = new byte[data.length]; assertEquals(data.length, fis.read(readdata)); fis.close(); assertArrayEquals(data, readdata); }
public LocalObject create() { return create((String) null, null); }
LocalStorage { public LocalObject create() { return create((String) null, null); } }
LocalStorage { public LocalObject create() { return create((String) null, null); }  }
LocalStorage { public LocalObject create() { return create((String) null, null); }  LocalObject load(String pid, File foxml); LocalObject create(); LocalObject create(String pid); LocalObject create(DigitalObject dobj); LocalObject create(File foxml, DigitalObject dobj); LocalObject create(File foxml); LocalObject create(String pid, File foxml); }
LocalStorage { public LocalObject create() { return create((String) null, null); }  LocalObject load(String pid, File foxml); LocalObject create(); LocalObject create(String pid); LocalObject create(DigitalObject dobj); LocalObject create(File foxml, DigitalObject dobj); LocalObject create(File foxml); LocalObject create(String pid, File foxml);  }