Package net.alteiar.image

Examples of net.alteiar.image.ImageBean


  @Test
  public void testBenchmarkMediumImages() {
    try {
      Timer t = new Timer();
      t.start();
      ImageBean bean = new ImageBean(new WebImage(new URL(
          "http://www.alteiar.net/images/cartes/Carte_du_monde.jpg")));
      UniqueID id = bean.getId();

      CampaignClient.getInstance().addNotPermaBean(bean);
      t.end("server sended");
      bean = CampaignClient.getInstance().getBean(id, time10second);
      if (bean != null) {
        BufferedImage img = bean.getImage().restoreImage();
        t.end("server received  3.81 Mo (" + img.getWidth() + "x"
            + img.getHeight() + ") ");
      } else {
        System.out.println("server take more than 10 second");
      }
      /*
       * t.start(); CampaignClient.getInstance().addBean( new
       * DocumentImageBuilder("./test/ressources/medium.jpg"));
       * t.end("local sended"); doc =
       * CampaignClient.getInstance().getDocument(id, time10second); if
       * (doc != null) { t.end("local received"); } else {
       * System.out.println("local take more than 1 second"); }
       */

      t.start();
      CampaignClient.getInstance().addNotPermaBean(
          new ImageBean(new SerializableImage(new File(
              "./test/ressources/medium.jpg"))));
      t.end("transfert sended");
      bean = CampaignClient.getInstance().getBean(id, time10second);
      if (bean != null) {
        BufferedImage img = bean.getImage().restoreImage();
        t.end("transfert received 3.81 Mo (" + img.getWidth() + "x"
            + img.getHeight() + ") ");
      } else {
        System.out.println("transfert take more than 10 second");
      }
View Full Code Here


  @Test
  public void testBenchmarkLargeImages() {
    try {
      Timer t = new Timer();
      t.start();
      ImageBean bean = new ImageBean(new WebImage(new URL(
          "http://www.alteiar.net/MyUpload/large.jpg")));
      UniqueID id = bean.getId();

      CampaignClient.getInstance().addNotPermaBean(bean);
      t.end("server sended");
      bean = CampaignClient.getInstance().getBean(id, time30second);
      if (bean != null) {
        BufferedImage img = bean.getImage().restoreImage();
        t.end("server received 11.8 Mo (" + img.getWidth() + "x"
            + img.getHeight() + ") ");
      } else {
        System.out.println("server take more than 10 second");
      }

      /*
       * t.start(); CampaignClient.getInstance().createDocument( new
       * DocumentImageBuilder("./test/ressources/large.jpg"));
       * t.end("local sended"); doc =
       * CampaignClient.getInstance().getDocument(id, time30second); if
       * (doc != null) { t.end("local received"); } else {
       * System.out.println("local take more than 10 second"); }
       */

      t.start();
      CampaignClient.getInstance().addNotPermaBean(
          new ImageBean(new SerializableImage(new File(
              "./test/ressources/large.jpg"))));
      t.end("transfert sended");
      bean = CampaignClient.getInstance().getBean(id, time30second);
      if (bean != null) {
        BufferedImage img = bean.getImage().restoreImage();
        t.end("transfert received 11.8Mo (" + img.getWidth() + "x"
            + img.getHeight() + ") ");
      } else {
        System.out.println("transfert take more than 10 second");
      }
View Full Code Here

public class TestImageUtils extends NewCampaignTest {

  @Test
  public void testImage() {
    ImageBean image = new ImageBean();
    try {
      image.setImage(new WebImage(
          new URL(
              "http://www.alteiar.net/wiki/lib/exe/fetch.php?cache=&media=applications:chat.jpg")));

      BufferedImage target = ImageIO
          .read(new URL(
              "http://www.alteiar.net/wiki/lib/exe/fetch.php?cache=&media=applications:chat.jpg"));

      compareImage(target, image.getImage().restoreImage());

      assertEquals("get image must return null if no bean are found",
          null, ImageBean.getImage(new UniqueID()));
    } catch (MalformedURLException e) {
      fail("problem with the url");
View Full Code Here

TOP

Related Classes of net.alteiar.image.ImageBean

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.