test_class.declarator: topicName = "com.weevent.test"
test_class.modifier: private
test_class.original_string: private String topicName = "com.weevent.test";
test_class.type: String
test_class.var_name: topicName
test_class.declarator: patternTopic = "com/weevent/test"
test_class.modifier: private final static
test_class.original_string: private final static String patternTopic = "com/weevent/test";
test_class.type: String
test_class.var_name: patternTopic
test_class.declarator: tag = "tag_name"
test_class.modifier: private final static
test_class.original_string: private final static String tag = "tag_name";
test_class.type: String
test_class.var_name: tag
test_class.declarator: content = "hello world".getBytes(StandardCharsets.UTF_8)
test_class.modifier: private final static
test_class.original_string: private final static byte[] content = "hello world".getBytes(StandardCharsets.UTF_8);
test_class.type: byte[]
test_class.var_name: content
test_class.file: weevent-core/src/test/java/com/webank/weevent/core/task/SubscriptionTest.java
test_class.identifier: SubscriptionTest
test_class.superclass: extends JUnitTestBase
test_case.body: @Test
      public void testValidateTopicPattern3() {
          try {
              Subscription.validateTopicPattern("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
              Assert.fail();
          } catch (BrokerException e) {
              Assert.assertEquals(e.getCode(), ErrorCode.TOPIC_EXCEED_MAX_LENGTH.getCode());
          }
      }
test_case.class_method_signature: SubscriptionTest.testValidateTopicPattern3()
test_case.full_signature: @Test public void testValidateTopicPattern3()
test_case.identifier: testValidateTopicPattern3
test_case.invocations: validateTopicPattern fail assertEquals getCode getCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateTopicPattern3()
focal_class.declarator: uuid
focal_class.modifier: private
focal_class.original_string: private String uuid;
focal_class.type: String
focal_class.var_name: uuid
focal_class.declarator: topics
focal_class.modifier: private
focal_class.original_string: private String[] topics;
focal_class.type: String[]
focal_class.var_name: topics
focal_class.declarator: groupId
focal_class.modifier: private
focal_class.original_string: private String groupId;
focal_class.type: String
focal_class.var_name: groupId
focal_class.declarator: offset
focal_class.modifier: private
focal_class.original_string: private String offset;
focal_class.type: String
focal_class.var_name: offset
focal_class.declarator: tag
focal_class.modifier: private
focal_class.original_string: private String tag;
focal_class.type: String
focal_class.var_name: tag
focal_class.declarator: interfaceType
focal_class.modifier: private
focal_class.original_string: private String interfaceType;
focal_class.type: String
focal_class.var_name: interfaceType
focal_class.declarator: remoteIp
focal_class.modifier: private
focal_class.original_string: private String remoteIp;
focal_class.type: String
focal_class.var_name: remoteIp
focal_class.declarator: createTimeStamp = new Date()
focal_class.modifier: private
focal_class.original_string: private Date createTimeStamp = new Date();
focal_class.type: Date
focal_class.var_name: createTimeStamp
focal_class.declarator: idleTime
focal_class.modifier: private
focal_class.original_string: private int idleTime;
focal_class.type: int
focal_class.var_name: idleTime
focal_class.declarator: notifyTask
focal_class.modifier: @ToString.Exclude
      private
focal_class.original_string: @ToString.Exclude
      private NotifyTask notifyTask;
focal_class.type: NotifyTask
focal_class.var_name: notifyTask
focal_class.declarator: historyEventLoop
focal_class.modifier: @ToString.Exclude
      private
focal_class.original_string: @ToString.Exclude
      private HistoryEventLoop historyEventLoop;
focal_class.type: HistoryEventLoop
focal_class.var_name: historyEventLoop
focal_class.declarator: mergeCache
focal_class.modifier: private
focal_class.original_string: private Map<String, Long> mergeCache;
focal_class.type: Map<String, Long>
focal_class.var_name: mergeCache
focal_class.declarator: mergeBlock = 8
focal_class.modifier: private
focal_class.original_string: private int mergeBlock = 8;
focal_class.type: int
focal_class.var_name: mergeBlock
focal_class.declarator: historyBlock = 0L
focal_class.modifier: private
focal_class.original_string: private Long historyBlock = 0L;
focal_class.type: Long
focal_class.var_name: historyBlock
focal_class.file: weevent-core/src/main/java/com/webank/weevent/core/task/Subscription.java
focal_class.identifier: Subscription
focal_class.class_method_signature: Subscription.Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.full_signature: public  Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.identifier: Subscription
focal_class.modifiers: public
focal_class.parameters: (IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.signature:  Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.class_method_signature: Subscription.getNotifyingEventCount()
focal_class.full_signature: public Long getNotifyingEventCount()
focal_class.identifier: getNotifyingEventCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getNotifyingEventCount()
focal_class.class_method_signature: Subscription.getNotifiedEventCount()
focal_class.full_signature: public Long getNotifiedEventCount()
focal_class.identifier: getNotifiedEventCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getNotifiedEventCount()
focal_class.class_method_signature: Subscription.getNotifyTimeStamp()
focal_class.full_signature: public Date getNotifyTimeStamp()
focal_class.identifier: getNotifyTimeStamp
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Date
focal_class.signature: Date getNotifyTimeStamp()
focal_class.class_method_signature: Subscription.dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.full_signature: public void dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.identifier: dispatch
focal_class.modifiers: public
focal_class.parameters: (List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.return: void
focal_class.signature: void dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.class_method_signature: Subscription.doStart(Executor executor)
focal_class.full_signature: public synchronized void doStart(Executor executor)
focal_class.identifier: doStart
focal_class.modifiers: public synchronized
focal_class.parameters: (Executor executor)
focal_class.return: void
focal_class.signature: void doStart(Executor executor)
focal_class.class_method_signature: Subscription.doStop()
focal_class.full_signature: public synchronized void doStop()
focal_class.identifier: doStop
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doStop()
focal_class.class_method_signature: Subscription.stopHistory()
focal_class.full_signature: public synchronized void stopHistory()
focal_class.identifier: stopHistory
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stopHistory()
focal_class.class_method_signature: Subscription.tryStopHistory(Long mainLastBlock)
focal_class.full_signature: public synchronized boolean tryStopHistory(Long mainLastBlock)
focal_class.identifier: tryStopHistory
focal_class.modifiers: public synchronized
focal_class.parameters: (Long mainLastBlock)
focal_class.return: boolean
focal_class.signature: boolean tryStopHistory(Long mainLastBlock)
focal_class.class_method_signature: Subscription.filter(List<WeEvent> from, String[] topics, String tag)
focal_class.full_signature: public static List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)
focal_class.identifier: filter
focal_class.modifiers: public static
focal_class.parameters: (List<WeEvent> from, String[] topics, String tag)
focal_class.return: List<WeEvent>
focal_class.signature: List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)
focal_class.class_method_signature: Subscription.isTopicPattern(String pattern)
focal_class.full_signature: public static boolean isTopicPattern(String pattern)
focal_class.identifier: isTopicPattern
focal_class.modifiers: public static
focal_class.parameters: (String pattern)
focal_class.return: boolean
focal_class.signature: boolean isTopicPattern(String pattern)
focal_class.class_method_signature: Subscription.validateTopicPattern(String pattern)
focal_class.full_signature: public static void validateTopicPattern(String pattern)
focal_class.identifier: validateTopicPattern
focal_class.modifiers: public static
focal_class.parameters: (String pattern)
focal_class.return: void
focal_class.signature: void validateTopicPattern(String pattern)
focal_class.class_method_signature: Subscription.patternMatch(String topic, String pattern)
focal_class.full_signature: public static boolean patternMatch(String topic, String pattern)
focal_class.identifier: patternMatch
focal_class.modifiers: public static
focal_class.parameters: (String topic, String pattern)
focal_class.return: boolean
focal_class.signature: boolean patternMatch(String topic, String pattern)
focal_method.body: public static void validateTopicPattern(String pattern) throws BrokerException {
          if (StringUtils.isBlank(pattern)) {
              throw new BrokerException(ErrorCode.PATTERN_INVALID);
          }
  
          if (pattern.length() > WeEventConstants.TOPIC_NAME_MAX_LENGTH) {
              throw new BrokerException(ErrorCode.TOPIC_EXCEED_MAX_LENGTH);
          }
  
          for (char x : pattern.toCharArray()) {
              if (x < 32 || x > 128) {
                  throw new BrokerException(ErrorCode.TOPIC_CONTAIN_INVALID_CHAR);
              }
          }
  
          String[] layer = pattern.split(WeEvent.LAYER_SEPARATE);
          if (pattern.contains(WeEvent.WILD_CARD_ONE_LAYER)) {
              for (String x : layer) {
                  if (x.contains(WeEvent.WILD_CARD_ONE_LAYER) && !x.equals(WeEvent.WILD_CARD_ONE_LAYER)) {
                      throw new BrokerException(ErrorCode.PATTERN_INVALID);
                  }
              }
          } else if (pattern.contains(WeEvent.WILD_CARD_ALL_LAYER)) {
              // only one '#'
              if (StringUtils.countMatches(pattern, WeEvent.WILD_CARD_ALL_LAYER) != 1) {
                  throw new BrokerException(ErrorCode.PATTERN_INVALID);
              }
  
              // '#' must be at last position
              if (!layer[layer.length - 1].equals(WeEvent.WILD_CARD_ALL_LAYER)) {
                  throw new BrokerException(ErrorCode.PATTERN_INVALID);
              }
          } else {
              throw new BrokerException(ErrorCode.PATTERN_INVALID);
          }
      }
focal_method.class_method_signature: Subscription.validateTopicPattern(String pattern)
focal_method.full_signature: public static void validateTopicPattern(String pattern)
focal_method.identifier: validateTopicPattern
focal_method.invocations: isBlank length toCharArray split contains contains equals contains countMatches equals
focal_method.modifiers: public static
focal_method.parameters: (String pattern)
focal_method.return: void
focal_method.signature: void validateTopicPattern(String pattern)