Пример #1
0
  private void assertEqualsNicely(final NextEvent received) {

    synchronized (this) {
      boolean foundIt = false;
      final Iterator<NextEvent> it = nextExpectedEvent.iterator();
      while (it.hasNext()) {
        final NextEvent ev = it.next();
        if (ev == received) {
          it.remove();
          foundIt = true;
          log.debug("Found expected event {}. Yeah!", received);
          break;
        }
      }
      if (!foundIt) {
        log.error(
            "Received unexpected event "
                + received
                + "; remaining expected events ["
                + SPACE_JOINER.join(nextExpectedEvent)
                + "]");
        failed(
            "TestApiListener [ApiListenerStatus]: Received unexpected event "
                + received
                + "; remaining expected events ["
                + SPACE_JOINER.join(nextExpectedEvent)
                + "]");
      }
    }
  }
  protected static String getCreateStatement(
      String schemaName,
      String tableName,
      Map<String, String> offsetFields,
      Map<String, String> otherFields) {
    List<String> fieldFormats = new ArrayList<>();
    for (Map.Entry<String, String> offsetFieldEntry : offsetFields.entrySet()) {
      fieldFormats.add(offsetFieldEntry.getKey() + " " + offsetFieldEntry.getValue());
    }

    for (Map.Entry<String, String> otherFieldEntry : otherFields.entrySet()) {
      fieldFormats.add(otherFieldEntry.getKey() + " " + otherFieldEntry.getValue());
    }

    if (!offsetFields.isEmpty()) {
      fieldFormats.add("PRIMARY KEY(" + COMMA_SPACE_JOINER.join(offsetFields.keySet()) + ")");
    }

    String createQuery =
        String.format(
            CREATE_STATEMENT_TEMPLATE,
            schemaName,
            tableName,
            COMMA_SPACE_JOINER.join(fieldFormats));
    LOG.info("Created Query : " + createQuery);

    return createQuery;
  }
  @Override
  @Transactional(rollbackFor = Exception.class)
  public void insert(T t) throws Exception {
    List<String> columns = new ArrayList<String>();
    List<String> values = new ArrayList<String>();
    MapSqlParameterSource namedParameters = new MapSqlParameterSource();

    for (Field field : t.getClass().getDeclaredFields()) {

      String fieldName = field.getName();
      field.setAccessible(true);
      Object value = field.get(t);

      columns.add(fieldName);
      values.add(String.format(":%s", fieldName));
      namedParameters.addValue(fieldName, value);
    }

    StringBuilder sql = new StringBuilder();
    sql.append("INSERT INTO ").append(table);
    sql.append(" (").append(comma.join(columns)).append(")");
    sql.append(" VALUES");
    sql.append(" (").append(comma.join(values)).append(")");

    namedJdbcTemplate.update(sql.toString(), namedParameters);
    logger.info(sql);
  }
  private void compareTableMetaData() {

    if (this.srcTableMetaData == null) {
      throw new RuntimeException("src table meta is null");
    }

    if (this.tgtTableMetaData == null) {
      throw new RuntimeException("tgt table meta is null");
    }
    List<ColumnMetaData> srcColumnMetaDatas = srcTableMetaData.getColumnMetaDatas();
    List<ColumnMetaData> tgtColumnMetaDatas = tgtTableMetaData.getColumnMetaDatas();

    Iterator<ColumnMetaData> metaDataIterator = srcColumnMetaDatas.iterator();
    while (metaDataIterator.hasNext()) {
      ColumnMetaData rowData = metaDataIterator.next();
      int index = tgtColumnMetaDatas.indexOf(rowData);
      if (index > -1) {
        metaDataIterator.remove();
        tgtColumnMetaDatas.remove(index);
      }
    }

    if (CollectionUtils.isNotEmpty(srcColumnMetaDatas)
        || CollectionUtils.isNotEmpty(tgtColumnMetaDatas)) {
      String errorInfo =
          String.format(
              "src table meta [%s] not equal tgt meta [%s]",
              joiner.join(srcColumnMetaDatas), joiner.join(tgtColumnMetaDatas));
      throw new RuntimeException(errorInfo);
    }
  }
Пример #5
0
  /**
   * This method generates the virtual table create SQL for the specified index. Note: Any column
   * that contains an '=' will cause the statement to fail because it triggers SQLite to expect that
   * a parameter/value is being passed in.
   *
   * @param indexName the index name to be used when creating the SQLite virtual table
   * @param columns the columns in the table
   * @param indexSettings the special settings to apply to the virtual table - (only 'tokenize' is
   *     current supported)
   * @return the SQL to create the SQLite virtual table
   */
  private String createVirtualTableStatementForIndex(
      String indexName, List<String> columns, List<String> indexSettings) {
    String tableName = IndexManager.tableNameForIndex(indexName);
    Joiner joiner = Joiner.on(",").skipNulls();
    String cols = joiner.join(columns);
    String settings = joiner.join(indexSettings);

    return String.format(
        "CREATE VIRTUAL TABLE %s USING FTS4 ( %s, %s )", tableName, cols, settings);
  }
Пример #6
0
  @SuppressWarnings(value = {"unchecked"})
  private static Object getRuleFeature(
      HasRuleValues hasRuleValues,
      AssociationRule associationRule,
      PMMLObject element,
      OutputField.RuleFeature ruleFeature) {

    switch (ruleFeature) {
      case ANTECEDENT:
        return getItemValues(hasRuleValues, associationRule.getAntecedent());
      case CONSEQUENT:
        return getItemValues(hasRuleValues, associationRule.getConsequent());
      case RULE:
        {
          Joiner joiner = Joiner.on(',');

          StringBuilder sb = new StringBuilder();

          String left = joiner.join(getItemValues(hasRuleValues, associationRule.getAntecedent()));
          sb.append('{').append(left).append('}');

          sb.append("->");

          String right = joiner.join(getItemValues(hasRuleValues, associationRule.getConsequent()));
          sb.append('{').append(right).append('}');

          return sb.toString();
        }
      case RULE_ID:
        {
          HasEntityRegistry<AssociationRule> hasEntityRegistry =
              (HasEntityRegistry<AssociationRule>) hasRuleValues;

          return EntityUtil.getId(associationRule, hasEntityRegistry);
        }
      case CONFIDENCE:
        return associationRule.getConfidence();
      case SUPPORT:
        return associationRule.getSupport();
      case LIFT:
        return associationRule.getLift();
      case LEVERAGE:
        return associationRule.getLeverage();
      case AFFINITY:
        return associationRule.getAffinity();
      default:
        throw new UnsupportedFeatureException(element, ruleFeature);
    }
  }
Пример #7
0
    @Override
    protected void assertMoreInvariants(Map<K, V> map) {
      // TODO: can these be moved to MapInterfaceTest?
      for (Entry<K, V> entry : map.entrySet()) {
        assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }
Пример #8
0
  // NOTE: this errormessage is being used by webupdates.
  public static Message parentAuthenticationFailed(
      final RpslObject object,
      final AttributeType attributeType,
      final Iterable<RpslObject> candidates) {
    final CharSequence joined =
        LIST_JOINED.join(
            Iterables.transform(
                candidates,
                new Function<RpslObject, CharSequence>() {
                  @Override
                  public CharSequence apply(final RpslObject input) {
                    return input == null ? "" : input.getKey();
                  }
                }));

    return new Message(
        Type.ERROR,
        ""
            + "Authorisation for parent [%s] %s failed\n"
            + "using \"%s:\"\n"
            + (joined.length() == 0 ? "no valid maintainer found\n" : "not authenticated by: %s"),
        object.getType().getName(),
        object.getKey(),
        attributeType.getName(),
        joined);
  }
  protected static String getInsertStatement(
      String schemaName, String tableName, Collection<Field> fields) {
    List<String> fieldFormats = new ArrayList<>();
    for (Field field : fields) {
      String fieldFormat =
          (field
                  .getType()
                  .isOneOf(
                      Field.Type.DATE,
                      Field.Type.TIME,
                      Field.Type.DATETIME,
                      Field.Type.CHAR,
                      Field.Type.STRING))
              ? "'" + getStringRepOfFieldValueForInsert(field) + "'"
              : getStringRepOfFieldValueForInsert(field);

      fieldFormats.add(fieldFormat);
    }
    String insertQuery =
        String.format(
            INSERT_STATEMENT_TEMPLATE,
            schemaName,
            tableName,
            COMMA_SPACE_JOINER.join(fieldFormats));
    LOG.info("Created Query : " + insertQuery);
    return insertQuery;
  }
Пример #10
0
 private static String constructPath(Map<String, String> match, String pattern) {
   LinkedList<String> patternParts = Lists.newLinkedList(PATH_SPLITTER.split(pattern));
   List<String> pathParts = Lists.newArrayListWithExpectedSize(patternParts.size());
   for (String part : patternParts) {
     if (!part.isEmpty()) {
       // only supports simple matches, like matching
       if (VAR_START.matches(part.charAt(0))) {
         String name = part.substring(1);
         if (match.containsKey(name)) {
           pathParts.add(match.remove(name));
         } else if (!part.startsWith("*")) {
           // required variable is missing
           throw new IllegalArgumentException("Missing required option: " + name);
         }
       } else {
         // it is a required URI part
         pathParts.add(part);
       }
     } else {
       // preserve additional slashes in paths
       pathParts.add(part);
     }
   }
   return PATH_JOINER.join(pathParts);
 }
  private static String buildRequest(String flowToken, String message, String tags) {

    final String tagsToBeSent;
    if (tags != null) {
      final Iterable<String> parsedTags = SPACE_SPLITTER.split(tags);
      final Iterable<String> transformedTags =
          Iterables.transform(
              parsedTags,
              new Function<String, String>() {
                @Override
                public String apply(String s) {
                  return s.startsWith("#")
                      ? String.format("\"%s\"", s)
                      : String.format("\"#%s\"", s);
                }
              });

      if (transformedTags.iterator().hasNext()) {
        tagsToBeSent = String.format("\"tags\": [%s],", COMMA_JOINER.join(transformedTags));
      } else {
        tagsToBeSent = "";
      }
    } else {
      tagsToBeSent = "";
    }

    return String.format(
        "{\"flow_token\": \"%s\", \"event\": \"message\", %s \"content\": \"%s\"}",
        flowToken, tagsToBeSent, message);
  }
Пример #12
0
  @Override
  @Transactional(rollbackFor = Exception.class)
  public void update(T t) throws Exception {
    List<String> columns = new ArrayList<String>();
    MapSqlParameterSource namedParameters = new MapSqlParameterSource();

    for (Field field : t.getClass().getDeclaredFields()) {
      String fieldName = field.getName();
      field.setAccessible(true);
      Object value = field.get(t);

      if (!"id".equals(fieldName)) {
        columns.add(String.format("%s=:%s", fieldName, fieldName));
      }
      namedParameters.addValue(fieldName, value);
    }

    StringBuilder sql = new StringBuilder();
    sql.append("UPDATE ").append(table);
    sql.append(" SET ").append(comma.join(columns));
    sql.append(" WHERE id=:id");

    namedJdbcTemplate.update(sql.toString(), namedParameters);
    logger.info(sql);
  }
Пример #13
0
  private String createIndexTableStatementForIndex(String indexName, List<String> columns) {
    String tableName = IndexManager.tableNameForIndex(indexName);
    Joiner joiner = Joiner.on(" NONE,").skipNulls();
    String cols = joiner.join(columns);

    return String.format("CREATE TABLE %s ( %s NONE )", tableName, cols);
  }
Пример #14
0
 public void pushExpectedEvent(final NextEvent next) {
   synchronized (this) {
     nextExpectedEvent.add(next);
     log.debug("Stacking expected event {}, got [{}]", next, SPACE_JOINER.join(nextExpectedEvent));
     completed = false;
   }
 }
Пример #15
0
  @Test
  public void testRestartCleansOldStatus() throws Exception {
    cf.create()
        .creatingParentsIfNeeded()
        .forPath(joiner.join(tasksPath, task.getId()), jsonMapper.writeValueAsBytes(task));

    Assert.assertTrue(
        TestUtils.conditionValid(
            new IndexingServiceCondition() {
              @Override
              public boolean isValid() {
                try {
                  return cf.checkExists().forPath(joiner.join(statusPath, task.getId())) != null;
                } catch (Exception e) {
                  return false;
                }
              }
            }));
    // simulate node restart
    workerTaskMonitor.stop();
    workerTaskMonitor = createTaskMonitor();
    workerTaskMonitor.start();
    List<TaskAnnouncement> announcements = workerCuratorCoordinator.getAnnouncements();
    Assert.assertEquals(1, announcements.size());
    Assert.assertEquals(task.getId(), announcements.get(0).getTaskStatus().getId());
    Assert.assertEquals(
        TaskStatus.Status.FAILED, announcements.get(0).getTaskStatus().getStatusCode());
  }
Пример #16
0
  public static <T> String ToFormatString(
      final T data, final DataMemberMap<T> dataMemberMap, final String typeName) {
    checkNotNull(data);
    checkNotNull(dataMemberMap);
    checkNotNull(typeName);

    Iterable<String> formatMemberStrings =
        Iterables.Map(
            dataMemberMap.values(),
            new Func1<IDataMember<T>, String>() {

              @Override
              public String DoFunc(IDataMember<T> in1) {
                return DEFAULT_JOINER.join(
                    in1.GetDataMemberName(), // 首先是DataMember的Name
                    CommonOP.NullCoalescing(
                        in1.GetDataSafely(data),
                        "",
                        NULL_VALUE)); // 然后是用DataMember从data获取的值,为空则设为NULL_VALUE
              }
            });

    // return DEFAULT_JOINER.join(Iterables.Concat(typeName, formatMemberStrings));
    return typeName + DEFAULT_SEPARATOR + DEFAULT_JOINER.join(formatMemberStrings);
  }
  /**
   * Apply the 'search by role' filter to the lucene query string.
   *
   * @param parametersMap
   * @param filters
   */
  protected void buildSearchByRoleQuery(Map<String, String> parametersMap, List<String> filters) {
    SearchableRole role =
        SearchableRole.valueOf(getSearchParam(parametersMap, REQUEST_PARAMETERS.role.toString()));
    String userid = getSearchParam(parametersMap, REQUEST_PARAMETERS.userid.toString());
    AuthorizableManager authorizableManager = null;
    Session adminSession = null;
    try {
      adminSession = repository.loginAdministrative();
      authorizableManager = adminSession.getAuthorizableManager();
      Authorizable au = authorizableManager.findAuthorizable(userid);
      List<Authorizable> groups = AuthorizableUtil.getUserFacingGroups(au, authorizableManager);
      groups.add(au);

      List<String> groupStrs = new ArrayList<String>(groups.size());
      for (Authorizable memberAuthz : groups) {
        groupStrs.add(ClientUtils.escapeQueryChars(memberAuthz.getId()));
      }

      filters.add(String.format(ROLE_TEMPLATE, role.toString(), JOINER_OR.join(groupStrs)));
      adminSession.logout();
    } catch (ClientPoolException e) {
      throw new RuntimeException(e);
    } catch (StorageClientException e) {
      throw new RuntimeException(e);
    } catch (AccessDeniedException e) {
      throw new RuntimeException(e);
    } finally {
      SparseUtils.logoutQuietly(adminSession);
    }
  }
Пример #18
0
  private String createIndexIndexStatementForIndex(String indexName, List<String> columns) {
    String tableName = IndexManager.tableNameForIndex(indexName);
    String sqlIndexName = tableName.concat("_index");
    Joiner joiner = Joiner.on(",").skipNulls();
    String cols = joiner.join(columns);

    return String.format("CREATE INDEX %s ON %s ( %s )", sqlIndexName, tableName, cols);
  }
Пример #19
0
 private void writeList(String fieldName, Collection<String> list, String suffix)
     throws XMLStreamException, IOException {
   if (list.size() > 0) {
     write(fieldName + suffix, joiner.join(list));
   } else {
     write(fieldName + suffix, (String) null);
   }
 }
Пример #20
0
 /** skipNulls与useForNull不能同时使用 */
 @Test
 public void testJoiner03() {
   Joiner joiner = Joiner.on(",").skipNulls();
   joiner.useForNull("missing");
   String result = joiner.join(lists);
   System.out.println(result);
   ;
 }
Пример #21
0
  /**
   * Computes a reduced compile-time classpath from the union of direct dependencies and their
   * dependencies, as listed in the associated .deps artifacts.
   */
  public String computeStrictClasspath(String originalClasspath) throws IOException {
    if (!strictClasspathMode) {
      return originalClasspath;
    }

    return CLASSPATH_JOINER.join(
        computeStrictClasspath(CLASSPATH_SPLITTER.split(originalClasspath)));
  }
Пример #22
0
 private void setAvailableVirtualDatacenters(final List<Integer> ids) {
   if (ids == null || ids.size() == 0) {
     target.setAvailableVirtualDatacenters("");
   } else {
     Joiner joiner = Joiner.on(",").skipNulls();
     target.setAvailableVirtualDatacenters(joiner.join(ids));
   }
 }
Пример #23
0
  private static PlayerInfo parseFromString(int id, String playerString) throws FailedPlayer {
    PlayerInfo playerInfo = new PlayerInfo();

    String[] commaParts = playerString.split(", ");
    if (commaParts.length != 2) {
      throw new FailedPlayer(id, "Found player without exactly one comma.");
    }

    playerInfo.lastName = commaParts[0];

    String remainingString = commaParts[1];

    List<String> spaceParts = Lists.newArrayList(remainingString.split(" "));
    int numParts = spaceParts.size();

    if (numParts < 3) {
      throw new FailedPlayer(
          id,
          "Found player with fewer than 3 symbols after the comma: '"
              + remainingString
              + "', Player "
              + playerString);
    }

    playerInfo.MLBTeam = Iterables.getLast(spaceParts);
    spaceParts.remove(playerInfo.MLBTeam);

    playerInfo.Position = Iterables.getLast(spaceParts);
    spaceParts.remove(playerInfo.Position);

    if (playerInfo.MLBTeam.length() < 2) {
      throw new FailedPlayer(
          id,
          "Incorrect team name '"
              + playerInfo.MLBTeam
              + "', from remainder string '"
              + remainingString
              + "'");
    }

    if (playerInfo.Position.length() < 1) {
      throw new FailedPlayer(
          id,
          "Incorrect position '"
              + playerInfo.Position
              + "', from remainder string '"
              + remainingString
              + "'");
    }

    if (spaceParts.size() < 1) {
      throw new FailedPlayer(id, "Found no parts remaining in the first name piece.");
    }

    Joiner joiner = Joiner.on(" ");
    playerInfo.firstName = joiner.join(spaceParts);
    return playerInfo;
  }
  private BoundRequestBuilder getBuilderWithHeaderAndQuery(
      final String verb,
      final String url,
      @Nullable final String username,
      @Nullable final String password,
      final Multimap<String, String> options) {
    BoundRequestBuilder builder;

    if (verb.equals("GET")) {
      builder = httpClient.prepareGet(url);
    } else if (verb.equals("POST")) {
      builder = httpClient.preparePost(url);
    } else if (verb.equals("PUT")) {
      builder = httpClient.preparePut(url);
    } else if (verb.equals("DELETE")) {
      builder = httpClient.prepareDelete(url);
    } else if (verb.equals("HEAD")) {
      builder = httpClient.prepareHead(url);
    } else if (verb.equals("OPTIONS")) {
      builder = httpClient.prepareOptions(url);
    } else {
      throw new IllegalArgumentException("Unrecognized verb: " + verb);
    }

    if (username != null && password != null) {
      final Realm realm = new RealmBuilder().setPrincipal(username).setPassword(password).build();
      builder.setRealm(realm);
    }

    final Collection<String> acceptHeaders = options.removeAll(HTTP_HEADER_ACCEPT);
    final String acceptHeader;
    if (!acceptHeaders.isEmpty()) {
      acceptHeader = CSV_JOINER.join(acceptHeaders);
    } else {
      acceptHeader = ACCEPT_JSON;
    }
    builder.addHeader(HTTP_HEADER_ACCEPT, acceptHeader);

    String contentTypeHeader = getUniqueValue(options, HTTP_HEADER_CONTENT_TYPE);
    if (contentTypeHeader == null) {
      contentTypeHeader = CONTENT_TYPE_JSON;
    } else {
      options.removeAll(HTTP_HEADER_CONTENT_TYPE);
    }
    builder.addHeader(HTTP_HEADER_CONTENT_TYPE, contentTypeHeader);

    builder.setBodyEncoding("UTF-8");

    for (final String key : options.keySet()) {
      if (options.get(key) != null) {
        for (final String value : options.get(key)) {
          builder.addQueryParam(key, value);
        }
      }
    }

    return builder;
  }
Пример #25
0
    @Override
    protected void assertMoreInvariants(Map<K, V> map) {

      BiMap<K, V> bimap = (BiMap<K, V>) map;

      for (Entry<K, V> entry : map.entrySet()) {
        assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
        assertEquals(entry.getKey(), bimap.inverse().get(entry.getValue()));
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }
 @Override
 public boolean addDynamicField(final String name, final Collection<?> c) {
   if (c == null) {
     return false;
   } else {
     super.addField(name + collectionSuffix, JOINER.join(c));
     return true;
   }
 }
 /**
  * @zm-api-field-tag expand-all-attrs
  * @zm-api-field-description Whether to include all attribute names in the
  *     <b>&lt;getAttrs>/&lt;setAttrs></b> elements in the response if all attributes of the target
  *     are gettable/settable Valid values are:
  *     <table>
  * <tr> <td> <b>getAttrs</b> </td> <td> expand attrs in getAttrs in the response </td> </tr>
  * <tr> <td> <b>setAttrs</b> </td> <td> expand attrs in setAttrs in the response </td> </tr>
  * <tr> <td> <b>getAttrs,setAttrs</b> </td>
  *                           <td> expand attrs in both getAttrs and setAttrs in the response </td> </tr>
  * </table>
  */
 @XmlAttribute(name = AdminConstants.A_EXPAND_ALL_ATTRS, required = false)
 public String getExpandAllAttrs() {
   List<String> settings = Lists.newArrayList();
   if ((expandSetAttrs != null) && expandSetAttrs) settings.add(EXPAND_SET_ATTRS);
   if ((expandGetAttrs != null) && expandGetAttrs) settings.add(EXPAND_GET_ATTRS);
   String retVal = COMMA_JOINER.join(settings);
   if (retVal.length() == 0) return null;
   else return retVal;
 }
Пример #28
0
  public boolean isCompleted(final long timeout) {
    synchronized (this) {
      long waitTimeMs = timeout;
      do {
        try {
          final long before = System.currentTimeMillis();
          wait(100);
          if (completed) {
            // TODO PIERRE Kludge alert!
            // When we arrive here, we got notified by the current thread (Bus listener) that we
            // received
            // all expected events. But other handlers might still be processing them.
            // Since there is only one bus thread, and that the test thread waits for all events to
            // be processed,
            // we're guaranteed that all are processed when the bus events table is empty.
            // We also need to wait for in-processing notifications (see
            // https://github.com/killbill/killbill/issues/475).
            // This is really similar to TestResource#waitForNotificationToComplete.
            await()
                .atMost(timeout, TimeUnit.MILLISECONDS)
                .until(
                    new Callable<Boolean>() {
                      @Override
                      public Boolean call() throws Exception {
                        final long pending =
                            idbi.withHandle(new PendingBusOrNotificationCallback(clock));
                        log.debug("Events still in processing: {}", pending);
                        return pending == 0;
                      }
                    });
            return completed;
          }
          final long after = System.currentTimeMillis();
          waitTimeMs -= (after - before);
        } catch (final Exception ignore) {
          // Rerun one more time to provide details
          final long pending = idbi.withHandle(new PendingBusOrNotificationCallback(clock));
          log.error(
              "isCompleted : Received all events but found remaining unprocessed bus events/notifications =  {}",
              pending);
          return false;
        }
      } while (waitTimeMs > 0 && !completed);
    }

    if (!completed) {
      final Joiner joiner = Joiner.on(" ");
      log.error(
          "TestApiListener did not complete in "
              + timeout
              + " ms, remaining events are "
              + joiner.join(nextExpectedEvent));
    }
    return completed;
  }
Пример #29
0
  @Override
  public void channelConnected(final ChannelHandlerContext ctx, final ChannelStateEvent e)
      throws Exception {

    super.channelConnected(ctx, e);

    this.output.write(
        joiner.join(
            "\"Time\"", "\"Content as String\"", "\"Content as Hex-Bytes\"", "\"Unix-Timestamp\""));
    this.output.newLine();
  }
Пример #30
0
 @Value.Lazy
 public NameForms typeBuilder() {
   InnerBuilderDefinition innerBuilder = innerBuilder();
   if (innerBuilder.isExtending) {
     NameForms typeAbstract = typeAbstract();
     return ImmutableConstitution.NameForms.copyOf(typeAbstract)
         .withRelativeRaw(DOT_JOINER.join(typeAbstract.relativeRaw(), innerBuilder.simpleName))
         .withSimple(innerBuilder.simpleName);
   }
   return typeImplementationBuilder();
 }