Package com.netflix.astyanax.test

Examples of com.netflix.astyanax.test.TestDriver$Event


//            })
        .build();
       
        final List<HostConnectionPool<TestClient>> hostPools = Lists.newArrayList(pool.getActivePools());
       
        final TestDriver driver = new TestDriver.Builder()
            .withIterationCount(0)
            .withThreadCount(200)
//            .withFutures(100,  TimeUnit.MILLISECONDS)
            .withCallsPerSecondSupplier(Suppliers.ofInstance(200))
//            .withFutures(100, TimeUnit.MILLISECONDS)
            .withCallback(new Function<TestDriver, Void>() {
                public Void apply(final TestDriver driver) {
                    long startTime = System.nanoTime();
                    try {
                        pool.executeWithFailover(new TestOperation() {
                            public String execute(TestClient client) throws ConnectionException, OperationException {
                                try {
                                    function.apply(driver);
                                    return null;
                                }
                                catch (RuntimeException e) {
                                    if (e.getCause() instanceof ConnectionException)
                                        throw (ConnectionException)e.getCause();
                                    throw e;
                                }
                            }
                        }, new RunOnce());
                    } catch (PoolTimeoutException e) {
                        LOG.info(e.getMessage());
                    } catch (ConnectionException e) {
                    } finally {
                        sampler.addSample((System.nanoTime() - startTime)/1000000);
                    }
                   
                    return null;
                }
            })
           
            //
            //  Event to turn timeouts on/off
            //
            .withRecurringEvent(10,  TimeUnit.SECONDS,  new Function<TestDriver, Void>() {
                @Override
                public Void apply(TestDriver driver) {
                    timeoutsEnabled.getAndSet(!timeoutsEnabled.get());
//                    LOG.info("Toggle timeouts " + timeoutsEnabled.get());
                    return null;
                }
            })
           
            //
            //  Print status information
            //
            .withRecurringEvent(1,  TimeUnit.SECONDS,  new Function<TestDriver, Void>() {
                @Override
                public Void apply(TestDriver driver) {
                    long opCount = lastOperationCount.get();
                    lastOperationCount.set(driver.getOperationCount());
                   
                    System.out.println("" + driver.getRuntime() + "," + sampler.getScore() + "," + (lastOperationCount.get() - opCount));
                    System.out.println(monitor.toString());
                    System.out.println(monitor.toString());
                    for (HostConnectionPool<TestClient> host : pool.getPools()) {
                        System.out.println("   " + host.toString());
                    }
                    return null;
                }
            })
           
            //
            //  Remove a random host
            //
            .withRecurringEvent(10,  TimeUnit.SECONDS,  new Function<TestDriver, Void>() {
                @Override
                public Void apply(TestDriver driver) {
//                    System.out.println("Latency: " + sampler.getScore());
//                   
//                    List<Host> newHosts = Lists.newArrayList(hosts);
//                    newHosts.remove(new Random().nextInt(hosts.size()));
//                    pool.setHosts(newHosts);
//                   
//                    System.out.println(monitor.toString());
//                    for (HostConnectionPool<TestClient> host : pool.getPools()) {
//                        System.out.println("   " + host.toString());
//                    }
                    return null;
                }
            })
            .build();
       
        driver.start();
        try {
            driver.await();
        } catch (InterruptedException e) {
        }
    }
View Full Code Here


      Event[] events = history.getLatestPage();

      System.out.println("Events In the latestPage are : ");
      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " + anEvent.getClass().getName()
            + "  FullFormattedMessage: "
            + anEvent.getFullFormattedMessage());
      }
    } catch (Exception e)
    {
      System.out.println("Caught Exception : " + " Name : "
          + e.getClass().getName() + " Message : " + e.getMessage()
View Full Code Here

                {
                    ArrayOfEvent aoe = (ArrayOfEvent) value;
                    Event[] evts = aoe.getEvent();
                    for (int evtID = 0; evtID < evts.length; ++evtID)
                    {
                        Event anEvent = evts[evtID];
                        System.out.println("\n----------" + "\n Event ID: "
                                + anEvent.getKey() + "\n Event: "
                                + anEvent.getClass().getName()
                                + "\n FullFormattedMessage: "
                                + anEvent.getFullFormattedMessage()
                                + "\n VM Reference: "
                                + anEvent.getVm().getVm().get_value()
                                + "\n----------\n");
                    }
                } else if (value instanceof VmEvent)
                {
                    VmEvent anEvent = (VmEvent) value;
                    System.out.println("\n----------" + "\n Event ID: "
                            + anEvent.getKey() + "\n Event: "
                            + anEvent.getClass().getName()
                            + "\n FullFormattedMessage: "
                            + anEvent.getFullFormattedMessage()
                            + "\n VM Reference: "
                            + anEvent.getVm().getVm().get_value()
                            + "\n----------\n");
                }
                System.out.println("===============");
            }
        }
View Full Code Here

        evtMgr.createCollectorForEvents(eventFilter);
      Event[] events = ehc.getLatestPage();

      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " +
            anEvent.getClass().getName());
      }
    }
    si.getServerConnection().logout();
  }
View Full Code Here

    ServiceInstance si = new ServiceInstance(
        new URL(args[0]), args[1], args[2], true);

    // get the latest event and print it out
    EventManager evtMgr = si.getEventManager();
    Event latestEvent = evtMgr.getLatestEvent();
    printEvent(latestEvent);

    // create a filter spec for querying events
    EventFilterSpec efs = new EventFilterSpec();
    // limit to only error and warning
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.EVENT: {
            Event event = (Event) theEObject;
            T result = caseEvent(event);
            if (result == null)
                result = caseFlowNode(event);
            if (result == null)
                result = caseInteractionNode(event);
View Full Code Here

    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
    TokenEntity tokenEntity = processInstanceImpl.getTokenMap().get(tokenId);
    processInstanceImpl.getContextInstance().setTransientVariableMap(transientVariables);
   
    if(nodeId==null){
      Event event=(Event)tokenEntity.getFlowNode();
      if(event instanceof BoundaryEvent){
        BoundaryEvent boundaryEvent=(BoundaryEvent)event;
        Activity activity =boundaryEvent.getAttachedToRef();
        boolean isCancelActivity=boundaryEvent.isCancelActivity();
        if(isCancelActivity){
View Full Code Here

    return bo != null && bo instanceof Event;
  }

  @Override
  public Object[] create(ICreateContext context) {
    Event e = (Event) getBusinessObjectForPictogramElement(context.getTargetContainer());
    EventWithDefinitions event = support.create(e);
    EventDefinition definition = createEventDefinition(context);
    event.getEventDefinitions().add(definition);
    addGraphicalRepresentation(context, definition);
    return new Object[] { definition };
View Full Code Here

  }

  @Override
  public PictogramElement add(IAddContext context) {
    ContainerShape container = context.getTargetContainer();
    Event event = (Event) getBusinessObjectForPictogramElement(container);

    EventWithDefinitions definitions = support.create(event);
    int size = definitions.getEventDefinitions().size();

    if (size > 1) {
View Full Code Here

    return intoDiagram || intoLane || intoParticipant || intoFlowELementContainer;
  }

  @Override
  public PictogramElement add(IAddContext context) {
    Event e = (Event) context.getNewObject();

    IPeService peService = Graphiti.getPeService();
    ContainerShape containerShape = peService.createContainerShape(context.getTargetContainer(), true);

    IGaService gaService = Graphiti.getGaService();

    Rectangle invisibleRect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), EVENT_SIZE, EVENT_SIZE
            + EVENT_TEXT_AREA);

    Shape ellipseShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(ellipseShape, EVENT_ELEMENT, EVENT_CIRCLE);
    Ellipse ellipse = createEventShape(ellipseShape);
    StyleUtil.applyBGStyle(ellipse, this);
    decorateEllipse(ellipse);

    Shape textShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, e.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 0, EVENT_SIZE, EVENT_SIZE, EVENT_TEXT_AREA);
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.test.TestDriver$Event

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.