use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class MappingTest method tesUploadMapping.
@Test
public void tesUploadMapping() throws IOException {
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Color.type").getInputStream()), "Color.type", "admin");
assertEquals(true, uploadResult.isValid());
assertNull(uploadResult.getErrorMessage());
assertNotNull(uploadResult.getHandleId());
ModelInfo resource = uploadResult.getModelResource();
assertEquals("org.eclipse.vorto.examples.type", resource.getId().getNamespace());
assertEquals("Color", resource.getId().getName());
assertEquals("1.0.0", resource.getId().getVersion());
assertEquals(ModelType.Datatype, resource.getType());
assertEquals(0, resource.getReferences().size());
assertEquals("Color", resource.getDisplayName());
assertNull(resource.getDescription());
assertEquals(0, modelRepository.search("*").size());
}
use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testUploadCorruptModelVersion.
@Test
public void testUploadCorruptModelVersion() throws Exception {
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Corrupt-model_namespace.type").getInputStream()), "sample_models/Corrupt-model_namespace.type", "admin");
assertEquals(false, uploadResult.isValid());
assertNotNull(uploadResult.getErrorMessage());
}
use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testCheckinInvalidModel.
@Test
public void testCheckinInvalidModel() throws Exception {
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Colorlight.fbmodel").getInputStream()), "Colorlight.fbmodel", "admin");
assertEquals(false, uploadResult.isValid());
assertNotNull(uploadResult.getErrorMessage());
}
use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testUploadModelThatCompliesToOlderVersionOfMetaModel.
@Test
public void testUploadModelThatCompliesToOlderVersionOfMetaModel() throws Exception {
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Corrupt-model_olderVersionOfMetaModel.fbmodel").getInputStream()), "sample_models/Corrupt-model_olderVersionOfMetaModel.fbmodel", "admin");
assertEquals(false, uploadResult.isValid());
assertNotNull(uploadResult.getErrorMessage());
}
use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testUploadSameModelTwiceByDifferent.
@Test
public void testUploadSameModelTwiceByDifferent() throws Exception {
checkinModel("Color.type", "alex");
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Color2.type").getInputStream()), "Color.type", "stefan");
assertFalse(uploadResult.isValid());
}
Aggregations