DatabaseRepresentation { public final boolean shred(final InputStream xmlInput, final String resource) throws SirixException { boolean allOk = false; NodeWriteTrx wtx = null; Database database = null; Session session = null; boolean abort = false; try { final DatabaseConfiguration dbConf = new DatabaseConfiguration( mStoragePath); Databases.createDatabase(dbConf); database = Databases.openDatabase(dbConf.getFile()); final ResourceConfiguration resConf = new ResourceConfiguration.Builder( resource, dbConf).revisionsToRestore(1).build(); if (database.createResource(resConf)) { session = database .getSession(new SessionConfiguration.Builder(resource).build()); wtx = session.beginNodeWriteTrx(); final XMLShredder shredder = new XMLShredder.Builder(wtx, RESTXMLShredder.createReader(xmlInput), Insert.ASFIRSTCHILD) .commitAfterwards().build(); shredder.call(); allOk = true; } } catch (final Exception exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session, database); } return allOk; } DatabaseRepresentation(final File storagePath); void createResource(final InputStream inputStream,
			final String resourceName); StreamingOutput getResource(final String resourceName,
			final Map<QueryParameter, String> queryParams); StreamingOutput performQueryOnResource(final String resource,
			final String query, final Map<QueryParameter, String> otherParams); StreamingOutput getResourcesNames(); boolean add(final InputStream input, final String resource); void deleteResource(final String resourceName); final boolean shred(final InputStream xmlInput, final String resource); long getLastRevision(final String resourceName); OutputStream getModificHistory(
			final String resourceName, // NOPMD this method needs alls these
			// functions
			final String revisionRange, final boolean nodeid,
			final OutputStream output, final boolean wrap); void revertToRevision(final String resourceName,
			final int backToRevision);  }
@Test public void shred() throws SirixException { final InputStream input = DatabaseRepresentationTest.class .getResourceAsStream(XMLFILE); assertTrue(ASSTRUE, sirix.shred(input, RESOURCENAME + "88")); sirix.deleteResource(RESOURCENAME + "88"); }