Search in sources :

Example 31 with ModelInfo

use of org.eclipse.vorto.repository.api.ModelInfo in project vorto by eclipse.

the class MappingTest method testGetPlatformMappingsOfEntity.

@Test
public void testGetPlatformMappingsOfEntity() throws Exception {
    checkinModel("Color.type");
    checkinModel("sample.mapping");
    Thread.sleep(2000);
    ModelInfo colorInfo = modelRepository.getById(ModelId.fromReference("org.eclipse.vorto.examples.type.Color", "1.0.0"));
    assertEquals(1, colorInfo.getPlatformMappings().size());
    assertEquals("ios", colorInfo.getPlatformMappings().keySet().iterator().next());
}
Also used : ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) Test(org.junit.Test) AbstractIntegrationTest(org.eclipse.vorto.repository.AbstractIntegrationTest)

Example 32 with ModelInfo

use of org.eclipse.vorto.repository.api.ModelInfo in project vorto by eclipse.

the class ModelRepositoryTest method testGetReferencesFromModel.

@Test
public void testGetReferencesFromModel() throws Exception {
    checkinModel("Color.type");
    checkinModel("Colorlight.fbmodel");
    assertEquals(2, modelRepository.search("*").size());
    ModelInfo result = modelRepository.getById(ModelId.fromReference("org.eclipse.vorto.examples.fb.ColorLight", "1.0.0"));
    assertEquals(1, result.getReferences().size());
    assertEquals("org.eclipse.vorto.examples.type.Color:1.0.0", result.getReferences().get(0).getPrettyFormat());
}
Also used : ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) Test(org.junit.Test) AbstractIntegrationTest(org.eclipse.vorto.repository.AbstractIntegrationTest)

Example 33 with ModelInfo

use of org.eclipse.vorto.repository.api.ModelInfo in project vorto by eclipse.

the class ModelRepositoryTest method testGetModelById.

@Test
public void testGetModelById() throws Exception {
    checkinModel("Color.type");
    assertEquals(1, modelRepository.search("*").size());
    ModelInfo result = modelRepository.getById(ModelId.fromReference("org.eclipse.vorto.examples.type.Color", "1.0.0"));
    assertNotNull(result);
}
Also used : ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) Test(org.junit.Test) AbstractIntegrationTest(org.eclipse.vorto.repository.AbstractIntegrationTest)

Example 34 with ModelInfo

use of org.eclipse.vorto.repository.api.ModelInfo in project vorto by eclipse.

the class NotificationServiceTest method testSendCheckedModelEmail.

@Test
public void testSendCheckedModelEmail() throws Exception {
    User user = new User();
    user.setEmail("alexander.edelmann@bosch-si.com");
    user.setUsername("aedelmann");
    ModelInfo resource = new ModelInfo(new ModelId("Fridge", "org.eclipse.vorto.examples", "1.0.0"), ModelType.Functionblock);
    resource.setAuthor("andreas");
    resource.setCreationDate(new Date());
    resource.setDescription("A fridge keeps groceries fresh");
    notificationService.sendNotification(new CheckinMessage(user, resource));
    assertEquals(1, wiser.getMessages().size());
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("A new model has just been checked into the Vorto Repository"));
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("Dear aedelmann"));
}
Also used : ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) User(org.eclipse.vorto.repository.account.impl.User) CheckinMessage(org.eclipse.vorto.repository.notification.message.CheckinMessage) ModelId(org.eclipse.vorto.repository.api.ModelId) Date(java.util.Date) Test(org.junit.Test)

Example 35 with ModelInfo

use of org.eclipse.vorto.repository.api.ModelInfo in project vorto by eclipse.

the class ModelRepositoryClientTest method testSearchModelBySpecificType.

@Test
public void testSearchModelBySpecificType() throws Exception {
    Collection<ModelInfo> models = modelRepo.search(new ModelQueryBuilder().type(ModelType.InformationModel).name("XDK").build()).get();
    assertTrue(models.size() > 0);
}
Also used : ModelQueryBuilder(org.eclipse.vorto.repository.api.ModelQueryBuilder) ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) Test(org.junit.Test)

Aggregations

ModelInfo (org.eclipse.vorto.repository.api.ModelInfo)35 Test (org.junit.Test)12 ModelId (org.eclipse.vorto.repository.api.ModelId)11 IOException (java.io.IOException)9 ModelNotFoundException (org.eclipse.vorto.repository.api.exception.ModelNotFoundException)9 ByteArrayInputStream (java.io.ByteArrayInputStream)7 AbstractIntegrationTest (org.eclipse.vorto.repository.AbstractIntegrationTest)6 FatalModelRepositoryException (org.eclipse.vorto.repository.core.FatalModelRepositoryException)6 ValidationException (org.eclipse.vorto.repository.core.impl.validation.ValidationException)6 ArrayList (java.util.ArrayList)5 Node (javax.jcr.Node)5 PathNotFoundException (javax.jcr.PathNotFoundException)5 RepositoryException (javax.jcr.RepositoryException)5 ApiOperation (io.swagger.annotations.ApiOperation)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 ZipEntry (java.util.zip.ZipEntry)4 UploadTooLargeException (org.eclipse.vorto.repository.web.core.exceptions.UploadTooLargeException)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ApiResponses (io.swagger.annotations.ApiResponses)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3