ObjectManagerBean implements ObjectManager { @Override public String createObject(ObjectCreationRequest request) throws ObjectCreationException { Profiler.profile("Object creation request"); DigitalObject object = objectCreator.createObject(request); try { constructOaiPmhMetadata(object, OperationType.CREATION, request.getMetsProvidedURI()); } catch (MetsMetadataProcessingException e) { throw new ObjectCreationException("Unable to extract object metadata", e); } try { if (request.getMigratedFrom() != null) { DigitalObject origin = objectFinder.getDigitalObject(request.getMigratedFrom().getIdentifier()); try { constructOaiPmhMetadata(origin, OperationType.MODIFICATION); } catch (MetsMetadataProcessingException e) { throw new ObjectCreationException("Unable to extract object metadata", e); } } } catch (ObjectNotFoundException e) { logger.debug("No digital object for specified origin found."); } clearCachePaths(object.getCurrentVersion()); Profiler.dump(); return object.getIdentifiers().get(0).getIdentifier(); }  @Override String createObject(ObjectCreationRequest request); @Override int modifyObject(ObjectModificationRequest request); @Override int deleteVersion(ObjectVersionDeletionRequest request); @Override void deleteObject(ObjectDeletionRequest request); @Override ObjectFiles getFilesList(String identifier, Integer version, Boolean provided, Boolean extracted,
            Boolean hashes, Boolean absolute); @Override ObjectHistory getHistory(String identifier, boolean ascending); @Override ResultFile getObject(ObjectFetchingRequest request); @Override ResultFile getContentFiles(FileFetchingRequest request); @Override ResultFile getContentFile(String objectId, Integer version, String filePath); @Override ResultFile getMainFile(FileFetchingRequest request); @Override ResultFile getMetadata(String identifier, Integer version, boolean provided); @Override String getMetsForObject(String identifier, Integer version); @Override MetadataSectionsCollection getMetsMetadataSection(String identifier, String mid); @Override InputStream getMetadataSectionById(String eid, String mid); @Override InputStream getMetadataSectionById(String eid, String mid, Integer vid); @Override InputStream getMetadataSectionById(String eid, String mid, Integer vid, String fid); @Override Map<String, String> getFilesIdLocationMap(String identifier); @Override Map<String, String> getFilesIdLocationMap(String identifier, Integer vid);  }
@Test public void shouldCreateObjectProperly() throws ObjectCreationException { URL url = getClass().getResource("/physarch.png"); File file = new File(url.getPath()); URI source = file.toURI(); InputFile inputFile = new InputFile(source); Set<InputFile> inputFiles = new HashSet<InputFile>(); inputFiles.add(inputFile); Map<String, URI> objectMetadata = new HashMap<String, URI>(); ObjectCreationRequest request = new ObjectCreationRequest(inputFiles, objectMetadata, ObjectType.MASTER); String objectId = objectManager.createObject(request); Assert.assertEquals("oai:zmd.wrdz.synat.psnc.pl:1000", objectId); }