use of org.eclipse.winery.common.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class FilebasedRepositoryTest method getTypeForTemplateReturnsCorrectTypeForMyTinyTestArtifactTemplate.
@Test
public void getTypeForTemplateReturnsCorrectTypeForMyTinyTestArtifactTemplate() throws Exception {
this.setRevisionTo("1374c8c13ec64899360511dbe0414223b88d3b01");
ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId("http://opentosca.org/artifacttemplates", "MyTinyTest", false);
final TArtifactTemplate artifactTemplate = this.repository.getElement(artifactTemplateId);
final TEntityType typeForTemplate = this.repository.getTypeForTemplate(artifactTemplate);
Assert.assertEquals(new QName("http://winery.opentosca.org/test/artifacttypes", "MiniArtifactType"), new QName(typeForTemplate.getTargetNamespace(), typeForTemplate.getName()));
}
use of org.eclipse.winery.common.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class FilebasedRepositoryTest method getContainedFilesProducedCorrectPath.
@Test
public void getContainedFilesProducedCorrectPath() throws Exception {
ArtifactTemplateId artifactTemplateWithFilesAndSourcesId = new ArtifactTemplateId("http://plain.winery.opentosca.org/artifacttemplates", "ArtifactTemplateWithFilesAndSources", false);
DirectoryId fileDir = new ArtifactTemplateFilesDirectoryId(artifactTemplateWithFilesAndSourcesId);
SortedSet<RepositoryFileReference> files = repository.getContainedFiles(fileDir);
for (RepositoryFileReference ref : files) {
Assert.assertFalse("File " + ref.toString() + " contains empty sub directory", ref.getSubDirectory().isPresent() && ref.getSubDirectory().get().toString().equals(""));
}
}
use of org.eclipse.winery.common.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class FilebasedRepositoryTest method subDirectoryExpandedCorrectly.
@Test
public void subDirectoryExpandedCorrectly() throws Exception {
ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId("http://www.example.org", "at", false);
ArtifactTemplateSourceDirectoryId artifactTemplateSourceDirectoryId = new ArtifactTemplateSourceDirectoryId(artifactTemplateId);
final Path subDirectories = Paths.get("dir1", "dir2", "dir3");
RepositoryFileReference ref = new RepositoryFileReference(artifactTemplateSourceDirectoryId, subDirectories, "test.txt");
final FilebasedRepository repository = (FilebasedRepository) this.repository;
final Path expected = Paths.get("artifacttemplates", "http%3A%2F%2Fwww.example.org", "at", "source", "dir1", "dir2", "dir3", "test.txt");
Assert.assertEquals(expected, repository.getRepositoryRoot().relativize(repository.ref2AbsolutePath(ref)));
}
use of org.eclipse.winery.common.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class FilebasedRepositoryTest method containedFilesRecursesIntoSubDirectories.
@Test
public void containedFilesRecursesIntoSubDirectories() throws Exception {
this.setRevisionTo("5cda0035a773a9c405a70759731be3977f37e3f3");
ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId("http://winery.opentosca.org/test/artifacttemplates/fruits", "baobab-ArtifactTemplate-Peel", false);
ArtifactTemplateFilesDirectoryId directoryId = new ArtifactTemplateFilesDirectoryId(artifactTemplateId);
final SortedSet<RepositoryFileReference> containedFiles = repository.getContainedFiles(directoryId);
// TODO: real content (relative paths, ...) not checked
Assert.assertEquals(3, containedFiles.size());
}
use of org.eclipse.winery.common.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class CsarExporterTest method csarIsValidZipForArtifactTemplateWithFilesAndSources.
@Test
public void csarIsValidZipForArtifactTemplateWithFilesAndSources() throws Exception {
try (InputStream inputStream = this.createOutputAndInputStream("origin/plain", new ArtifactTemplateId("http://plain.winery.opentosca.org/artifacttemplates", "ArtifactTemplateWithFilesAndSources-ArtifactTypeWithoutProperties", false));
ZipInputStream zis = new ZipInputStream(inputStream)) {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String name = entry.getName();
Assert.assertNotNull(name);
Assert.assertFalse("name contains backslashes", name.contains("\\"));
}
}
}
Aggregations