use of ai.elimu.model.content.multimedia.Image in project webapp by elimu-ai.
the class BaseDaoTest method testCreate.
@Test
public void testCreate() {
Image image1 = new Image();
image1.setTitle("Title1");
imageDao.create(image1);
assertNotNull(image1.getId());
Image image2 = new Image();
image2.setTitle("Title1");
imageDao.create(image2);
assertNotNull(image2.getId());
}
use of ai.elimu.model.content.multimedia.Image in project webapp by elimu-ai.
the class ImageDaoTest method testReadAllLabeled.
@Test
public void testReadAllLabeled() {
Word wordDog = new Word();
wordDog.setText("dog");
wordDao.create(wordDog);
Word wordCat = new Word();
wordCat.setText("cat");
wordDao.create(wordCat);
List<Image> images = imageDao.readAllLabeled(wordCat);
assertThat(images.size(), is(0));
Set<Word> words = new HashSet<>();
words.add(wordCat);
Image image = new Image();
image.setTitle("image");
image.setWords(words);
imageDao.create(image);
images = imageDao.readAllLabeled(wordDog);
assertThat(images.size(), is(0));
images = imageDao.readAllLabeled(wordCat);
assertThat(images.size(), is(1));
assertThat(images.get(0).getWords().size(), is(1));
words.add(wordDog);
image.setWords(words);
imageDao.update(image);
images = imageDao.readAllLabeled(wordCat);
assertThat(images.size(), is(1));
assertThat(images.get(0).getWords().size(), is(2));
}
use of ai.elimu.model.content.multimedia.Image in project webapp by elimu-ai.
the class ImageCreateController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model) {
logger.info("handleRequest");
Image image = new Image();
model.addAttribute("image", image);
model.addAttribute("contentLicenses", ContentLicense.values());
model.addAttribute("literacySkills", LiteracySkill.values());
model.addAttribute("numeracySkills", NumeracySkill.values());
model.addAttribute("timeStart", System.currentTimeMillis());
return "content/multimedia/image/create";
}
Aggregations