@Test public void testGetNullValues() { final Event testEvent = Event.create("type").value("key1", "val1").build(); assertTrue(testEvent.getValue("key1").isPresent()); assertFalse(testEvent.getValue("key2").isPresent()); }
@Test public void testDataValues() { final Event testEvent = Event.create("type") .distributed(true) .value("int1", 1) .value("long1", 10L) .value("bool1", false) .value("obj1", this.createTestEvent()) .build(); assertTrue(testEvent.hasValue("int1")); assertTrue(testEvent.hasValue("long1")); assertTrue(testEvent.hasValue("bool1")); assertTrue(testEvent.hasValue("obj1")); assertTrue(testEvent.getValue("int1").get() instanceof Integer); assertTrue(testEvent.getValue("long1").get() instanceof Long); assertTrue(testEvent.getValue("bool1").get() instanceof Boolean); assertTrue(testEvent.getValue("obj1").get() instanceof String); }
@Test public void testBuilder() { final Event event = this.createTestEvent(); assertEquals("type", event.getType()); assertEquals(true, event.isDistributed()); assertNotNull(event.getData()); assertTrue(event.hasValue("key1")); assertTrue(event.hasValue("key2")); assertEquals("val1", event.getValue("key1").get()); assertEquals("val2", event.getValue("key2").get()); }
public EventEntity(Event event) { mVersionCode = 1; zzasD = event.getEventId(); mName = event.getName(); zzaoB = event.getDescription(); zzaqW = event.getIconImageUri(); zzarh = event.getIconImageUrl(); zzarZ = (PlayerEntity)event.getPlayer().freeze(); zzasE = event.getValue(); zzasF = event.getFormattedValue(); zzasG = event.isVisible(); }
@Override public Position get(Position pos, Map<K, Event<V>> map) { ArrayList<Event<K>> list = new ArrayList<Event<K>>(1000); Position nextPos = get(pos, list); for (Event<K> evt : list) { K key = evt.getValue(); if (key != null) { try { V value = _store.get(key); map.put(key, new SimpleEvent<V>(value, evt.getClock())); } catch (Exception e) { _logger.warn(e.getMessage()); } } } return nextPos; }
static int zza(Event event) { return zzw.hashCode(new Object[] { event.getEventId(), event.getName(), event.getDescription(), event.getIconImageUri(), event.getIconImageUrl(), event.getPlayer(), Long.valueOf(event.getValue()), event.getFormattedValue(), Boolean.valueOf(event.isVisible()) }); }