@Test
  public void root() throws ResourcesException {
    JAXWSResourcesService client = JAXWSResourcesServiceClientFactory.create(BASE_ADDRESS);
    Resource root = client.getRoot();

    // Document coming from the folder
    // src/test/resources/fr/opensagres/xdocreport/resources/repository
    // See class MockRepositoryService
    Assert.assertNotNull(root);

    Assert.assertEquals("resources_jaxws", root.getName());
    Assert.assertTrue(root.getChildren().size() >= 4);

    // Sort the list of Resource because File.listFiles() doeesn' given the
    // same order
    // between different OS.
    Collections.sort(root.getChildren(), ResourceComparator.INSTANCE);

    Assert.assertEquals("Custom", root.getChildren().get(0).getName());
    Assert.assertEquals(ResourceType.CATEGORY, root.getChildren().get(0).getType());
    Assert.assertEquals("Opensagres", root.getChildren().get(1).getName());
    Assert.assertEquals(ResourceType.CATEGORY, root.getChildren().get(1).getType());
    Assert.assertEquals("Simple.docx", root.getChildren().get(2).getName());
    Assert.assertEquals("Simple.odt", root.getChildren().get(3).getName());
  }
 @Test
 public void downloadAFileInFolder()
     throws FileNotFoundException, IOException, ResourcesException {
   String resourceId = "Custom____CustomSimple.docx";
   JAXWSResourcesService client = JAXWSResourcesServiceClientFactory.create(BASE_ADDRESS);
   BinaryData document = client.download(resourceId);
   Assert.assertNotNull(document);
   Assert.assertNotNull(document.getContent());
   createFile(document.getContent(), resourceId);
 }
  @Test
  public void uploadARootFile() throws FileNotFoundException, IOException, ResourcesException {
    String resourceId = "ZzzNewSimple_" + this.getClass().getSimpleName() + ".docx";
    JAXWSResourcesService client = JAXWSResourcesServiceClientFactory.create(BASE_ADDRESS);
    InputStream document = Data.class.getResourceAsStream("Simple.docx");

    BinaryData dataIn = new BinaryData();
    dataIn.setResourceId(resourceId);
    dataIn.setContent(IOUtils.toByteArray(document));
    client.upload(dataIn);

    // Test if file was uploaded in the target/resources folder
    Assert.assertTrue(new File(resourcesFolder, resourceId).exists());

    // Test if download with the resourceId returns a non null binary data.
    BinaryData downloadedDocument = client.download(resourceId);
    Assert.assertNotNull(downloadedDocument);
    Assert.assertNotNull(downloadedDocument.getContent());
  }
 @Test
 public void name() {
   JAXWSResourcesService client = JAXWSResourcesServiceClientFactory.create(BASE_ADDRESS);
   String name = client.getName();
   Assert.assertEquals("Test-RepositoryService", name);
 }