use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testUploadSameModelByAdmin.
@Test
public void testUploadSameModelByAdmin() throws Exception {
checkinModel("Color.type", "alex");
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Color2.type").getInputStream()), "Color.type", "admin");
assertTrue(uploadResult.isValid());
modelRepository.checkin(uploadResult.getHandleId(), "admin");
IModelContent content = modelRepository.getModelContent(uploadResult.getModelResource().getId(), ContentType.DSL);
assertTrue(new String(content.getContent(), "utf-8").contains("mandatory b as int"));
}
use of org.eclipse.vorto.repository.api.upload.UploadModelResult in project vorto by eclipse.
the class ModelRepositoryTest method testCheckinValidModel.
@Test
public void testCheckinValidModel() throws Exception {
UploadModelResult uploadResult = modelRepository.upload(IOUtils.toByteArray(new ClassPathResource("sample_models/Color.type").getInputStream()), "Color.type", "admin");
assertEquals(true, uploadResult.isValid());
assertEquals(0, modelRepository.search("*").size());
User user1 = new User();
user1.setUsername("alex");
user1.setHasWatchOnRepository(true);
User user2 = new User();
user2.setUsername("andi");
user2.setHasWatchOnRepository(false);
Collection<User> recipients = new ArrayList<User>();
recipients.add(user1);
recipients.add(user2);
when(userRepository.findAll()).thenReturn(recipients);
// verify(notificationService);
modelRepository.checkin(uploadResult.getHandleId(), user1.getUsername());
Thread.sleep(1000);
assertEquals(1, modelRepository.search("*").size());
}
Aggregations