ProcessingManager { long drb_size (File file) { String variable_name = "product_path"; Query query = new Query(SIZE_QUERY); if (query.getEnvironment().containsExternalVariable(variable_name)) { ExternalVariable[] extVariables = query.getExternalVariables(); for (int iext = 0; iext < extVariables.length; iext++) { ExternalVariable var = extVariables[iext]; String varName = var.getName(); if (varName.equals(variable_name)) { var.setValue(new fr.gael.drb.value.String(file.getAbsolutePath())); } } } else throw new UnsupportedOperationException ("Cannot set \"" + variable_name + "\" XQuery parameter."); DrbSequence sequence = query.evaluate(DrbFactory.openURI(".")); return ((fr.gael.drb.value.UnsignedLong)sequence.getItem(0).getValue(). convertTo(Value.UNSIGNED_LONG_ID)).longValue(); }  @Transactional Product process(Product product);  }
@Test public void drb_size() throws IOException { DrbFactoryResolver.setMetadataResolver (new DrbCortexMetadataResolver ( DrbCortexModel.getDefaultModel ())); ProcessingManager mgr = new ProcessingManager(); long size = mgr.drb_size(sample); Assert.assertEquals(size, SIZE); }