test_class.declarator: releaseRepository
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ReleaseRepository releaseRepository;
test_class.type: ReleaseRepository
test_class.var_name: releaseRepository
test_class.file: persistence-mongodb/src/test/java/org/devgateway/ocds/persistence/mongo/spring/json/ReleasePackageJsonImportTest.java
test_class.identifier: ReleasePackageJsonImportTest
test_class.superclass: extends AbstractMongoTest
test_case.body: @Test
      public void importObjectsContract() throws Exception {
          final ClassLoader classLoader = getClass().getClassLoader();
  
          final File file = new File(classLoader
                  .getResource("json/fictional-example/ocds-213czf-000-00001-05-contract.json").getFile());
          final ReleasePackageJsonImport releasePackageJsonImport = new ReleasePackageJsonImport(releaseRepository, file);
          final Collection<Release> releases = releasePackageJsonImport.importObjects();
          final Release importedRelease = releaseRepository.findById("ocds-213czf-000-00001-05-contract").get();
  
          Assert.assertEquals(1, releases.size());
          Assert.assertNotNull(importedRelease);
          final Set<Contract> contracts = importedRelease.getContracts();
          Assert.assertEquals(Contract.Status.active, contracts.iterator().next().getStatus());
      }
test_case.class_method_signature: ReleasePackageJsonImportTest.importObjectsContract()
test_case.full_signature: @Test public void importObjectsContract()
test_case.identifier: importObjectsContract
test_case.invocations: getClassLoader getClass getFile getResource importObjects get findById assertEquals size assertNotNull getContracts assertEquals getStatus next iterator
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void importObjectsContract()
focal_class.declarator: logger = LoggerFactory.getLogger(ReleaseJsonImport.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = LoggerFactory.getLogger(ReleaseJsonImport.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: releaseRepository
focal_class.modifier: private final
focal_class.original_string: private final ReleaseRepository releaseRepository;
focal_class.type: ReleaseRepository
focal_class.var_name: releaseRepository
focal_class.declarator: releasePackageJsonToObject
focal_class.modifier: private final
focal_class.original_string: private final JsonToObject releasePackageJsonToObject;
focal_class.type: JsonToObject
focal_class.var_name: releasePackageJsonToObject
focal_class.file: persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/spring/json/ReleasePackageJsonImport.java
focal_class.identifier: ReleasePackageJsonImport
focal_class.interfaces: implements JsonImportPackage<ReleasePackage, Release>
focal_class.class_method_signature: ReleasePackageJsonImport.ReleasePackageJsonImport(final ReleaseRepository releaseRepository,
                                      final String releasePackageJsonToObject)
focal_class.full_signature: public  ReleasePackageJsonImport(final ReleaseRepository releaseRepository,
                                      final String releasePackageJsonToObject)
focal_class.identifier: ReleasePackageJsonImport
focal_class.modifiers: public
focal_class.parameters: (final ReleaseRepository releaseRepository,
                                      final String releasePackageJsonToObject)
focal_class.signature:  ReleasePackageJsonImport(final ReleaseRepository releaseRepository,
                                      final String releasePackageJsonToObject)
focal_class.class_method_signature: ReleasePackageJsonImport.ReleasePackageJsonImport(final ReleaseRepository releaseRepository, final File file)
focal_class.full_signature: public  ReleasePackageJsonImport(final ReleaseRepository releaseRepository, final File file)
focal_class.identifier: ReleasePackageJsonImport
focal_class.modifiers: public
focal_class.parameters: (final ReleaseRepository releaseRepository, final File file)
focal_class.signature:  ReleasePackageJsonImport(final ReleaseRepository releaseRepository, final File file)
focal_class.class_method_signature: ReleasePackageJsonImport.importObjects()
focal_class.full_signature: @Override public Collection<Release> importObjects()
focal_class.identifier: importObjects
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<Release>
focal_class.signature: Collection<Release> importObjects()
focal_class.class_method_signature: ReleasePackageJsonImport.logMessage(final String message)
focal_class.full_signature: @Override public void logMessage(final String message)
focal_class.identifier: logMessage
focal_class.modifiers: @Override public
focal_class.parameters: (final String message)
focal_class.return: void
focal_class.signature: void logMessage(final String message)
focal_method.body: @Override
      public Collection<Release> importObjects() throws IOException {
          final ReleasePackage releasePackage = (ReleasePackage) releasePackageJsonToObject.toObject();
          final Collection<Release> savedReleases = new LinkedHashSet<>();
  
          if (!releasePackage.getReleases().isEmpty()) {
              Set<Release> releases = releasePackage.getReleases();
              for (Release release : releases) {
                  Release savedRelease = releaseRepository.save(release);
                  savedReleases.add(savedRelease);
              }
          }
  
          return savedReleases;
      }
focal_method.class_method_signature: ReleasePackageJsonImport.importObjects()
focal_method.full_signature: @Override public Collection<Release> importObjects()
focal_method.identifier: importObjects
focal_method.invocations: toObject isEmpty getReleases getReleases save add
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Collection<Release>
focal_method.signature: Collection<Release> importObjects()