Examples of UniqueId


Examples of net.alteiar.shared.UniqueID

    assertTrue(autorizableBean.isAllowedToApplyChange(currentPlayer));
    assertTrue(autorizableBean.isAllowedToSee(currentPlayer));

    // Change the owner to no one
    autorizableBean.setOwner(new UniqueID());
    sleep();

    assertTrue(!autorizableBean.isAllowedToApplyChange(currentPlayer));
    assertTrue(!autorizableBean.isAllowedToSee(currentPlayer));
View Full Code Here

Examples of net.alteiar.shared.UniqueID

    sleep();
    assertEquals("The bean have changed", 1, COUNT_BEAN_CHANGED);
    assertEquals("The authorization have not changed", 0,
        COUNT_AUTHORIZATION_CHANGED);

    UniqueID guid = new UniqueID();
    autorizableBean.addModifier(guid);
    sleep();
    autorizableBean.removeModifier(guid);

    autorizableBean.addUser(guid);
    sleep();
    autorizableBean.removeUser(guid);
    sleep();
    autorizableBean.setPublic(true);
    sleep();
    autorizableBean.setPublic(false);
    sleep();
    HashSet<UniqueID> users = new HashSet<UniqueID>();
    users.add(new UniqueID());
    autorizableBean.setUsers(users);
    sleep();
    autorizableBean.setModifiers(users);
    sleep();
View Full Code Here

Examples of net.alteiar.shared.UniqueID

              "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");
    } catch (IOException e) {
      fail("fail to read images");
    }
View Full Code Here

Examples of net.alteiar.shared.UniqueID

public class TestUniqueId extends NewCampaignTest {

  @Test
  public void testUniqueIdEquals() {
    UniqueID id1 = new UniqueID();
    UniqueID id2 = new UniqueID();

    assertTrue("Should be equals to itself", id1.equals(id1));
    assertTrue("Should be different to another id", !id1.equals(id2));
    assertTrue("Should be different to null", !id1.equals(null));
    assertTrue("Should be different to another object", !id1.equals(""));
View Full Code Here

Examples of net.alteiar.shared.UniqueID

  public void testSequenceUniqueId() {
    // TODO increase to have a better test but take long time
    int idCount = 100;
    UniqueID[] ids = new UniqueID[idCount];
    for (int i = 0; i < ids.length; i++) {
      ids[i] = new UniqueID();
    }

    for (int i = 0; i < ids.length; i++) {
      for (int j = i + 1; j < ids.length; j++) {
        if (ids[i].equals(ids[j])) {
View Full Code Here

Examples of net.alteiar.shared.UniqueID

    Thread tr1 = new Thread(new Runnable() {
      @Override
      public void run() {
        for (int i = 0; i < ids1.length; i++) {
          ids1[i] = new UniqueID();
        }
      }
    });
    Thread tr2 = new Thread(new Runnable() {
      @Override
      public void run() {
        for (int i = 0; i < ids2.length; i++) {
          ids2[i] = new UniqueID();
        }
      }
    });
    Thread tr3 = new Thread(new Runnable() {
      @Override
      public void run() {
        for (int i = 0; i < ids3.length; i++) {
          ids3[i] = new UniqueID();
        }
      }
    });
    Thread tr4 = new Thread(new Runnable() {
      @Override
      public void run() {
        for (int i = 0; i < ids4.length; i++) {
          ids4[i] = new UniqueID();
        }
      }
    });

    tr1.start();
View Full Code Here

Examples of net.alteiar.shared.UniqueID

    assertEquals(0, countObjectFile(ImageBean.class));
  }

  @Test(timeout = 1000)
  public void testSaveBattle() {
    UniqueID battleId = null;
    try {
      battleId = TestMap.createBattle("test-map-save",
          TestMap.getDefaultImage());
    } catch (IOException e) {
      fail("no exception should occur");
View Full Code Here

Examples of net.alteiar.shared.UniqueID

  public void testBattleWithMapElement() {
    Long waitingTime = 1000L;
    MapBean emptyBattle = new MapBean("");
    assertEquals("verify emptyBattle", emptyBattle, emptyBattle);

    UniqueID battleId = null;
    try {
      battleId = createBattle("test battle 10", getDefaultImage());
    } catch (IOException e) {
      fail("fail to create battle");
    }
    assertNotNull("the battle id must'nt be null", battleId);
    MapBean battle = CampaignClient.getInstance().getBean(battleId,
        waitingTime);
    assertNotNull("the battle should not be null", battle);

    PropertyChangeListener listener = new PropertyChangeListener() {
      @Override
      public void propertyChange(PropertyChangeEvent evt) {
        innerClassCall();
      }
    };
    battle.addPropertyChangeListener(listener);

    Point position = new Point(5, 5);
    Color color = Color.GREEN;
    MapElementSize width = new MapElementSizeMeter(6.0);
    MapElementSize height = new MapElementSizePixel(42.0);

    RectangleElement rectangle = new RectangleElement(position, color,
        width, height);

    Collection<UniqueID> elementsOnMap = battle.getElements();
    assertTrue("The map shouldn't have any element",
        elementsOnMap.isEmpty());

    MapElementFactory.buildMapElement(rectangle, battle);

    // wait for the element to be in the element list
    while (elementsOnMap.isEmpty()) {
      sleep(10);
      elementsOnMap = battle.getElements();
    }

    assertEquals("The map should have 1 element", 1, elementsOnMap.size());
    assertEquals("The rectangle id should be the same", rectangle.getId(),
        elementsOnMap.iterator().next());

    assertEquals(
        "The map should have at least 1 element at the position (6,6)",
        1, battle.getElementsAt(new Point(6, 6)).size());
    assertEquals(
        "The map should'nt have any element at the position (4,4)", 0,
        battle.getElementsAt(new Point(4, 4)).size());

    battle.removeElement(elementsOnMap.iterator().next());
    while (!elementsOnMap.isEmpty()) {
      sleep(10);
      elementsOnMap = battle.getElements();
    }

    assertTrue("The map should'nt have any element",
        elementsOnMap.isEmpty());

    battle.setScale(new Scale(25, 1.5));
    battle.setFilter(new UniqueID());

    sleep();
    // Should have 4 call
    // (add element, remove element, scale change, filter change)
    verifyInnerClassCall(4);
View Full Code Here

Examples of net.alteiar.shared.UniqueID

    map.setHeight(newHeight);

    ImageBean imageBean = createBeanImage();

    CampaignClient.getInstance().addBean(imageBean);
    UniqueID newImage = imageBean.getId();

    map.setBackground(newImage);

    UniqueID newFilter = new UniqueID();
    map.setFilter(newFilter);

    HashSet<UniqueID> set = new HashSet<UniqueID>();
    set.add(new UniqueID());
    set.add(new UniqueID());
    map.setElements(set);

    waitForChange(map, "getScale", newScale);
    waitForChange(map, "getWidth", newWidth);
    waitForChange(map, "getHeight", newHeight);
View Full Code Here

Examples of net.alteiar.shared.UniqueID

    }
  }

  @Test(timeout = 10000)
  public void testBattle() {
    UniqueID battleId = null;
    try {
      battleId = createBattle("test battle", getDefaultImage());
    } catch (IOException e) {
      fail("fail to create battle");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.