Examples of SimpleEvent


Examples of bbejeck.guava.eventbus.events.SimpleEvent

    public void createCreditPurchaseEvent(String item, String ccNumber, long amount) {
        eventBus.post(new CreditPurchaseEvent(amount, ccNumber, item));
    }

    public void createSimpleEvent(String eventName) {
        eventBus.post(new SimpleEvent(eventName));
    }
View Full Code Here

Examples of ch.njol.skript.lang.util.SimpleEvent

    this.executableBy = executableBy;
   
    this.pattern = pattern;
    this.arguments = arguments;
   
    trigger = new Trigger(script, "command /" + name, new SimpleEvent(), items);
   
    bukkitCommand = setupBukkitCommand();
  }
View Full Code Here

Examples of edu.indiana.extreme.wsdl.benchmark1.SimpleEvent

        SimpleEvent[] earr = null;       
        if (method == 'e') {           
            earr = new SimpleEvent[totalInv];
            for (int i = 0; i < earr.length; i++) {
                earr[i] = new SimpleEvent();
                earr[i].setSequenceNumber(i);
                earr[i].setMessage("Message #"+i);
                earr[i].setTimestamp(Math.sqrt(i));
            }
        }

        BenchClient client = new BenchClient(td.serverLocation);

//        System.out.println("invoking " + N + (smokeTest ? " (SMOKE TEST)" : "")
//                + " times for test " + method + " arraysSize=" + td.arrSizeToSend
//                + " " + (new Date()));
        //boolean validate = true;
        long start = System.currentTimeMillis();
        for (int count = 0; count < N; count++) {
            int off = count * arrSize;
            //String arg = "echo"+i;
            if (method == 'v') {
                if (direction == 'e') {
                    client.echoVoid();
                } else if (direction == 'r' || direction == 's') {
                    throw new RuntimeException("usupported direction " + direction + " for void method");
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
            } else if (method == 'b') {
              System.arraycopy(barr, off, ba, 0, ba.length);
                byte[] uba = null;
                int ulen = -1;
                if (direction == 'e') {
                    uba = client.echoBase64(ba);
                } else if (direction == 'r') {
                    ulen = client.receiveBase64(ba);
                    if (ulen != ba.length) fail(method2s(direction, method) + " returned wrong size");
                } else if (direction == 's') {
                    uba = client.sendBase64(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if ((count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force
                    if (direction == 's') off = 0;
                    if (uba == null) fail(method2s(direction, method) + " byte array response was null");
                    if (uba.length != ba.length) {
                        fail(method2s(direction, method) + " byte array had wrong size " + uba.length
                                + " (expected " + ba.length + ")");
                    }
                    for (int i = 0; i < ba.length; i++) {
                        if (uba[i] != barr[i + off]) {
                            fail("byte array response had wrong content");
                        }
                    }
                }
            } else if (method == 'd') {
              ArrayList<Double> da = new ArrayList<Double>();              
              new Util<Double>().copyList(darr, off, da, td.arrSizeToSend);             
                List<Double> uda = null;
                int dlen = -1;
                if (direction == 'e') {
                    uda = client.echoDoubles(da);
                } else if (direction == 'r') {
                    dlen = client.receiveDoubles(da);
                    if (dlen != da.size()) fail("receive double array returned wrong size");
                } else if (direction == 's') {
                    uda = client.sendDoubles(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if ((count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force verification
                    if (direction == 's') off = 0;
                    if (uda == null) fail(method2s(direction, method) + " double array response was null");
                    if (uda.size() != da.size()) {
                        fail(method2s(direction, method) + " double array had wrong size " + uda.size()
                                + " (expected " + da.size() + ")");
                    }
                    for (int i = 0; i < uda.size(); i++) {
                        if (uda.get(i) != darr[i + off]) {
                            fail(method2s(direction, method) + " double array response had wrong content");
                        }
                    }
                }
            } else if (method == 'i') {
              ArrayList<Integer> ia = new ArrayList<Integer>();
              new Util<Integer>().copyList(iarr, off, ia, td.arrSizeToSend);
                List<Integer> uia = null;
                int ulen = -1;
                if (direction == 'e') {
                    uia = client.echoInts(ia);
                } else if (direction == 'r') {
                    ulen = client.receiveInts(ia);
                    if (ulen != ia.size()) {
                        fail(method2s(direction, method) + " receive byte array returned wrong size");
                    }
                } else if (direction == 's') {
                    uia = client.sendInts(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if ((count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force verification
                    if (direction == 's') off = 0;
                    if (uia == null) fail(method2s(direction, method) + " int array response was null");
                    if (uia.size() != ia.size()) {
                        fail(method2s(direction, method) + " int array had wrong size " + uia.size()
                                + " (expected " + ia.size() + ")");
                    }
                    for (int i = 0; i < uia.size(); i++) {
                        if (uia.get(i) != iarr[i + off]) {
                            fail(method2s(direction, method) + " int array response had wrong content");
                        }
                    }
                }
            } else if (method == 's') {
              ArrayList<String> sa = new ArrayList<String>();
              new Util<String>().copyList(sarr, off, sa, td.arrSizeToSend);
                List<String> usa = null;
                int slen = -1;
                if (direction == 'e') {
                    usa = client.echoStrings(sa);
                } else if (direction == 'r') {
                    slen = client.receiveStrings(sa);
                    if (slen != sa.size())
                        fail(method2s(direction, method) + " receive string array returned wrong size");
                } else if (direction == 's') {
                    usa = client.sendStrings(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if (start > 0 && (count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force verification
                    if (direction == 's') off = 0;
                    if (usa == null) fail(method2s(direction, method) + " string array response was null");
                    if (usa.size() != sa.size()) {
                        fail(method2s(direction, method) + " string array had wrong size " + usa.size()
                                + " (expected " + sa.size() + ")");
                    }
                    for (int i = 0; i < usa.size(); i++) {
                        String s1 = usa.get(i);
                        String s2 = sarr[i + off];
                        if (!s1.equals(s2)) {
                            fail(method2s(direction, method) + " string array response"
                                    + " had wrong content (s1=" + s1 + " s2=" + s2 + " i=" + i + ")");
                        }
                    }
                }
            } else if (method == 'm') {
              ArrayList<MeshInterfaceObject> ma = new ArrayList<MeshInterfaceObject>();
              new Util<MeshInterfaceObject>().copyList(marr, off, ma, td.arrSizeToSend);
                List<MeshInterfaceObject> uma = null;
                int slen = -1;
                if (direction == 'e') {
                    uma = client.echoMeshInterfaceObjects(ma);
                } else if (direction == 'r') {
                    slen = client.receiveMeshInterfaceObjects(ma);
                    if (slen != ma.size())
                        fail(method2s(direction, method) + " receive MeshInterfaceObject array returned wrong size");
                } else if (direction == 's') {
                    uma = client.sendMeshInterfaceObjects(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if (start > 0 && (count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force verification
                    if (direction == 's') off = 0;
                    if (uma == null) fail(method2s(direction, method) + " MeshInterfaceObject array response was null");
                    if (uma.size() != ma.size()) {
                        fail(method2s(direction, method) + " string MeshInterfaceObject had wrong size " + uma.size()
                                + " (expected " + ma.size() + ")");
                    }
                    for (int i = 0; i < uma.size(); i++) {
                        MeshInterfaceObject s1 = uma.get(i);
                        MeshInterfaceObject s2 = marr[i + off];
                        if (!toString(s1).equals(toString(s2))) {
                            fail(method2s(direction, method) + " MeshInterfaceObject array response"
                                    + " had wrong content (s1=" + s1 + " s2=" + s2 + " i=" + i + ")");
                        }
                    }
                }
            } else if (method == 'e') {
              ArrayList<SimpleEvent> ea = new ArrayList<SimpleEvent>();
              new Util<SimpleEvent>().copyList(earr, off, ea, td.arrSizeToSend);
                List<SimpleEvent> uea = null;
                int slen = -1;
                if (direction == 'e') {
                    uea = client.echoSimpleEvents(ea);
                } else if (direction == 'r') {
                    slen = client.receiveSimpleEvents(ea);
                    if (slen != ea.size())
                        fail(method2s(direction, method) + " receive SimpleEvent array returned wrong size");
                } else if (direction == 's') {
                    uea = client.sendSimpleEvents(arrSize);
                } else {
                    throw new RuntimeException("unrecongized direction " + direction);
                }
                if (start > 0 && (count == 0 || count == N - 1) && (direction == 'e' || direction == 's')) {
                    // bruta force verification
                    if (direction == 's') off = 0;
                    if (uea == null) fail(method2s(direction, method) + " SimpleEvent array response was null");
                    if (uea.size() != ea.size()) {
                        fail(method2s(direction, method) + " string SimpleEvent had wrong size " + uea.size()
                                + " (expected " + ea.size() + ")");
                    }
                    for (int i = 0; i < uea.size(); i++) {
                        SimpleEvent s1 = uea.get(i);
                        SimpleEvent s2 = earr[i + off];
                        if (!toString(s1).equals(toString(s2))) {
                            fail(method2s(direction, method) + " SimpleEvent array response"
                                    + " had wrong content (s1=" + s1 + " s2=" + s2 + " i=" + i + ")");
                        }
                    }
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

  long sequenceId;

  // called via reflection
  @SuppressWarnings("unused")
  private RecoverableMemoryChannelEvent() {
    this.event = new SimpleEvent();
  }
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

  @Test
  public void testMissingSchema() throws EventDeliveryException {
    final DatasetSink sink = sink(in, config);

    Event badEvent = new SimpleEvent();
    badEvent.setHeaders(Maps.<String, String>newHashMap());
    badEvent.setBody(serialize(expected.get(0), RECORD_SCHEMA));
    putToChannel(in, badEvent);

    // run the sink
    sink.start();
    assertThrows("Should fail", EventDeliveryException.class,
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

          file.getAbsoluteFile().toURI().toString());
    } else {
      headers.put(DatasetSinkConstants.AVRO_SCHEMA_LITERAL_HEADER,
          schema.toString());
    }
    Event e = new SimpleEvent();
    e.setBody(serialize(datum, schema));
    e.setHeaders(headers);
    return e;
  }
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

  }

  @Test
  public void indexNameShouldBePrefixDashFormattedTimestamp() {
    long time = 987654321L;
    Event event = new SimpleEvent();
    Map<String, String> headers = new HashMap<String, String>();
    headers.put("timestamp", Long.toString(time));
    event.setHeaders(headers);
    assertEquals("prefix-" + indexNameBuilder.getFastDateFormat().format(time),
        indexNameBuilder.getIndexName(event));
  }
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

    DateTimeUtils.setCurrentMillisFixed(FIXED_TIME_MILLIS);
  }

  @Test
  public void shouldEnsureTimestampHeaderPresentInTimestampedEvent() {
    SimpleEvent base = new SimpleEvent();

    TimestampedEvent timestampedEvent = new TimestampedEvent(base);
    assertEquals(FIXED_TIME_MILLIS, timestampedEvent.getTimestamp());
    assertEquals(String.valueOf(FIXED_TIME_MILLIS),
            timestampedEvent.getHeaders().get("timestamp"));
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

            timestampedEvent.getHeaders().get("timestamp"));
  }

  @Test
  public void shouldUseExistingTimestampHeaderInTimestampedEvent() {
    SimpleEvent base = new SimpleEvent();
    Map<String, String> headersWithTimestamp = Maps.newHashMap();
    headersWithTimestamp.put("timestamp", "-321");
    base.setHeaders(headersWithTimestamp );

    TimestampedEvent timestampedEvent = new TimestampedEvent(base);
    assertEquals(-321L, timestampedEvent.getTimestamp());
    assertEquals("-321", timestampedEvent.getHeaders().get("timestamp"));
  }
View Full Code Here

Examples of org.apache.flume.event.SimpleEvent

    assertEquals("-321", timestampedEvent.getHeaders().get("timestamp"));
  }

  @Test
  public void shouldUseExistingAtTimestampHeaderInTimestampedEvent() {
    SimpleEvent base = new SimpleEvent();
    Map<String, String> headersWithTimestamp = Maps.newHashMap();
    headersWithTimestamp.put("@timestamp", "-999");
    base.setHeaders(headersWithTimestamp );

    TimestampedEvent timestampedEvent = new TimestampedEvent(base);
    assertEquals(-999L, timestampedEvent.getTimestamp());
    assertEquals("-999", timestampedEvent.getHeaders().get("@timestamp"));
    assertNull(timestampedEvent.getHeaders().get("timestamp"));
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.