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: subscriptionsRepository
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      SubscriptionsRepository subscriptionsRepository;
test_class.type: SubscriptionsRepository
test_class.var_name: subscriptionsRepository
test_class.declarator: jdbcTemplate
test_class.modifier: @Autowired
      protected
test_class.original_string: @Autowired
      protected JdbcTemplate jdbcTemplate;
test_class.type: JdbcTemplate
test_class.var_name: jdbcTemplate
test_class.file: cepheus-broker/src/test/java/com/orange/cepheus/broker/persistence/SubscriptionsRepositoryTest.java
test_class.identifier: SubscriptionsRepositoryTest
test_case.body: @Test
      public void saveSubscriptionTest() throws URISyntaxException, SubscriptionPersistenceException {
          SubscribeContext subscribeContext = createSubscribeContextTemperature();
          Subscription subscription = new Subscription("12345", Instant.now().plus(1, ChronoUnit.DAYS), subscribeContext);
          subscriptionsRepository.saveSubscription(subscription);
          Map<String, Subscription> subscriptions = subscriptionsRepository.getAllSubscriptions();
          Assert.assertEquals(1, subscriptions.size());
          Assert.assertEquals(subscription.getSubscriptionId(), subscriptions.get("12345").getSubscriptionId());
          Assert.assertEquals(subscription.getExpirationDate(), subscriptions.get("12345").getExpirationDate());
          Assert.assertEquals(subscribeContext.getDuration(), subscriptions.get("12345").getSubscribeContext().getDuration());
      }
test_case.class_method_signature: SubscriptionsRepositoryTest.saveSubscriptionTest()
test_case.full_signature: @Test public void saveSubscriptionTest()
test_case.identifier: saveSubscriptionTest
test_case.invocations: createSubscribeContextTemperature plus now saveSubscription getAllSubscriptions assertEquals size assertEquals getSubscriptionId getSubscriptionId get assertEquals getExpirationDate getExpirationDate get assertEquals getDuration getDuration getSubscribeContext get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void saveSubscriptionTest()
focal_class.declarator: logger = LoggerFactory.getLogger(SubscriptionsRepository.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = LoggerFactory.getLogger(SubscriptionsRepository.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: jdbcTemplate
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JdbcTemplate jdbcTemplate;
focal_class.type: JdbcTemplate
focal_class.var_name: jdbcTemplate
focal_class.declarator: mapper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ObjectMapper mapper;
focal_class.type: ObjectMapper
focal_class.var_name: mapper
focal_class.file: cepheus-broker/src/main/java/com/orange/cepheus/broker/persistence/SubscriptionsRepository.java
focal_class.identifier: SubscriptionsRepository
focal_class.class_method_signature: SubscriptionsRepository.createTableOnStartup()
focal_class.full_signature: @PostConstruct protected void createTableOnStartup()
focal_class.identifier: createTableOnStartup
focal_class.modifiers: @PostConstruct protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void createTableOnStartup()
focal_class.class_method_signature: SubscriptionsRepository.saveSubscription(Subscription subscription)
focal_class.full_signature: public void saveSubscription(Subscription subscription)
focal_class.identifier: saveSubscription
focal_class.modifiers: public
focal_class.parameters: (Subscription subscription)
focal_class.return: void
focal_class.signature: void saveSubscription(Subscription subscription)
focal_class.class_method_signature: SubscriptionsRepository.updateSubscription(Subscription subscription)
focal_class.full_signature: public void updateSubscription(Subscription subscription)
focal_class.identifier: updateSubscription
focal_class.modifiers: public
focal_class.parameters: (Subscription subscription)
focal_class.return: void
focal_class.signature: void updateSubscription(Subscription subscription)
focal_class.class_method_signature: SubscriptionsRepository.getAllSubscriptions()
focal_class.full_signature: public Map<String, Subscription> getAllSubscriptions()
focal_class.identifier: getAllSubscriptions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<String, Subscription>
focal_class.signature: Map<String, Subscription> getAllSubscriptions()
focal_class.class_method_signature: SubscriptionsRepository.removeSubscription(String subscriptionId)
focal_class.full_signature: public void removeSubscription(String subscriptionId)
focal_class.identifier: removeSubscription
focal_class.modifiers: public
focal_class.parameters: (String subscriptionId)
focal_class.return: void
focal_class.signature: void removeSubscription(String subscriptionId)
focal_method.body: public void saveSubscription(Subscription subscription) throws SubscriptionPersistenceException {
  
          try {
              //Mapping from model to database model
              ObjectWriter writer = mapper.writer();
              String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext());
              String expirationDate = subscription.getExpirationDate().toString();
              //insert into database
              jdbcTemplate.update("insert into t_subscriptions(id,expirationDate,subscribeContext) values(?,?,?)", subscription.getSubscriptionId(), expirationDate, susbcribeContextString);
          } catch (Exception e) {
              throw new SubscriptionPersistenceException(e);
          }
      }
focal_method.class_method_signature: SubscriptionsRepository.saveSubscription(Subscription subscription)
focal_method.full_signature: public void saveSubscription(Subscription subscription)
focal_method.identifier: saveSubscription
focal_method.invocations: writer writeValueAsString getSubscribeContext toString getExpirationDate update getSubscriptionId
focal_method.modifiers: public
focal_method.parameters: (Subscription subscription)
focal_method.return: void
focal_method.signature: void saveSubscription(Subscription subscription)