use of org.apache.archiva.repository.storage.fs.FilesystemAsset in project archiva by apache.
the class FilesystemAssetTest method writeData.
@Test
public void writeData() throws IOException {
FilesystemAsset asset = new FilesystemAsset(filesystemStorage, "/test1234", assetPathFile);
Files.write(assetPathFile, "abcdef".getBytes("ASCII"));
try (OutputStream os = asset.getWriteStream(true)) {
IOUtils.write("test12345", os, "ASCII");
}
Assert.assertEquals("test12345", IOUtils.toString(assetPathFile.toUri().toURL(), "ASCII"));
}
use of org.apache.archiva.repository.storage.fs.FilesystemAsset in project archiva by apache.
the class FilesystemAssetTest method getFilePath.
@Test
public void getFilePath() {
FilesystemAsset asset = new FilesystemAsset(filesystemStorage, "/test1234", assetPathFile);
Assert.assertEquals(assetPathFile, asset.getFilePath());
}
use of org.apache.archiva.repository.storage.fs.FilesystemAsset in project archiva by apache.
the class FilesystemAssetTest method getModificationTime.
@Test
public void getModificationTime() throws IOException {
Instant modTime = Files.getLastModifiedTime(assetPathFile).toInstant();
FilesystemAsset asset = new FilesystemAsset(filesystemStorage, "/test123", assetPathFile);
Assert.assertTrue(modTime.equals(asset.getModificationTime()));
}
use of org.apache.archiva.repository.storage.fs.FilesystemAsset in project archiva by apache.
the class FilesystemAssetTest method exists.
@Test
public void exists() {
FilesystemAsset asset = new FilesystemAsset(filesystemStorage, "/test1234", assetPathFile);
Assert.assertTrue(asset.exists());
FilesystemAsset asset2 = new FilesystemAsset(filesystemStorage, "/test1234", Paths.get("abcdefgkdkdk"));
Assert.assertFalse(asset2.exists());
}
use of org.apache.archiva.repository.storage.fs.FilesystemAsset in project archiva by apache.
the class ArtifactContentEntriesTests method readArtifactContentEntriesRootSlash.
@Test
public void readArtifactContentEntriesRootSlash() throws Exception {
FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), "/", "foo");
log.info("artifactContentEntries: {}", artifactContentEntries);
assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(2).contains(new ArtifactContentEntry("org", false, 0, "foo"), new ArtifactContentEntry("META-INF", false, 0, "foo"));
}
Aggregations