test_class.declarator: thrown= ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException thrown= ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.declarator: subscriptions
test_class.modifier: @Autowired
      public
test_class.original_string: @Autowired
      public Subscriptions subscriptions;
test_class.type: Subscriptions
test_class.var_name: subscriptions
test_class.declarator: subscriptionsRepository
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      SubscriptionsRepository subscriptionsRepository;
test_class.type: SubscriptionsRepository
test_class.var_name: subscriptionsRepository
test_class.file: cepheus-broker/src/test/java/com/orange/cepheus/broker/SubscriptionsTest.java
test_class.identifier: SubscriptionsTest
test_case.body: @Test
      public void addSubscriptionTest() throws URISyntaxException, SubscriptionException, SubscriptionPersistenceException {
          SubscribeContext subscribeContext = createSubscribeContextTemperature();
          String subscriptionId = subscriptions.addSubscription(subscribeContext);
  
          Assert.notNull(subscriptionId);
          Assert.hasLength(subscriptionId);
          Assert.notNull(subscriptions.getSubscription(subscriptionId));
          Map<String, Subscription> subscriptions = subscriptionsRepository.getAllSubscriptions();
          Assert.isTrue(subscriptions.size()==1);
          Assert.notNull(subscriptions.get(subscriptionId).getExpirationDate());
      }
test_case.class_method_signature: SubscriptionsTest.addSubscriptionTest()
test_case.full_signature: @Test public void addSubscriptionTest()
test_case.identifier: addSubscriptionTest
test_case.invocations: createSubscribeContextTemperature addSubscription notNull hasLength notNull getSubscription getAllSubscriptions isTrue size notNull getExpirationDate get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addSubscriptionTest()
focal_class.declarator: logger = LoggerFactory.getLogger(Subscriptions.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = LoggerFactory.getLogger(Subscriptions.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: subscriptions
focal_class.modifier: private
focal_class.original_string: private Map<String, Subscription> subscriptions;
focal_class.type: Map<String, Subscription>
focal_class.var_name: subscriptions
focal_class.declarator: patterns
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private Patterns patterns;
focal_class.type: Patterns
focal_class.var_name: patterns
focal_class.declarator: subscriptionsRepository
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      SubscriptionsRepository subscriptionsRepository;
focal_class.type: SubscriptionsRepository
focal_class.var_name: subscriptionsRepository
focal_class.file: cepheus-broker/src/main/java/com/orange/cepheus/broker/Subscriptions.java
focal_class.identifier: Subscriptions
focal_class.class_method_signature: Subscriptions.loadSubscriptionsOnStartup()
focal_class.full_signature: @PostConstruct protected void loadSubscriptionsOnStartup()
focal_class.identifier: loadSubscriptionsOnStartup
focal_class.modifiers: @PostConstruct protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void loadSubscriptionsOnStartup()
focal_class.class_method_signature: Subscriptions.addSubscription(SubscribeContext subscribeContext)
focal_class.full_signature: public String addSubscription(SubscribeContext subscribeContext)
focal_class.identifier: addSubscription
focal_class.modifiers: public
focal_class.parameters: (SubscribeContext subscribeContext)
focal_class.return: String
focal_class.signature: String addSubscription(SubscribeContext subscribeContext)
focal_class.class_method_signature: Subscriptions.deleteSubscription(UnsubscribeContext unsubscribeContext)
focal_class.full_signature: public boolean deleteSubscription(UnsubscribeContext unsubscribeContext)
focal_class.identifier: deleteSubscription
focal_class.modifiers: public
focal_class.parameters: (UnsubscribeContext unsubscribeContext)
focal_class.return: boolean
focal_class.signature: boolean deleteSubscription(UnsubscribeContext unsubscribeContext)
focal_class.class_method_signature: Subscriptions.findSubscriptions(EntityId searchEntityId, Set<String> searchAttributes)
focal_class.full_signature: public Iterator<Subscription> findSubscriptions(EntityId searchEntityId, Set<String> searchAttributes)
focal_class.identifier: findSubscriptions
focal_class.modifiers: public
focal_class.parameters: (EntityId searchEntityId, Set<String> searchAttributes)
focal_class.return: Iterator<Subscription>
focal_class.signature: Iterator<Subscription> findSubscriptions(EntityId searchEntityId, Set<String> searchAttributes)
focal_class.class_method_signature: Subscriptions.purgeExpiredSubscriptions()
focal_class.full_signature: @Scheduled(fixedDelay = 60000) public void purgeExpiredSubscriptions()
focal_class.identifier: purgeExpiredSubscriptions
focal_class.modifiers: @Scheduled(fixedDelay = 60000) public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void purgeExpiredSubscriptions()
focal_class.class_method_signature: Subscriptions.getSubscription(String subscriptionId)
focal_class.full_signature: public Subscription getSubscription(String subscriptionId)
focal_class.identifier: getSubscription
focal_class.modifiers: public
focal_class.parameters: (String subscriptionId)
focal_class.return: Subscription
focal_class.signature: Subscription getSubscription(String subscriptionId)
focal_class.class_method_signature: Subscriptions.convertDuration(String duration)
focal_class.full_signature: private Duration convertDuration(String duration)
focal_class.identifier: convertDuration
focal_class.modifiers: private
focal_class.parameters: (String duration)
focal_class.return: Duration
focal_class.signature: Duration convertDuration(String duration)
focal_method.body: public String addSubscription(SubscribeContext subscribeContext) throws SubscriptionException, SubscriptionPersistenceException {
          //if duration is not present, then lb set duration to P1M
          Duration duration = convertDuration(subscribeContext.getDuration());
          if (duration.isNegative()) {
              throw new SubscriptionException("negative duration is not allowed", new Throwable());
          }
          if (duration.isZero()) {
              duration = convertDuration("P1M");
          }
  
          // Compile all entity patterns now to check for conformance (result is cached for later use)
          try {
              subscribeContext.getEntityIdList().forEach(patterns::getPattern);
          } catch (PatternSyntaxException e) {
              throw new SubscriptionException("bad pattern", e);
          }
  
          // Generate a subscription id
          String subscriptionId = UUID.randomUUID().toString();
  
          //create subscription and set the expiration date and subscriptionId
          Subscription subscription = new Subscription(subscriptionId, Instant.now().plus(duration), subscribeContext);
  
          //save subscription
          subscriptionsRepository.saveSubscription(subscription);
          subscriptions.put(subscriptionId, subscription);
  
          return subscriptionId;
      }
focal_method.class_method_signature: Subscriptions.addSubscription(SubscribeContext subscribeContext)
focal_method.full_signature: public String addSubscription(SubscribeContext subscribeContext)
focal_method.identifier: addSubscription
focal_method.invocations: convertDuration getDuration isNegative isZero convertDuration forEach getEntityIdList toString randomUUID plus now saveSubscription put
focal_method.modifiers: public
focal_method.parameters: (SubscribeContext subscribeContext)
focal_method.return: String
focal_method.signature: String addSubscription(SubscribeContext subscribeContext)