XMLRepository extends AbstractFileBasedRepository { @Override public boolean exists(GenericId id) { Path absolutePath = this.id2AbsolutePath(id); return Files.exists(absolutePath); } XMLRepository(Path repositoryRoot); @Override Definitions definitionsFromRef(RepositoryFileReference ref); @Override boolean exists(GenericId id); @Override void putContentToFile(RepositoryFileReference ref, InputStream inputStream, MediaType mediaType); @Override boolean exists(RepositoryFileReference ref); SortedSet<T> getDefinitionsChildIds(Class<T> idClass, boolean omitDevelopmentVersions);  }
@Test public void namespaceWithSpaceAtEndWorks() throws Exception { this.setRevisionTo("5fdcffa9ccd17743d5498cab0914081fc33606e9"); NodeTypeId id = new NodeTypeId("http: assertFalse(this.repository.exists(id)); this.repository.flagAsExisting(id); assertTrue(this.repository.exists(id)); assertNotNull(this.repository.getElement(id)); }
@Test public void allFilesCorrectlyImported() throws Exception { this.setRevisionTo("5b7f106ab79a9ba137ece9167a79753dfc64ac84"); ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId("http: ArtifactTemplateSourceDirectoryId artifactTemplateSourceDirectoryId = new ArtifactTemplateSourceDirectoryId(artifactTemplateId); final Path subDirectories = Paths.get("dir1", "dir2", "dir3"); Path workingDir = Files.createTempDirectory("winery"); final Path subDir = workingDir.resolve(subDirectories); Files.createDirectories(subDir); Path tempFile = subDir.resolve("test.txt"); Files.createFile(tempFile); BackendUtils.importDirectory(workingDir, this.repository, artifactTemplateSourceDirectoryId); RepositoryFileReference ref = new RepositoryFileReference(artifactTemplateSourceDirectoryId, subDirectories, "test.txt"); assertTrue(repository.exists(ref)); }
@Test public void duplicateDefinition() throws Exception { this.setRevisionTo("origin/plain"); DefinitionsChildId old = new NodeTypeId("http: DefinitionsChildId newId = new NodeTypeId("http: this.repository.duplicate(old, newId); assertTrue(this.repository.exists(old)); assertTrue(this.repository.exists(newId)); }