Package org.dddlib.image.api

Examples of org.dddlib.image.api.ImageAccess


    private Cache cache = new EhCacheBasedCache("sampleCache");

    @Test
    public void testSaveImage() throws IOException {
        String file = getClass().getResource("/aaa.jpg").getFile();
        ImageAccess imageAccess = new CacheImageAccess(cache);
        String uuid = imageAccess.saveImageFile(FileUtils.readFileToByteArray(new File(file)), "aaa.jpg");
        System.out.println(uuid);
        assertTrue(uuid != null);
        ImageFile imageFile = imageAccess.getImageFile(uuid);
        assertTrue(imageFile.getContent() != null);
        assertTrue(imageFile.getFileName().equals("aaa.jpg"));
    }
View Full Code Here


    @Test
    @Ignore
    public void testRedisCache() throws IOException {
        String file = getClass().getResource("/aaa.jpg").getFile();
        Cache redisCache = new RedisBasedCache("127.0.0.1", 6379);
        ImageAccess imageAccess = new CacheImageAccess(redisCache);
        String uuid = imageAccess.saveImageFile(FileUtils.readFileToByteArray(new File(file)), "aaa.jpg");
        System.out.println(uuid);
        assertTrue(uuid != null);
        ImageFile imageFile = imageAccess.getImageFile(uuid);
        assertTrue(imageFile.getContent() != null);
        assertTrue(imageFile.getFileName().equals("aaa.jpg"));
    }
View Full Code Here

    private String director = new File(file).getParent();

    @Test
    public void test() throws IOException {
        ImageAccess imageAccess = new FileImageAccess(director);

        String mediaId =  imageAccess.saveImageFile(FileUtils.readFileToByteArray(new File(file)),"abc.jpg");

        assertTrue(mediaId!=null);

        ImageFile imageFile = imageAccess.getImageFile(mediaId);

        assertTrue(imageFile.getContent()!=null);
        assertTrue(imageFile.getFileName().equals("abc.jpg"));

    }
View Full Code Here

TOP

Related Classes of org.dddlib.image.api.ImageAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.