Package com.amazonaws.services.simpledb.model

Examples of com.amazonaws.services.simpledb.model.SelectRequest


   */
  @Override
  public int getNumberOfJobs(SchedulingContext ctxt) {
    log.debug("Finding number of jobs");
    try {
      SelectResult result = amazonSimpleDb.select(new SelectRequest(query
          .countJobs()));
      Item item = result.getItems().get(0);
      return Integer.parseInt(item.getAttributes().get(0).getValue());
    } catch (Exception e) {
      log.error("Could not find number of jobs", e);
View Full Code Here


   */
  @Override
  public int getNumberOfTriggers(SchedulingContext ctxt) {
    log.debug("Finding number of triggers");
    try {
      SelectResult result = amazonSimpleDb.select(new SelectRequest(query
          .countTriggers()));
      Item item = result.getItems().get(0);
      return Integer.parseInt(item.getAttributes().get(0).getValue());
    } catch (Exception e) {
      log.error("Could not find number of triggers", e);
View Full Code Here

   * </p>
   */
  @Override
  public String[] getJobNames(SchedulingContext ctxt, String groupName) {
    log.debug("Getting names of jobs");
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .jobNamesInGroup(groupName)));
    List<Item> jobs = result.getItems();
    String[] outList = new String[jobs.size()];
    int i = 0;
    for (Item item : jobs) {
View Full Code Here

   * </p>
   */
  @Override
  public String[] getTriggerNames(SchedulingContext ctxt, String groupName) {
    log.debug("Getting names of triggers");
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .triggerNamesInGroup(groupName)));
    List<Item> jobs = result.getItems();

    String[] outList = new String[jobs.size()];
    int i = 0;
View Full Code Here

   * </p>
   */
  @Override
  public String[] getJobGroupNames(SchedulingContext ctxt) {
    log.debug("Getting job group names");
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .jobGroups()));
    List<Item> jobs = result.getItems();
    Set<String> groups = new HashSet<String>();
    for (Item item : jobs) {
      groups.add(item.getAttributes().get(0).getValue());
View Full Code Here

   * </p>
   */
  @Override
  public String[] getTriggerGroupNames(SchedulingContext ctxt) {
    log.debug("Getting trigger group names");
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .triggerGroups()));
    List<Item> jobs = result.getItems();
    Set<String> groups = new HashSet<String>();
    for (Item item : jobs) {
      groups.add(item.getAttributes().get(0).getValue());
View Full Code Here

   */
  @Override
  public Trigger[] getTriggersForJob(SchedulingContext ctxt, String jobName,
      String groupName) {
    log.debug("Get triggers for Job: " + jobName + "." + groupName);
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .triggersForJob(jobName, groupName)));
    List<Item> items = result.getItems();
    Trigger[] triggers = new Trigger[items.size()];
    int i = 0;
    for (Item item : items) {
View Full Code Here

   */
  @Override
  public Trigger acquireNextTrigger(SchedulingContext ctxt, long noLaterThan) {
    log.info("Acquiring next trigger: "
        + query.acquireTrigger(dateFormat.format(new Date(noLaterThan))));
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .acquireTrigger(dateFormat.format(new Date(noLaterThan)))));
    List<Item> items = result.getItems();

    if (items.size() == 1) {
      try {
View Full Code Here

        query.put("instanceId", "testId1");

        verifyEvents(findEvents(query, new Date(0)));

        verify(sdbMock, times(2)).select(arg.capture());
        SelectRequest req = arg.getValue();
        StringBuilder sb = new StringBuilder();
        sb.append("select * from `DOMAIN` where region = 'region'");
        sb.append(" and instanceId = 'testId1'");

        Assert.assertEquals(req.getSelectExpression(), sb.toString() + " and eventTime > '0' order by eventTime desc");

        // reset for next test
        when(sdbMock.select(any(SelectRequest.class))).thenReturn(result1).thenReturn(result2);

        verifyEvents(findEvents(Type.MONKEY, query, new Date(0)));

        verify(sdbMock, times(4)).select(arg.capture());
        req = arg.getValue();
        sb.append(" and monkeyType = 'MONKEY|com.netflix.simianarmy.aws.TestSimpleDBRecorder$Type'");
        Assert.assertEquals(req.getSelectExpression(), sb.toString() + " and eventTime > '0' order by eventTime desc");

        // reset for next test
        when(sdbMock.select(any(SelectRequest.class))).thenReturn(result1).thenReturn(result2);

        verifyEvents(findEvents(Type.MONKEY, EventTypes.EVENT, query, new Date(0)));

        verify(sdbMock, times(6)).select(arg.capture());
        req = arg.getValue();
        sb.append(" and eventType = 'EVENT|com.netflix.simianarmy.aws.TestSimpleDBRecorder$EventTypes'");
        Assert.assertEquals(req.getSelectExpression(), sb.toString() + " and eventTime > '0' order by eventTime desc");

        // reset for next test
        when(sdbMock.select(any(SelectRequest.class))).thenReturn(result1).thenReturn(result2);

        verifyEvents(findEvents(Type.MONKEY, EventTypes.EVENT, query, new Date(1330538400000L)));

        verify(sdbMock, times(8)).select(arg.capture());
        req = arg.getValue();
        sb.append(" and eventTime > '1330538400000' order by eventTime desc");
        Assert.assertEquals(req.getSelectExpression(), sb.toString());
    }
View Full Code Here

  }

  @Override
    public SelectResult invokeFindImpl(boolean consistentRead, String escapedQuery) {
      LOGGER.debug("Query: {}", escapedQuery);
        return getDB().select(new SelectRequest(escapedQuery, consistentRead));
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.SelectRequest

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.